Merge "ViewRootImpl: Fix issue with early draw report in seamless rotation" into sc-dev am: 5f28230d34

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15235723

Change-Id: I49ddbea622e2ff431d86716bf29384e8b8ac09db
This commit is contained in:
Rob Carr
2021-07-09 02:55:26 +00:00
committed by Automerger Merge Worker

View File

@@ -2793,6 +2793,7 @@ public final class ViewRootImpl implements ViewParent,
mView.onSystemBarAppearanceChanged(mDispatchedSystemBarAppearance); mView.onSystemBarAppearanceChanged(mDispatchedSystemBarAppearance);
} }
} }
final boolean wasReportNextDraw = mReportNextDraw;
if (mFirst || windowShouldResize || viewVisibilityChanged || params != null if (mFirst || windowShouldResize || viewVisibilityChanged || params != null
|| mForceNextWindowRelayout) { || mForceNextWindowRelayout) {
@@ -2839,6 +2840,16 @@ public final class ViewRootImpl implements ViewParent,
final boolean dockedResizing = (relayoutResult final boolean dockedResizing = (relayoutResult
& WindowManagerGlobal.RELAYOUT_RES_DRAG_RESIZING_DOCKED) != 0; & WindowManagerGlobal.RELAYOUT_RES_DRAG_RESIZING_DOCKED) != 0;
final boolean dragResizing = freeformResizing || dockedResizing; final boolean dragResizing = freeformResizing || dockedResizing;
if ((relayoutResult & WindowManagerGlobal.RELAYOUT_RES_BLAST_SYNC) != 0) {
if (DEBUG_BLAST) {
Log.d(mTag, "Relayout called with blastSync");
}
reportNextDraw();
if (isHardwareEnabled()) {
mNextDrawUseBlastSync = true;
}
}
if (mSurfaceControl.isValid()) { if (mSurfaceControl.isValid()) {
updateOpacity(mWindowAttributes, dragResizing); updateOpacity(mWindowAttributes, dragResizing);
} }
@@ -3057,7 +3068,16 @@ public final class ViewRootImpl implements ViewParent,
} }
} }
if (!mStopped || mReportNextDraw) { // TODO: In the CL "ViewRootImpl: Fix issue with early draw report in
// seamless rotation". We moved processing of RELAYOUT_RES_BLAST_SYNC
// earlier in the function, potentially triggering a call to
// reportNextDraw(). That same CL changed this and the next reference
// to wasReportNextDraw, such that this logic would remain undisturbed
// (it continues to operate as if the code was never moved). This was
// done to achieve a more hermetic fix for S, but it's entirely
// possible that checking the most recent value is actually more
// correct here.
if (!mStopped || wasReportNextDraw) {
boolean focusChangedDueToTouchMode = ensureTouchModeLocally( boolean focusChangedDueToTouchMode = ensureTouchModeLocally(
(relayoutResult&WindowManagerGlobal.RELAYOUT_RES_IN_TOUCH_MODE) != 0); (relayoutResult&WindowManagerGlobal.RELAYOUT_RES_IN_TOUCH_MODE) != 0);
if (focusChangedDueToTouchMode || mWidth != host.getMeasuredWidth() if (focusChangedDueToTouchMode || mWidth != host.getMeasuredWidth()
@@ -3127,7 +3147,7 @@ public final class ViewRootImpl implements ViewParent,
prepareSurfaces(); prepareSurfaces();
} }
final boolean didLayout = layoutRequested && (!mStopped || mReportNextDraw); final boolean didLayout = layoutRequested && (!mStopped || wasReportNextDraw);
boolean triggerGlobalLayoutListener = didLayout boolean triggerGlobalLayoutListener = didLayout
|| mAttachInfo.mRecomputeGlobalAttributes; || mAttachInfo.mRecomputeGlobalAttributes;
if (didLayout) { if (didLayout) {
@@ -3283,21 +3303,10 @@ public final class ViewRootImpl implements ViewParent,
mImeFocusController.onTraversal(hasWindowFocus, mWindowAttributes); mImeFocusController.onTraversal(hasWindowFocus, mWindowAttributes);
final boolean wasReportNextDraw = mReportNextDraw;
// Remember if we must report the next draw. // Remember if we must report the next draw.
if ((relayoutResult & WindowManagerGlobal.RELAYOUT_RES_FIRST_TIME) != 0) { if ((relayoutResult & WindowManagerGlobal.RELAYOUT_RES_FIRST_TIME) != 0) {
reportNextDraw(); reportNextDraw();
} }
if ((relayoutResult & WindowManagerGlobal.RELAYOUT_RES_BLAST_SYNC) != 0) {
if (DEBUG_BLAST) {
Log.d(mTag, "Relayout called with blastSync");
}
reportNextDraw();
if (isHardwareEnabled()) {
mNextDrawUseBlastSync = true;
}
}
boolean cancelDraw = mAttachInfo.mTreeObserver.dispatchOnPreDraw() || !isViewVisible; boolean cancelDraw = mAttachInfo.mTreeObserver.dispatchOnPreDraw() || !isViewVisible;
@@ -3308,7 +3317,6 @@ public final class ViewRootImpl implements ViewParent,
} }
mPendingTransitions.clear(); mPendingTransitions.clear();
} }
performDraw(); performDraw();
} else { } else {
if (isViewVisible) { if (isViewVisible) {