Loading core/java/android/view/ViewRootImpl.java +8 −3 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -3831,6 +3833,7 @@ public final class ViewRootImpl implements ViewParent, surfaceReplaced = (surfaceGenerationId != mSurface.getGenerationId() || surfaceControlChanged) && mSurface.isValid(); if (surfaceReplaced) { mSurfaceReplaced = true; mSurfaceSequenceId++; } if (alwaysConsumeSystemBarsChanged) { Loading Loading @@ -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); Loading Loading @@ -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); Loading Loading @@ -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( core/tests/coretests/src/android/view/ViewFrameRateTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -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(); Loading Loading
core/java/android/view/ViewRootImpl.java +8 −3 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -3831,6 +3833,7 @@ public final class ViewRootImpl implements ViewParent, surfaceReplaced = (surfaceGenerationId != mSurface.getGenerationId() || surfaceControlChanged) && mSurface.isValid(); if (surfaceReplaced) { mSurfaceReplaced = true; mSurfaceSequenceId++; } if (alwaysConsumeSystemBarsChanged) { Loading Loading @@ -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); Loading Loading @@ -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); Loading Loading @@ -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(
core/tests/coretests/src/android/view/ViewFrameRateTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -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(); Loading