Skip to content

[RFC] Android Dynamic Performance Framework (ADPF) Integration for Flutter #195992

Open

Description

@gmackall

RFC Pull Request Link

flutter/rfc#45

What problem are you solving?

By default on Android, CPU frequency scaling only knows how busy a thread has been recently. It does not know when our frame deadline is or that Flutter splits rendering across a UI thread and a raster thread. When an app wakes up from idle (e.g. after a user reads a screen or a network call finishes), hits a heavy frame during a scroll, or continues scrolling after the user lifts their finger (once the OS touch boost ends), CPU clocks often ramp up too late and we miss frames.

This RFC proposes integrating Android's ADPF (APerformanceHintManager) NDK API on Android 15+ (API 35+) using two APerformanceHintSession instances (one for the UI thread and one for the raster thread) to report per-frame build and raster work durations (APerformanceHint_reportActualWorkDuration2) and post-idle workload resets (APerformanceHint_notifyWorkloadReset on Android 16+ / API 36+).

Related issue: #114835

Activity

  1. added
    design doc
    team-android
    fyi-engine
    on Nov 4, 2026
  2. added
    📜
    on Nov 4, 2026
  3. added
    P2
    on Nov 9, 2026
  4. self-assigned this
    on Nov 9, 2026
  5. removed
    fyi-engine
    on Nov 9, 2026
  6. gaaclarke commented on Nov 10, 2026

    @gaaclarke
    Member

    This sounds interesting, but considering the tiny surface area where it actually makes a difference, I have a hard time considering it a priority. You need to have a very modern version of the operating system and not all hardware venders support it.

  7. removed their assignment
    on Nov 10, 2026
  8. added
    triaged-android
    on Nov 10, 2026
  9. gmackall commented on Nov 10, 2026

    @gmackall
    MemberAuthor

    This sounds interesting, but considering the tiny surface area where it actually makes a difference, I have a hard time considering it a priority. You need to have a very modern version of the operating system and not all hardware venders support it.

    Hmm I agree the surface area is somewhat small - I think OEM gating is the main issue, api 15+ has ~60% cumulative adoption. But I've tested more since writing the rfc and found vivo and motorola phones also support it.

    Discounting for api 15+, and for only the chipsets inside OEMs that do support, it seems like roughly (napkin math based on market share) 10% of all android devices currently would benefit? That's somewhat small, but it's still quite a lot of devices, and

    1. it's a pretty small effort to implement, mostly plumbing/api gating because we already record the relevant metrics (probably sub 300 non-test loc, which again is mostly plumbing/api gating).
    2. it's a pretty large impact on that ~10% (20-40% reduction in build/raster times, and focused on the cases that would have janked)

    Given that I still personally feel it's worth adopting?

    Also to be clear the android team would do this work, the main thing I'd want sign off on is the callback addition:
    4c15b12...gmackall:flutter:adpf-pr1-frame-built-callback

  10. gaaclarke commented on Nov 11, 2026

    @gaaclarke
    Member

    Given that I still personally feel it's worth adopting?

    I'm thinking more in terms of opportunity cost. We can spend time implementing and supporting something that benefits 10% of users, but what did we sacrifice with that time? When things only affect a subset of devices the maintenance cost is higher too. Those are my concerns.

  11. samfadigital-stack commented on Nov 15, 2026

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    📜P2design docteam-androidtriaged-android

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions