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

Commit 1edfcbe7 authored by George Mount's avatar George Mount
Browse files

[VRR] Use UXR values for velocity/frame rate calculation

Fixes: 343772301

In our UXR study, we found that for velocities greater than
1500dp/s, we need to use 120fps to get a premium experience.
Below that, 80fps is required for a premium experience.

Test: modified existing tests
Change-Id: I010d5a7113fe1651a04b9f3dad14ce77d87daf19
parent 2e67cf72
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -34061,10 +34061,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    }
    }
    private float convertVelocityToFrameRate(float velocityPps) {
    private float convertVelocityToFrameRate(float velocityPps) {
        // From UXR study, premium experience is:
        // 1500+    dp/s: 120fps
        // 0 - 1500 dp/s:  80fps
        // OEMs are likely to modify this to balance battery and user experience for their
        // specific device.
        float density = mAttachInfo.mDensity;
        float density = mAttachInfo.mDensity;
        float velocityDps = velocityPps / density;
        float velocityDps = velocityPps / density;
        // Choose a frame rate in increments of 10fps
        return (velocityDps >= 1500f) ? MAX_FRAME_RATE : 80f;
        return Math.min(MAX_FRAME_RATE, 60f + (10f * (float) Math.floor(velocityDps / 300f)));
    }
    }
    /**
    /**
+3 −3
Original line number Original line Diff line number Diff line
@@ -164,7 +164,7 @@ public class ViewFrameRateTest {
        mActivityRule.runOnUiThread(() -> {
        mActivityRule.runOnUiThread(() -> {
            mMovingView.setFrameContentVelocity(1f);
            mMovingView.setFrameContentVelocity(1f);
            mMovingView.invalidate();
            mMovingView.invalidate();
            runAfterDraw(() -> assertEquals(60f, mViewRoot.getLastPreferredFrameRate(), 0f));
            runAfterDraw(() -> assertEquals(80f, mViewRoot.getLastPreferredFrameRate(), 0f));
        });
        });
        waitForAfterDraw();
        waitForAfterDraw();
    }
    }
@@ -190,7 +190,7 @@ public class ViewFrameRateTest {
            frameLayout.setFrameContentVelocity(1f);
            frameLayout.setFrameContentVelocity(1f);
            mMovingView.offsetTopAndBottom(100);
            mMovingView.offsetTopAndBottom(100);
            frameLayout.invalidate();
            frameLayout.invalidate();
            runAfterDraw(() -> assertEquals(60f, mViewRoot.getLastPreferredFrameRate(), 0f));
            runAfterDraw(() -> assertEquals(80f, mViewRoot.getLastPreferredFrameRate(), 0f));
        });
        });
        waitForAfterDraw();
        waitForAfterDraw();
    }
    }
@@ -435,7 +435,7 @@ public class ViewFrameRateTest {
            runAfterDraw(() -> {
            runAfterDraw(() -> {
                assertEquals(FRAME_RATE_CATEGORY_LOW,
                assertEquals(FRAME_RATE_CATEGORY_LOW,
                        mViewRoot.getLastPreferredFrameRateCategory());
                        mViewRoot.getLastPreferredFrameRateCategory());
                assertEquals(60f, mViewRoot.getLastPreferredFrameRate());
                assertEquals(80f, mViewRoot.getLastPreferredFrameRate());
            });
            });
        });
        });
        waitForAfterDraw();
        waitForAfterDraw();