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

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

Merge "[VRR] Reapply frame rate and frame rate category when SurfaceControl is replaced." into main

parents 734ea56a 2e8e218e
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -1135,6 +1135,8 @@ public final class ViewRootImpl implements ViewParent,
    // Take 24 and 30 as an example, 24 is not a divisor of 30.
    // We consider there is a conflict.
    private boolean mIsFrameRateConflicted = false;
    // Used to check whether SurfaceControl has been replaced.
    private boolean mSurfaceReplaced = false;
    // Used to set frame rate compatibility.
    @Surface.FrameRateCompatibility int mFrameRateCompatibility =
            FRAME_RATE_COMPATIBILITY_FIXED_SOURCE;
@@ -3831,6 +3833,7 @@ public final class ViewRootImpl implements ViewParent,
                surfaceReplaced = (surfaceGenerationId != mSurface.getGenerationId()
                        || surfaceControlChanged) && mSurface.isValid();
                if (surfaceReplaced) {
                    mSurfaceReplaced = true;
                    mSurfaceSequenceId++;
                }
                if (alwaysConsumeSystemBarsChanged) {
@@ -4443,6 +4446,7 @@ public final class ViewRootImpl implements ViewParent,
            mPreferredFrameRate = -1;
            mIsFrameRateConflicted = false;
            mFrameRateCategoryChangeReason = FRAME_RATE_CATEGORY_REASON_UNKNOWN;
            mSurfaceReplaced = false;
        } else if (mPreferredFrameRate == 0) {
            // From MSG_FRAME_RATE_SETTING, where mPreferredFrameRate is set to 0
            setPreferredFrameRate(0);
@@ -12933,8 +12937,9 @@ public final class ViewRootImpl implements ViewParent,
        boolean traceFrameRateCategory = false;
        try {
            if (frameRateCategory != FRAME_RATE_CATEGORY_DEFAULT
                    && mLastPreferredFrameRateCategory != frameRateCategory) {
            if ((frameRateCategory != FRAME_RATE_CATEGORY_DEFAULT
                    && mLastPreferredFrameRateCategory != frameRateCategory)
                    || mSurfaceReplaced) {
                traceFrameRateCategory = Trace.isTagEnabled(Trace.TRACE_TAG_VIEW);
                if (traceFrameRateCategory) {
                    String reason = reasonToString(frameRateReason);
@@ -12998,7 +13003,7 @@ public final class ViewRootImpl implements ViewParent,
        boolean traceFrameRate = false;
        try {
            if (mLastPreferredFrameRate != preferredFrameRate) {
            if (mLastPreferredFrameRate != preferredFrameRate || mSurfaceReplaced) {
                traceFrameRate = Trace.isTagEnabled(Trace.TRACE_TAG_VIEW);
                if (traceFrameRate) {
                    Trace.traceBegin(
+2 −2
Original line number Diff line number Diff line
@@ -237,8 +237,8 @@ public class ViewFrameRateTest {
            return;
        }
        waitForFrameRateCategoryToSettle();
        assertEquals(FRAME_RATE_CATEGORY_LOW,
                        mViewRoot.getLastPreferredFrameRateCategory());
        assertTrue(mViewRoot.getLastPreferredFrameRateCategory()
                < FRAME_RATE_CATEGORY_HIGH_HINT);

        int width = mMovingView.getWidth();
        int height = mMovingView.getHeight();