summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Rachel Lee <rnlee@google.com> 2023-12-26 17:34:44 -0800
committer Rachel Lee <rnlee@google.com> 2024-01-02 15:40:20 -0800
commit2bd0afe0f0cee475ecc79a49528c6802a84df4ee (patch)
treedcfee0d0f88425058626a964c9f684e48e6ab16f
parente9a8ffd9232963e6719faf3e020d1507bd3fe197 (diff)
Add new HIGH_INTERACTIVE frame rate category
Bug: 315071842 Test: atest CtsSurfaceControlTestsStaging Change-Id: Ia9bb1c03d3758f2e1bf023f20612eae96198ccef
-rw-r--r--core/java/android/view/Surface.java15
-rw-r--r--tests/CtsSurfaceControlTestsStaging/src/main/java/android/view/surfacecontroltests/GraphicsActivity.java1
-rw-r--r--tests/CtsSurfaceControlTestsStaging/src/main/java/android/view/surfacecontroltests/SurfaceControlTest.java6
3 files changed, 20 insertions, 2 deletions
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java
index ad0bf7c95c70..785055441d59 100644
--- a/core/java/android/view/Surface.java
+++ b/core/java/android/view/Surface.java
@@ -274,7 +274,8 @@ public class Surface implements Parcelable {
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = {"FRAME_RATE_CATEGORY_"},
value = {FRAME_RATE_CATEGORY_DEFAULT, FRAME_RATE_CATEGORY_NO_PREFERENCE,
- FRAME_RATE_CATEGORY_LOW, FRAME_RATE_CATEGORY_NORMAL, FRAME_RATE_CATEGORY_HIGH})
+ FRAME_RATE_CATEGORY_LOW, FRAME_RATE_CATEGORY_NORMAL,
+ FRAME_RATE_CATEGORY_HIGH_HINT, FRAME_RATE_CATEGORY_HIGH})
public @interface FrameRateCategory {}
// From native_window.h or window.h. Keep these in sync.
@@ -308,11 +309,21 @@ public class Surface implements Parcelable {
public static final int FRAME_RATE_CATEGORY_NORMAL = 3;
/**
+ * Hints that, as a result of a user interaction, an animation is likely to start.
+ * This category is a signal that a user interaction heuristic determined the need of a
+ * high refresh rate, and is not an explicit request from the app.
+ * As opposed to {@link #FRAME_RATE_CATEGORY_HIGH}, this vote may be ignored in favor of
+ * more explicit votes.
+ * @hide
+ */
+ public static final int FRAME_RATE_CATEGORY_HIGH_HINT = 4;
+
+ /**
* Indicates a frame rate suitable for animations that require a high frame rate, which may
* increase smoothness but may also increase power usage.
* @hide
*/
- public static final int FRAME_RATE_CATEGORY_HIGH = 4;
+ public static final int FRAME_RATE_CATEGORY_HIGH = 5;
/**
* Create an empty surface, which will later be filled in by readFromParcel().
diff --git a/tests/CtsSurfaceControlTestsStaging/src/main/java/android/view/surfacecontroltests/GraphicsActivity.java b/tests/CtsSurfaceControlTestsStaging/src/main/java/android/view/surfacecontroltests/GraphicsActivity.java
index 60b5ce75e2f7..80c1e5be3a32 100644
--- a/tests/CtsSurfaceControlTestsStaging/src/main/java/android/view/surfacecontroltests/GraphicsActivity.java
+++ b/tests/CtsSurfaceControlTestsStaging/src/main/java/android/view/surfacecontroltests/GraphicsActivity.java
@@ -810,6 +810,7 @@ public class GraphicsActivity extends Activity {
private FpsRange convertCategory(int category) {
switch (category) {
+ case Surface.FRAME_RATE_CATEGORY_HIGH_HINT:
case Surface.FRAME_RATE_CATEGORY_HIGH:
return FRAME_RATE_CATEGORY_HIGH;
case Surface.FRAME_RATE_CATEGORY_NORMAL:
diff --git a/tests/CtsSurfaceControlTestsStaging/src/main/java/android/view/surfacecontroltests/SurfaceControlTest.java b/tests/CtsSurfaceControlTestsStaging/src/main/java/android/view/surfacecontroltests/SurfaceControlTest.java
index 4b56c107cf22..caaee634c57a 100644
--- a/tests/CtsSurfaceControlTestsStaging/src/main/java/android/view/surfacecontroltests/SurfaceControlTest.java
+++ b/tests/CtsSurfaceControlTestsStaging/src/main/java/android/view/surfacecontroltests/SurfaceControlTest.java
@@ -93,6 +93,12 @@ public class SurfaceControlTest {
}
@Test
+ public void testSurfaceControlFrameRateCategoryHighHint() throws InterruptedException {
+ GraphicsActivity activity = mActivityRule.getActivity();
+ activity.testSurfaceControlFrameRateCategory(Surface.FRAME_RATE_CATEGORY_HIGH_HINT);
+ }
+
+ @Test
public void testSurfaceControlFrameRateCategoryNormal() throws InterruptedException {
GraphicsActivity activity = mActivityRule.getActivity();
activity.testSurfaceControlFrameRateCategory(Surface.FRAME_RATE_CATEGORY_NORMAL);