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

Commit 8071c782 authored by Jian-Syuan (Shane) Wong's avatar Jian-Syuan (Shane) Wong Committed by Android (Google) Code Review
Browse files

Merge "Revert "Apply HIGH_HINT to hint refresh rate boost by user interactions"" into main

parents 97d24320 de6e849f
Loading
Loading
Loading
Loading
+5 −17
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ import static android.view.Display.INVALID_DISPLAY;
import static android.view.InputDevice.SOURCE_CLASS_NONE;
import static android.view.InsetsSource.ID_IME;
import static android.view.Surface.FRAME_RATE_CATEGORY_HIGH;
import static android.view.Surface.FRAME_RATE_CATEGORY_HIGH_HINT;
import static android.view.Surface.FRAME_RATE_CATEGORY_NO_PREFERENCE;
import static android.view.View.PFLAG_DRAW_ANIMATION;
import static android.view.View.SYSTEM_UI_FLAG_FULLSCREEN;
@@ -1012,10 +1011,8 @@ public final class ViewRootImpl implements ViewParent,
    // Used to check if there were any view invalidations in
    // the previous time frame (FRAME_RATE_IDLENESS_REEVALUATE_TIME).
    private boolean mHasInvalidation = false;
    // Used to check if it is in the frame rate boosting period.
    // Used to check if it is in the touch boosting period.
    private boolean mIsFrameRateBoosting = false;
    // Used to check if it is in touch boosting period.
    private boolean mIsTouchBoosting = false;
    // Used to check if there is a message in the message queue
    // for idleness handling.
    private boolean mHasIdledMessage = false;
@@ -6424,12 +6421,11 @@ public final class ViewRootImpl implements ViewParent,
                     * Lower the frame rate after the boosting period (FRAME_RATE_TOUCH_BOOST_TIME).
                     */
                    mIsFrameRateBoosting = false;
                    mIsTouchBoosting = false;
                    setPreferredFrameRateCategory(Math.max(mPreferredFrameRateCategory,
                            mLastPreferredFrameRateCategory));
                    break;
                case MSG_CHECK_INVALIDATION_IDLE:
                    if (!mHasInvalidation && !mIsFrameRateBoosting && !mIsTouchBoosting) {
                    if (!mHasInvalidation && !mIsFrameRateBoosting) {
                        mPreferredFrameRateCategory = FRAME_RATE_CATEGORY_NO_PREFERENCE;
                        setPreferredFrameRateCategory(mPreferredFrameRateCategory);
                        mHasIdledMessage = false;
@@ -7452,7 +7448,7 @@ public final class ViewRootImpl implements ViewParent,
            // For the variable refresh rate project
            if (handled && shouldTouchBoost(action, mWindowAttributes.type)) {
                // set the frame rate to the maximum value.
                mIsTouchBoosting = true;
                mIsFrameRateBoosting = true;
                setPreferredFrameRateCategory(mPreferredFrameRateCategory);
            }
            /**
@@ -12204,16 +12200,8 @@ public final class ViewRootImpl implements ViewParent,
            return;
        }
        int frameRateCategory = mIsTouchBoosting
                ? FRAME_RATE_CATEGORY_HIGH_HINT : preferredFrameRateCategory;
        // FRAME_RATE_CATEGORY_HIGH has a higher precedence than FRAME_RATE_CATEGORY_HIGH_HINT
        // For now, FRAME_RATE_CATEGORY_HIGH_HINT is used for boosting with user interaction.
        // FRAME_RATE_CATEGORY_HIGH is for boosting without user interaction
        // (e.g., Window Initialization).
        if (mIsFrameRateBoosting || mInsetsAnimationRunning) {
            frameRateCategory = FRAME_RATE_CATEGORY_HIGH;
        }
        int frameRateCategory = mIsFrameRateBoosting || mInsetsAnimationRunning
                ? FRAME_RATE_CATEGORY_HIGH : preferredFrameRateCategory;
        try {
            if (mLastPreferredFrameRateCategory != frameRateCategory) {
+0 −6
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package android.view;
import static android.view.accessibility.Flags.FLAG_FORCE_INVERT_COLOR;
import static android.view.flags.Flags.FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY;
import static android.view.Surface.FRAME_RATE_CATEGORY_HIGH;
import static android.view.Surface.FRAME_RATE_CATEGORY_HIGH_HINT;
import static android.view.Surface.FRAME_RATE_CATEGORY_LOW;
import static android.view.Surface.FRAME_RATE_CATEGORY_NORMAL;
import static android.view.Surface.FRAME_RATE_CATEGORY_NO_PREFERENCE;
@@ -576,13 +575,8 @@ public class ViewRootImplTest {
            assertEquals(viewRootImpl.getPreferredFrameRateCategory(), FRAME_RATE_CATEGORY_LOW);
            viewRootImpl.votePreferredFrameRateCategory(FRAME_RATE_CATEGORY_NORMAL);
            assertEquals(viewRootImpl.getPreferredFrameRateCategory(), FRAME_RATE_CATEGORY_NORMAL);
            viewRootImpl.votePreferredFrameRateCategory(FRAME_RATE_CATEGORY_HIGH_HINT);
            assertEquals(viewRootImpl.getPreferredFrameRateCategory(),
                    FRAME_RATE_CATEGORY_HIGH_HINT);
            viewRootImpl.votePreferredFrameRateCategory(FRAME_RATE_CATEGORY_HIGH);
            assertEquals(viewRootImpl.getPreferredFrameRateCategory(), FRAME_RATE_CATEGORY_HIGH);
            viewRootImpl.votePreferredFrameRateCategory(FRAME_RATE_CATEGORY_HIGH_HINT);
            assertEquals(viewRootImpl.getPreferredFrameRateCategory(), FRAME_RATE_CATEGORY_HIGH);
            viewRootImpl.votePreferredFrameRateCategory(FRAME_RATE_CATEGORY_NORMAL);
            assertEquals(viewRootImpl.getPreferredFrameRateCategory(), FRAME_RATE_CATEGORY_HIGH);
            viewRootImpl.votePreferredFrameRateCategory(FRAME_RATE_CATEGORY_LOW);