Skip to content

[Android] Implement ADPF hint sessions for API 35+ with AWorkDuration - #192582

Draft
gmackall wants to merge 1 commit into
flutter:masterfrom
gmackall:isolate-adpf
Draft

gmackall wants to merge 1 commit into
flutter:masterfrom
gmackall:isolate-adpf

Conversation

@gmackall

Copy link
Copy Markdown
Member
  • Gate ADPF hint session creation to Android 15+ (API 35+).
  • Dynamically resolve AWorkDuration APIs and APerformanceHint_reportActualWorkDuration2 from libandroid.so.
  • Report aggregate elapsed duration of CPU build and raster phases (build_ns + raster_ns), work period start timestamp, and total frame duration.
  • Exclude MergedPlatformUIThread::kMergeAfterLaunch to avoid tracking stale UI thread after dynamic task queue migration.
  • Manage reusable AWorkDuration instance synchronized under std::mutex with APerformanceHintSession.
  • Fix target duration state caching to only update upon successful native PowerHAL return.
  • Apply provisional 75% target frame-work ratio to leave scheduling slack while GPU duration is unmeasured.
  • De-duplicate updateTargetWorkDuration calls to prevent redundant Binder IPC.
  • Check NDK return codes, log warnings, and close session cleanly on EPIPE disconnects.
  • Switch session creation log to FML_DLOG to avoid logcat pollution.
  • Use explicit types instead of auto per Google C++ style and Flutter reviewer preference.

Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.

List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

- Gate ADPF hint session creation to Android 15+ (API 35+).
- Dynamically resolve AWorkDuration APIs and APerformanceHint_reportActualWorkDuration2 from libandroid.so.
- Report aggregate elapsed duration of CPU build and raster phases (build_ns + raster_ns), work period start timestamp, and total frame duration.
- Exclude MergedPlatformUIThread::kMergeAfterLaunch to avoid tracking stale UI thread after dynamic task queue migration.
- Manage reusable AWorkDuration instance synchronized under std::mutex with APerformanceHintSession.
- Fix target duration state caching to only update upon successful native PowerHAL return.
- Apply provisional 75% target frame-work ratio to leave scheduling slack while GPU duration is unmeasured.
- De-duplicate updateTargetWorkDuration calls to prevent redundant Binder IPC.
- Check NDK return codes, log warnings, and close session cleanly on EPIPE disconnects.
- Switch session creation log to FML_DLOG to avoid logcat pollution.
- Use explicit types instead of auto per Google C++ style and Flutter reviewer preference.
@gmackall gmackall added the CICD Run CI/CD label Sep 10, 2026
@github-actions github-actions Bot added platform-android Android applications specifically engine flutter/engine related. See also e: labels. team-android Owned by Android platform team labels Sep 10, 2026
@gmackall

Copy link
Copy Markdown
Member Author

very much a draft, just want to see if tests break

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD engine flutter/engine related. See also e: labels. platform-android Android applications specifically team-android Owned by Android platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant