From 28b34045f239590ea161e9a0471006dadad308ca Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Tue, 17 May 2022 01:03:02 +0800 Subject: [PATCH] Make sure updateSurface is called for rotation change The condition to call updateSurface requires relayout request. And keep the previous requested force-next-relayout to avoid the value set from performConfigurationChange being replaced, or before performing traversal, there is another resize event that erases the pending relayout request. Bug: 231282871 Test: Set allow home rotation. No flickering when rotating 180 degree. Change-Id: I0fd6701ebe0c17e0e319b1360d48132e0c256358 --- core/java/android/view/ViewRootImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index d846fb744a695..812441ea514b8 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -1772,7 +1772,7 @@ public final class ViewRootImpl implements ViewParent, } } - mForceNextWindowRelayout = forceNextWindowRelayout; + mForceNextWindowRelayout |= forceNextWindowRelayout; mPendingAlwaysConsumeSystemBars = args.argi2 != 0; mSyncSeqId = args.argi4 > mSyncSeqId ? args.argi4 : mSyncSeqId; @@ -5233,6 +5233,9 @@ public final class ViewRootImpl implements ViewParent, // the buffers may still have content in previous rotation. And the next draw may // not update all regions, that causes some afterimages to flicker. mUpdateSurfaceNeeded = true; + if (!mIsInTraversal) { + mForceNextWindowRelayout = true; + } } Configuration globalConfig = mergedConfiguration.getGlobalConfiguration();