summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/view/View.java8
-rw-r--r--core/tests/coretests/src/android/view/ViewFrameRateTest.java6
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();