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

Commit ea5a1ef4 authored by Shane's avatar Shane
Browse files

[VRR] Disable frame rate boosting with content velocity

As requested, we want to avoid boosting when users start scrolling such
as what we did for touch boost.
In this CL, we also make the value of mIsFrameRateBoosting to false
when content velocity is detected.

Also, add a new variable FRAME_RATE_BOOST_TIME for the frame rate boost
use case other than touh boost

Fixes: 343503604
Test: atest ViewFrameRateTest, atest ViewRootImplTest
Change-Id: I8e53cb365740563030a61bf6c1f459c231a2d84f
parent 88e629d6
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1110,6 +1110,8 @@ public final class ViewRootImpl implements ViewParent,
            FRAME_RATE_COMPATIBILITY_FIXED_SOURCE;
    // time for touch boost period.
    private static final int FRAME_RATE_TOUCH_BOOST_TIME = 3000;
    // Timeout for the other frame rate boosts other than touch boost.
    private static final int FRAME_RATE_BOOST_TIME = 3000;
    // time for evaluating the interval between current time and
    // the time when frame rate was set previously.
    private static final int FRAME_RATE_SETTING_REEVALUATE_TIME = 100;
@@ -3414,7 +3416,7 @@ public final class ViewRootImpl implements ViewParent,
            if (shouldEnableDvrr() && viewVisibility == View.VISIBLE) {
                // Boost frame rate when the viewVisibility becomes true.
                // This is mainly for lanuchers that lanuch new windows.
                boostFrameRate(FRAME_RATE_TOUCH_BOOST_TIME);
                boostFrameRate(FRAME_RATE_BOOST_TIME);
            }
        }
@@ -4146,7 +4148,7 @@ public final class ViewRootImpl implements ViewParent,
            if (shouldEnableDvrr()) {
                // Boost the frame rate when the ViewRootImpl first becomes available.
                boostFrameRate(FRAME_RATE_TOUCH_BOOST_TIME);
                boostFrameRate(FRAME_RATE_BOOST_TIME);
            }
        }
@@ -12912,6 +12914,7 @@ public final class ViewRootImpl implements ViewParent,
        }
        if (frameRateCompatibility == FRAME_RATE_COMPATIBILITY_GTE) {
            mIsTouchBoosting = false;
            mIsFrameRateBoosting = false;
            if (!sToolkitFrameRateVelocityMappingReadOnlyFlagValue) {
                mPreferredFrameRateCategory = FRAME_RATE_CATEGORY_HIGH;
                mFrameRateCategoryHighCount = FRAME_RATE_CATEGORY_COUNT;
+2 −1
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ public class ViewFrameRateTest {

    @Test
    @RequiresFlagsEnabled(FLAG_VIEW_VELOCITY_API)
    public void touchBoostDisable() throws Throwable {
    public void frameBoostDisable() throws Throwable {
        mActivityRule.runOnUiThread(() -> {
            long now = SystemClock.uptimeMillis();
            MotionEvent down = MotionEvent.obtain(
@@ -146,6 +146,7 @@ public class ViewFrameRateTest {

        mActivityRule.runOnUiThread(() -> {
            assertFalse(mViewRoot.getIsTouchBoosting());
            assertFalse(mViewRoot.getIsFrameRateBoosting());
        });
    }