From 38d79dc4f849f30688396bd29727d8649f331c33 Mon Sep 17 00:00:00 2001 From: Tony Huang Date: Mon, 15 May 2023 17:06:13 +0800 Subject: [PATCH] Fix decor stuck after rotate If users resize on origin bounds case, we will skip that resized bounds update, but we should still make decor get resized callback to ensure all current status reset. Fix: 281965436 Test: manual Test: pass existing tests Change-Id: I67cac12009bcc5d01b2c2bdee0f48b47e9a7ff22 --- .../shell/splitscreen/StageCoordinator.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java index 087e3a2384d66..a56be73656351 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java @@ -2061,18 +2061,16 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, // Reset this flag every time onLayoutSizeChanged. mShowDecorImmediately = false; - if (!ENABLE_SHELL_TRANSITIONS) { - // Only need screenshot for legacy case because shell transition should screenshot - // itself during transition. - final SurfaceControl.Transaction startT = mTransactionPool.acquire(); - mMainStage.screenshotIfNeeded(startT); - mSideStage.screenshotIfNeeded(startT); - mTransactionPool.release(startT); - } - final WindowContainerTransaction wct = new WindowContainerTransaction(); boolean sizeChanged = updateWindowBounds(layout, wct); - if (!sizeChanged) return; + if (!sizeChanged) { + // We still need to resize on decor for ensure all current status clear. + final SurfaceControl.Transaction t = mTransactionPool.acquire(); + mMainStage.onResized(t); + mSideStage.onResized(t); + mTransactionPool.release(t); + return; + } sendOnBoundsChanged(); if (ENABLE_SHELL_TRANSITIONS) { @@ -2080,6 +2078,13 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, mSplitTransitions.startResizeTransition(wct, this, (finishWct, t) -> mSplitLayout.setDividerInteractive(true, false, "onSplitResizeFinish")); } else { + // Only need screenshot for legacy case because shell transition should screenshot + // itself during transition. + final SurfaceControl.Transaction startT = mTransactionPool.acquire(); + mMainStage.screenshotIfNeeded(startT); + mSideStage.screenshotIfNeeded(startT); + mTransactionPool.release(startT); + mSyncQueue.queue(wct); mSyncQueue.runInSync(t -> { updateSurfaceBounds(layout, t, false /* applyResizingOffset */);