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

Commit ba13527d authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[VRR] Step 3: infrequent updates should have category LOW" into main

parents 3c293ee2 a78641dc
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -33944,8 +33944,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    protected int calculateFrameRateCategory() {
        int category;
        switch (getViewRootImpl().intermittentUpdateState()) {
            case ViewRootImpl.INTERMITTENT_STATE_INTERMITTENT ->
                    category = FRAME_RATE_CATEGORY_NORMAL | FRAME_RATE_CATEGORY_REASON_INTERMITTENT;
            case ViewRootImpl.INTERMITTENT_STATE_INTERMITTENT -> category =
                    (sToolkitFrameRateBySizeReadOnlyFlagValue ? FRAME_RATE_CATEGORY_LOW
                            : FRAME_RATE_CATEGORY_NORMAL) | FRAME_RATE_CATEGORY_REASON_INTERMITTENT;
            case ViewRootImpl.INTERMITTENT_STATE_NOT_INTERMITTENT ->
                    category = mSizeBasedFrameRateCategoryAndReason;
            default -> category = mLastFrameRateCategory;
+6 −3
Original line number Diff line number Diff line
@@ -488,16 +488,19 @@ public class ViewFrameRateTest {
        waitForFrameRateCategoryToSettle();
        for (int i = 0; i < 5; i++) {
            int expectedCategory;
            if (i < 4) {
            if (i < 2) {
                // not intermittent yet.
                // It takes 2 frames of intermittency before Views vote as intermittent.
                // It takes 4 more frames for the category to drop to the next category.
                expectedCategory =
                        toolkitFrameRateDefaultNormalReadOnly() ? FRAME_RATE_CATEGORY_NORMAL
                                : FRAME_RATE_CATEGORY_HIGH;
            } else {
                // intermittent
                expectedCategory = FRAME_RATE_CATEGORY_NORMAL;
                // Even though this is not a small View, step 3 is triggered by this flag, which
                // brings intermittent to LOW
                expectedCategory = toolkitFrameRateBySizeReadOnly()
                        ? FRAME_RATE_CATEGORY_LOW
                        : FRAME_RATE_CATEGORY_NORMAL;
            }
            mActivityRule.runOnUiThread(() -> {
                mMovingView.invalidate();
+9 −2
Original line number Diff line number Diff line
@@ -1174,9 +1174,16 @@ public class ViewRootImplTest {

        // Infrequent update
        Thread.sleep(delay);

        // Even though this is not a small View, step 3 is triggered by this flag, which
        // brings intermittent to LOW
        int intermittentExpected = toolkitFrameRateBySizeReadOnly()
                ? FRAME_RATE_CATEGORY_LOW
                : FRAME_RATE_CATEGORY_NORMAL;

        sInstrumentation.runOnMainSync(() -> {
            mView.invalidate();
            runAfterDraw(() -> assertEquals(FRAME_RATE_CATEGORY_NORMAL,
            runAfterDraw(() -> assertEquals(intermittentExpected,
                    mViewRootImpl.getLastPreferredFrameRateCategory()));
        });
        waitForAfterDraw();
@@ -1184,7 +1191,7 @@ public class ViewRootImplTest {
        // When the View vote, it's still considered as intermittent update state
        sInstrumentation.runOnMainSync(() -> {
            mView.invalidate();
            runAfterDraw(() -> assertEquals(FRAME_RATE_CATEGORY_NORMAL,
            runAfterDraw(() -> assertEquals(intermittentExpected,
                    mViewRootImpl.getLastPreferredFrameRateCategory()));
        });
        waitForAfterDraw();