Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2bd0afe0 authored by Rachel Lee's avatar Rachel Lee
Browse files

Add new HIGH_INTERACTIVE frame rate category

Bug: 315071842
Test: atest CtsSurfaceControlTestsStaging

Change-Id: Ia9bb1c03d3758f2e1bf023f20612eae96198ccef
parent e9a8ffd9
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -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.
@@ -307,12 +308,22 @@ 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().
+1 −0
Original line number Diff line number Diff line
@@ -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:
+6 −0
Original line number Diff line number Diff line
@@ -92,6 +92,12 @@ public class SurfaceControlTest {
        activity.testSurfaceControlFrameRateCategory(Surface.FRAME_RATE_CATEGORY_HIGH);
    }

    @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();