[null,null,["最后更新时间 (UTC):2025-03-25。"],[],[],null,["# Adaptive refresh rate\n\nStarting in Android 15, the adaptive refresh rate (ARR) feature enables the\ndisplay refresh rate to adapt to the content frame rate, using discrete VSync\nsteps.\n\nThe ARR feature offers the following benefits:\n\n- Reducing power consumption: By default, ARR enables devices to operate at\n rates lower than their maximum refresh rates, transitioning to higher rates\n only when essential for the user experience, which minimizes unnecessary\n power consumption.\n\n- Reducing jank: ARR eliminates the need for mode switching, which is a known\n cause for jank.\n\nOverview\n--------\n\nOn non-ARR panels, the display refreshes at a fixed cadence determined by the\nactive display mode.\n\nOn ARR panels, the display VSync rate and refresh rate are decoupled, allowing\nrefresh rates to change within one display mode, based on content update\ncadence. The panels can run at refresh rates that are divisors of the panel's\ntearing effect (TE). OEMs have the flexibility to implement ARR based on their\npreferred power trade-offs.\n\nThe following figure is a display with `vsyncPeriod` of 240 Hz and\n`minFrameIntervalNs` (maximum refresh rate) of 120 Hz. VSync occurs every\n4.16 ms. A frame can be presented at any multiples of VSync after the\n`minFrameIntervalNs` from the last frame.\n\n**Figure 1.** Example of ARR.\n\nImplementation\n--------------\n\nAndroid 15 supports ARR with new Hardware Composer (HWC) HAL APIs and platform\nchanges. To enable ARR, OEMs must support kernel and system changes on\ndevices running Android 15 and later, and implement version 3 of the\n[`android.hardware.graphics.composer3`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/graphics/composer/aidl/android/hardware/graphics/composer3/)\nAPIs, as listed in the following sections.\n\nSee [Pixel's reference implementation](https://cs.android.com/android/platform/superproject/main/+/main:hardware/google/graphics/common/hwc3/)\nof the APIs that support ARR for more information.\n| **Note:** The AOSP source code mentions `vrr` in relation to ARR elements.\n\n### DisplayConfiguration.aidl\n\nThe\n[`DisplayConfiguration.aidl`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayConfiguration.aidl)\nAPI specifies the display configuration using display attributes, along with the\nfollowing attributes for ARR:\n\n- Optional [`vrrConfig`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayConfiguration.aidl;l=69): If set, ARR is enabled for specific configurations. If set to `null`, the display mode is set to non-ARR modes such as [multiple refresh rate\n (MRR)](/docs/core/graphics/multiple-refresh-rate). With this attribute, a display can be configured as either MRR or ARR, but not both.\n- [`vsyncPeriod`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayConfiguration.aidl;l=63):\n The VSync rate of the display. On ARR displays, this value is used to derive\n the supported discrete refresh rates.\n\n Vendors must set the `DisplayConfiguration.vsyncPeriod` value for all\n devices. For non-ARR displays, `DisplayConfiguration.vsyncPeriod` is the\n display refresh rate. If a device supports 120 Hz, then this value must\n be 8.3 ms.\n\n For ARR displays, `DisplayConfiguration.vsyncPeriod` is the TE signal\n frequency. If a device has a `minFrameIntervalNs` of 8.3 ms but the TE\n is\n 240 Hz, this value must be 4.16 ms.\n\n### VrrConfig.aidl\n\nThe\n[`VrrConfig.aidl`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/graphics/composer/aidl/android/hardware/graphics/composer3/VrrConfig.aidl;l=20)\nAPI includes the following attributes:\n\n- [`minFrameIntervalNs`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/graphics/composer/aidl/android/hardware/graphics/composer3/VrrConfig.aidl;l=25): The max refresh rate the display can support.\n- [`NotifyExpectedPresentConfig`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/graphics/composer/aidl/android/hardware/graphics/composer3/VrrConfig.aidl;l=43): This is determined by when the display requires advance notice of an upcoming frame.\n\n[`IComposerClient.notifyExpectedPresent`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl;l=914)\nprovides a hint for a frame that is likely to be presented, so that the display\ncan adapt its self-refresh period accordingly. `frameIntervalNs` represents the\npresent cadence that follows after the `expectedPresentTime`. For example, if\n`notifyExpectedPresent` is called with `expectedPresentTime` N and\n`frameIntervalNs` of 16.6 ms, then the next frame is at N + 16.6 ms\nafter the present time N. After the present time N, the frame cadence is\n16.6 ms until there are further changes.\n\n`IComposerClient.notifyExpectedPresent` is called only when\n`DisplayConfiguration.notifyExpectedPresentConfig` is set, and if one of the\nfollowing timing conditions occurs:\n\n- Out-of-cadence present time: The expected presentation time of the next frame deviates from the display's regular refresh rate defined by `frameIntervalNs`.\n- Timeout exceeded: The time interval between the previous frames is greater than or equal to `notifyExpectedPresentConfig.timeoutNs`.\n\n### DisplayCommand.frameIntervalNs\n\n[`DisplayCommand.frameIntervalNs`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl;l=178)\nprovides a hint about the cadence for the upcoming frames in nanoseconds.\n\nTesting\n-------\n\nUse\n[`onRefreshRateChangedDebug`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerCallback.aidl;l=122)\nfor debugging. This method notifies the client that the refresh rate of the\ndisplay has changed.\n\nUse the\n[`TouchLatency`](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/tests/TouchLatency)\ntest app for manual testing as shown in Figure 2:\n\n**Figure 2.** TouchLatency test app.\n\nIn the test app, use the slider to adjust the render rate to various values of\ndivisor refresh rates of your display's refresh rate. Observe how the frame rate\nchanges with respect to the rate requested."]]