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
This commit is contained in:
Riddle Hsu
2022-05-17 01:03:02 +08:00
parent 6cfafc4b2b
commit 28b34045f2

View File

@@ -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();