Loading services/core/java/com/android/server/wm/Task.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -4515,6 +4515,7 @@ class Task extends WindowContainer<WindowContainer> { */ */ void setMainWindowSizeChangeTransaction(SurfaceControl.Transaction t) { void setMainWindowSizeChangeTransaction(SurfaceControl.Transaction t) { setMainWindowSizeChangeTransaction(t, this); setMainWindowSizeChangeTransaction(t, this); forAllWindows(WindowState::requestRedrawForSync, true); } } private void setMainWindowSizeChangeTransaction(SurfaceControl.Transaction t, Task origin) { private void setMainWindowSizeChangeTransaction(SurfaceControl.Transaction t, Task origin) { Loading services/core/java/com/android/server/wm/WindowState.java +22 −8 Original line number Original line Diff line number Diff line Loading @@ -339,7 +339,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP private boolean mDragResizing; private boolean mDragResizing; private boolean mDragResizingChangeReported = true; private boolean mDragResizingChangeReported = true; private int mResizeMode; private int mResizeMode; private boolean mResizeForBlastSyncReported; private boolean mRedrawForSyncReported; /** /** * Special mode that is intended only for the rounded corner overlay: during rotation * Special mode that is intended only for the rounded corner overlay: during rotation Loading Loading @@ -1402,7 +1402,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP || configChanged || configChanged || dragResizingChanged || dragResizingChanged || mReportOrientationChanged || mReportOrientationChanged || requestResizeForBlastSync()) { || shouldSendRedrawForSync()) { ProtoLog.v(WM_DEBUG_RESIZE, ProtoLog.v(WM_DEBUG_RESIZE, "Resize reasons for w=%s: %s surfaceResized=%b configChanged=%b " "Resize reasons for w=%s: %s surfaceResized=%b configChanged=%b " + "dragResizingChanged=%b reportOrientationChanged=%b", + "dragResizingChanged=%b reportOrientationChanged=%b", Loading Loading @@ -3564,7 +3564,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP mReportOrientationChanged = false; mReportOrientationChanged = false; mDragResizingChangeReported = true; mDragResizingChangeReported = true; mWinAnimator.mSurfaceResized = false; mWinAnimator.mSurfaceResized = false; mResizeForBlastSyncReported = true; mWindowFrames.resetInsetsChanged(); mWindowFrames.resetInsetsChanged(); final Rect frame = mWindowFrames.mCompatFrame; final Rect frame = mWindowFrames.mCompatFrame; Loading @@ -3572,11 +3571,13 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP final Rect visibleInsets = mWindowFrames.mLastVisibleInsets; final Rect visibleInsets = mWindowFrames.mLastVisibleInsets; final Rect stableInsets = mWindowFrames.mLastStableInsets; final Rect stableInsets = mWindowFrames.mLastStableInsets; final MergedConfiguration mergedConfiguration = mLastReportedConfiguration; final MergedConfiguration mergedConfiguration = mLastReportedConfiguration; final boolean reportDraw = mWinAnimator.mDrawState == DRAW_PENDING || useBLASTSync(); final boolean reportDraw = mWinAnimator.mDrawState == DRAW_PENDING || useBLASTSync() || !mRedrawForSyncReported; final boolean forceRelayout = reportOrientation || isDragResizeChanged(); final boolean forceRelayout = reportOrientation || isDragResizeChanged() || !mRedrawForSyncReported; final int displayId = getDisplayId(); final int displayId = getDisplayId(); final DisplayCutout displayCutout = getWmDisplayCutout().getDisplayCutout(); final DisplayCutout displayCutout = getWmDisplayCutout().getDisplayCutout(); mRedrawForSyncReported = true; try { try { mClient.resized(frame, contentInsets, visibleInsets, stableInsets, reportDraw, mClient.resized(frame, contentInsets, visibleInsets, stableInsets, reportDraw, mergedConfiguration, getBackdropFrame(frame), forceRelayout, mergedConfiguration, getBackdropFrame(frame), forceRelayout, Loading Loading @@ -5823,7 +5824,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP if (!willSync) { if (!willSync) { return false; return false; } } mResizeForBlastSyncReported = false; requestRedrawForSync(); mLocalSyncId = mBLASTSyncEngine.startSyncSet(this); mLocalSyncId = mBLASTSyncEngine.startSyncSet(this); addChildrenToSyncSet(mLocalSyncId); addChildrenToSyncSet(mLocalSyncId); Loading Loading @@ -5884,7 +5885,20 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP notifyBlastSyncTransaction(); notifyBlastSyncTransaction(); } } private boolean requestResizeForBlastSync() { /** return useBLASTSync() && !mResizeForBlastSyncReported; * When using the two WindowOrganizer sync-primitives (BoundsChangeTransaction, BLASTSync) * it can be a little difficult to predict whether your change will actually trigger redrawing * on the client side. To ease the burden on shell developers, we force send MSG_RESIZED * for Windows involved in these Syncs */ private boolean shouldSendRedrawForSync() { final Task task = getTask(); if (task != null && task.getMainWindowSizeChangeTransaction() != null) return !mRedrawForSyncReported; return useBLASTSync() && !mRedrawForSyncReported; } void requestRedrawForSync() { mRedrawForSyncReported = false; } } } } Loading
services/core/java/com/android/server/wm/Task.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -4515,6 +4515,7 @@ class Task extends WindowContainer<WindowContainer> { */ */ void setMainWindowSizeChangeTransaction(SurfaceControl.Transaction t) { void setMainWindowSizeChangeTransaction(SurfaceControl.Transaction t) { setMainWindowSizeChangeTransaction(t, this); setMainWindowSizeChangeTransaction(t, this); forAllWindows(WindowState::requestRedrawForSync, true); } } private void setMainWindowSizeChangeTransaction(SurfaceControl.Transaction t, Task origin) { private void setMainWindowSizeChangeTransaction(SurfaceControl.Transaction t, Task origin) { Loading
services/core/java/com/android/server/wm/WindowState.java +22 −8 Original line number Original line Diff line number Diff line Loading @@ -339,7 +339,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP private boolean mDragResizing; private boolean mDragResizing; private boolean mDragResizingChangeReported = true; private boolean mDragResizingChangeReported = true; private int mResizeMode; private int mResizeMode; private boolean mResizeForBlastSyncReported; private boolean mRedrawForSyncReported; /** /** * Special mode that is intended only for the rounded corner overlay: during rotation * Special mode that is intended only for the rounded corner overlay: during rotation Loading Loading @@ -1402,7 +1402,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP || configChanged || configChanged || dragResizingChanged || dragResizingChanged || mReportOrientationChanged || mReportOrientationChanged || requestResizeForBlastSync()) { || shouldSendRedrawForSync()) { ProtoLog.v(WM_DEBUG_RESIZE, ProtoLog.v(WM_DEBUG_RESIZE, "Resize reasons for w=%s: %s surfaceResized=%b configChanged=%b " "Resize reasons for w=%s: %s surfaceResized=%b configChanged=%b " + "dragResizingChanged=%b reportOrientationChanged=%b", + "dragResizingChanged=%b reportOrientationChanged=%b", Loading Loading @@ -3564,7 +3564,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP mReportOrientationChanged = false; mReportOrientationChanged = false; mDragResizingChangeReported = true; mDragResizingChangeReported = true; mWinAnimator.mSurfaceResized = false; mWinAnimator.mSurfaceResized = false; mResizeForBlastSyncReported = true; mWindowFrames.resetInsetsChanged(); mWindowFrames.resetInsetsChanged(); final Rect frame = mWindowFrames.mCompatFrame; final Rect frame = mWindowFrames.mCompatFrame; Loading @@ -3572,11 +3571,13 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP final Rect visibleInsets = mWindowFrames.mLastVisibleInsets; final Rect visibleInsets = mWindowFrames.mLastVisibleInsets; final Rect stableInsets = mWindowFrames.mLastStableInsets; final Rect stableInsets = mWindowFrames.mLastStableInsets; final MergedConfiguration mergedConfiguration = mLastReportedConfiguration; final MergedConfiguration mergedConfiguration = mLastReportedConfiguration; final boolean reportDraw = mWinAnimator.mDrawState == DRAW_PENDING || useBLASTSync(); final boolean reportDraw = mWinAnimator.mDrawState == DRAW_PENDING || useBLASTSync() || !mRedrawForSyncReported; final boolean forceRelayout = reportOrientation || isDragResizeChanged(); final boolean forceRelayout = reportOrientation || isDragResizeChanged() || !mRedrawForSyncReported; final int displayId = getDisplayId(); final int displayId = getDisplayId(); final DisplayCutout displayCutout = getWmDisplayCutout().getDisplayCutout(); final DisplayCutout displayCutout = getWmDisplayCutout().getDisplayCutout(); mRedrawForSyncReported = true; try { try { mClient.resized(frame, contentInsets, visibleInsets, stableInsets, reportDraw, mClient.resized(frame, contentInsets, visibleInsets, stableInsets, reportDraw, mergedConfiguration, getBackdropFrame(frame), forceRelayout, mergedConfiguration, getBackdropFrame(frame), forceRelayout, Loading Loading @@ -5823,7 +5824,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP if (!willSync) { if (!willSync) { return false; return false; } } mResizeForBlastSyncReported = false; requestRedrawForSync(); mLocalSyncId = mBLASTSyncEngine.startSyncSet(this); mLocalSyncId = mBLASTSyncEngine.startSyncSet(this); addChildrenToSyncSet(mLocalSyncId); addChildrenToSyncSet(mLocalSyncId); Loading Loading @@ -5884,7 +5885,20 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP notifyBlastSyncTransaction(); notifyBlastSyncTransaction(); } } private boolean requestResizeForBlastSync() { /** return useBLASTSync() && !mResizeForBlastSyncReported; * When using the two WindowOrganizer sync-primitives (BoundsChangeTransaction, BLASTSync) * it can be a little difficult to predict whether your change will actually trigger redrawing * on the client side. To ease the burden on shell developers, we force send MSG_RESIZED * for Windows involved in these Syncs */ private boolean shouldSendRedrawForSync() { final Task task = getTask(); if (task != null && task.getMainWindowSizeChangeTransaction() != null) return !mRedrawForSyncReported; return useBLASTSync() && !mRedrawForSyncReported; } void requestRedrawForSync() { mRedrawForSyncReported = false; } } } }