diff options
| author | 2024-05-30 14:52:57 -0700 | |
|---|---|---|
| committer | 2024-05-30 14:52:57 -0700 | |
| commit | 1edfcbe729d622caec2a71e2d7515ebb8d094fb0 (patch) | |
| tree | 3fb889c01a02233937705032e17843d0ee3d0aac | |
| parent | 2e67cf72e902b109d256b7719336eb7725203b9f (diff) | |
[VRR] Use UXR values for velocity/frame rate calculation
Fixes: 343772301
In our UXR study, we found that for velocities greater than
1500dp/s, we need to use 120fps to get a premium experience.
Below that, 80fps is required for a premium experience.
Test: modified existing tests
Change-Id: I010d5a7113fe1651a04b9f3dad14ce77d87daf19
| -rw-r--r-- | core/java/android/view/View.java | 8 | ||||
| -rw-r--r-- | core/tests/coretests/src/android/view/ViewFrameRateTest.java | 6 |
2 files changed, 9 insertions, 5 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 1cb276568244..344edfa30af2 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -34061,10 +34061,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } private float convertVelocityToFrameRate(float velocityPps) { + // From UXR study, premium experience is: + // 1500+ dp/s: 120fps + // 0 - 1500 dp/s: 80fps + // OEMs are likely to modify this to balance battery and user experience for their + // specific device. float density = mAttachInfo.mDensity; float velocityDps = velocityPps / density; - // Choose a frame rate in increments of 10fps - return Math.min(MAX_FRAME_RATE, 60f + (10f * (float) Math.floor(velocityDps / 300f))); + return (velocityDps >= 1500f) ? MAX_FRAME_RATE : 80f; } /** diff --git a/core/tests/coretests/src/android/view/ViewFrameRateTest.java b/core/tests/coretests/src/android/view/ViewFrameRateTest.java index 07446e7617aa..abe9c8e337bb 100644 --- a/core/tests/coretests/src/android/view/ViewFrameRateTest.java +++ b/core/tests/coretests/src/android/view/ViewFrameRateTest.java @@ -164,7 +164,7 @@ public class ViewFrameRateTest { mActivityRule.runOnUiThread(() -> { mMovingView.setFrameContentVelocity(1f); mMovingView.invalidate(); - runAfterDraw(() -> assertEquals(60f, mViewRoot.getLastPreferredFrameRate(), 0f)); + runAfterDraw(() -> assertEquals(80f, mViewRoot.getLastPreferredFrameRate(), 0f)); }); waitForAfterDraw(); } @@ -190,7 +190,7 @@ public class ViewFrameRateTest { frameLayout.setFrameContentVelocity(1f); mMovingView.offsetTopAndBottom(100); frameLayout.invalidate(); - runAfterDraw(() -> assertEquals(60f, mViewRoot.getLastPreferredFrameRate(), 0f)); + runAfterDraw(() -> assertEquals(80f, mViewRoot.getLastPreferredFrameRate(), 0f)); }); waitForAfterDraw(); } @@ -435,7 +435,7 @@ public class ViewFrameRateTest { runAfterDraw(() -> { assertEquals(FRAME_RATE_CATEGORY_LOW, mViewRoot.getLastPreferredFrameRateCategory()); - assertEquals(60f, mViewRoot.getLastPreferredFrameRate()); + assertEquals(80f, mViewRoot.getLastPreferredFrameRate()); }); }); waitForAfterDraw(); |