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

This commit is contained in:
Rob Carr
2021-07-09 02:28:27 +00:00
committed by Android (Google) Code Review

View File

@@ -2778,6 +2778,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) {
@@ -2824,6 +2825,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);
} }
@@ -3042,7 +3053,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()
@@ -3112,7 +3132,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) {
@@ -3268,21 +3288,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;
@@ -3293,7 +3302,6 @@ public final class ViewRootImpl implements ViewParent,
} }
mPendingTransitions.clear(); mPendingTransitions.clear();
} }
performDraw(); performDraw();
} else { } else {
if (isViewVisible) { if (isViewVisible) {