From 55f0c287b7578a58bc8b2874487b4fd920789508 Mon Sep 17 00:00:00 2001 From: Tony Huang Date: Wed, 20 Jul 2022 17:25:00 +0800 Subject: [PATCH] Fix wrong split layout after drag drop This cl fix two different issues but both belong to split layout issue. 1. We will reset split layout after exitSplit, but when dismiss on non-onStageHasChildrenChange case, it reparent both split root children to TDA then no children remained. At this moment, onStageHasChildrenChange will callback and we will do flingDividerToDismiss and make layout change again then cause split layout wrong on next split active. This should be block by the active flag. 2. In some race condition, the applySurfaceChanges transtion might be merged to one transition and lead to surface bounds not set as our expectation. To avoid this issue, we should remove unnecessary applySurfaceChanges using. Fix: 227142506 Test: manual Test: pass existing tests Change-Id: Id8741c88cf778a26fe39fa5c8223344a9bef4d46 --- .../android/wm/shell/splitscreen/SplitScreenController.java | 2 -- .../com/android/wm/shell/splitscreen/StageCoordinator.java | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java index 21bea4674805d..c1092dfa8d2e2 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java @@ -400,8 +400,6 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, return; } - mStageCoordinator.updateSurfaceBounds(null /* layout */, t, - false /* applyResizingOffset */); for (int i = 0; i < apps.length; ++i) { if (apps[i].mode == MODE_OPENING) { t.show(apps[i].leash); 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 2229e26b93437..e9d1055356307 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 @@ -1211,7 +1211,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, private void onStageHasChildrenChanged(StageListenerImpl stageListener) { final boolean hasChildren = stageListener.mHasChildren; final boolean isSideStage = stageListener == mSideStageListener; - if (!hasChildren && !mIsExiting) { + if (!hasChildren && !mIsExiting && mMainStage.isActive()) { if (isSideStage && mMainStageListener.mVisible) { // Exit to main stage if side stage no longer has children. if (ENABLE_SHELL_TRANSITIONS) { @@ -1231,7 +1231,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, EXIT_REASON_APP_FINISHED); } } - } else if (isSideStage && !mMainStage.isActive()) { + } else if (isSideStage && hasChildren && !mMainStage.isActive()) { if (mFocusingTaskInfo != null && !isValidToEnterSplitScreen(mFocusingTaskInfo)) { final WindowContainerTransaction wct = new WindowContainerTransaction(); mSideStage.removeAllTasks(wct, true);