From d65119ec024005511cbd8c6bc46c756ddf115c9a Mon Sep 17 00:00:00 2001 From: Jerry Chang Date: Wed, 14 Sep 2022 17:13:04 +0000 Subject: [PATCH] Fix timeout when dismissing split screen to two pane mode After I1a0c4d17, the expanding task will first be resized to fullscreen then reparent to TDA after the divider bar fling animation finished. If the expanding app is expanding to two pane mode, the resuming of the second activity might be skpped due to the task in another side of the split is already empty and invisible. Update the drag-to-dismiss flow to reorder the expanding task on the top of dismissing task. So the content in the dismissing side won't flicker during the dismissing transition and the activity resume won't be skipped in the expanding side. Fix: 243368173 Test: atest WMShellFlickerTests Test: atest WMShellUnitTests Test: put Settings and Chrome in split screen, drag divider bar to dismiss Chrome, verified the expanding transition won't timeout Change-Id: Id16c1d9b4849d5f600de9524ffebb91aba73a721 --- .../com/android/wm/shell/splitscreen/MainStage.java | 5 ----- .../com/android/wm/shell/splitscreen/SideStage.java | 5 ----- .../wm/shell/splitscreen/StageCoordinator.java | 12 +++++------- .../wm/shell/splitscreen/StageTaskListener.java | 5 ----- .../wm/shell/splitscreen/StageCoordinatorTests.java | 2 -- 5 files changed, 5 insertions(+), 24 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/MainStage.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/MainStage.java index b0080b24c6092..e7ec15e70c11c 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/MainStage.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/MainStage.java @@ -45,11 +45,6 @@ class MainStage extends StageTaskListener { iconProvider); } - @Override - void dismiss(WindowContainerTransaction wct, boolean toTop) { - deactivate(wct, toTop); - } - boolean isActive() { return mIsActive; } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SideStage.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SideStage.java index 86efbe0af79c0..8639b36faf4c2 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SideStage.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SideStage.java @@ -42,11 +42,6 @@ class SideStage extends StageTaskListener { iconProvider); } - @Override - void dismiss(WindowContainerTransaction wct, boolean toTop) { - removeAllTasks(wct, toTop); - } - boolean removeAllTasks(WindowContainerTransaction wct, boolean toTop) { if (mChildrenTaskInfo.size() == 0) return false; wct.reparentTasks( 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 199007d7f577e..5a72fdc05e39a 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 @@ -901,13 +901,10 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, // Expand to top side split as full screen for fading out decor animation and dismiss // another side split(Moving its children to bottom). mIsExiting = true; - final StageTaskListener tempFullStage = childrenToTop; - final StageTaskListener dismissStage = mMainStage == childrenToTop - ? mSideStage : mMainStage; - tempFullStage.resetBounds(wct); - wct.setSmallestScreenWidthDp(tempFullStage.mRootTaskInfo.token, + childrenToTop.resetBounds(wct); + wct.reorder(childrenToTop.mRootTaskInfo.token, true); + wct.setSmallestScreenWidthDp(childrenToTop.mRootTaskInfo.token, SMALLEST_SCREEN_WIDTH_DP_UNDEFINED); - dismissStage.dismiss(wct, false /* toTop */); } mSyncQueue.queue(wct); mSyncQueue.runInSync(t -> { @@ -924,7 +921,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, childrenToTop.fadeOutDecor(() -> { WindowContainerTransaction finishedWCT = new WindowContainerTransaction(); mIsExiting = false; - childrenToTop.dismiss(finishedWCT, true /* toTop */); + mMainStage.deactivate(finishedWCT, childrenToTop == mMainStage /* toTop */); + mSideStage.removeAllTasks(finishedWCT, childrenToTop == mSideStage /* toTop */); finishedWCT.reorder(mRootTaskInfo.token, false /* toTop */); finishedWCT.setForceTranslucent(mRootTaskInfo.token, true); finishedWCT.setBounds(mSideStage.mRootTaskInfo.token, mTempRect1); diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageTaskListener.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageTaskListener.java index 1af9415fca3a5..6b90eabe3bd2c 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageTaskListener.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageTaskListener.java @@ -106,11 +106,6 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { taskOrganizer.createRootTask(displayId, WINDOWING_MODE_MULTI_WINDOW, this); } - /** - * General function for dismiss this stage. - */ - void dismiss(WindowContainerTransaction wct, boolean toTop) {} - int getChildCount() { return mChildrenTaskInfo.size(); } diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/StageCoordinatorTests.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/StageCoordinatorTests.java index 4b68870d4129f..62c5ca89e971b 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/StageCoordinatorTests.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/StageCoordinatorTests.java @@ -227,7 +227,6 @@ public class StageCoordinatorTests extends ShellTestCase { mStageCoordinator.exitSplitScreen(testTaskId, EXIT_REASON_RETURN_HOME); verify(mMainStage).reorderChild(eq(testTaskId), eq(true), any(WindowContainerTransaction.class)); - verify(mSideStage).dismiss(any(WindowContainerTransaction.class), eq(false)); verify(mMainStage).resetBounds(any(WindowContainerTransaction.class)); } @@ -241,7 +240,6 @@ public class StageCoordinatorTests extends ShellTestCase { verify(mSideStage).reorderChild(eq(testTaskId), eq(true), any(WindowContainerTransaction.class)); verify(mSideStage).resetBounds(any(WindowContainerTransaction.class)); - verify(mMainStage).dismiss(any(WindowContainerTransaction.class), eq(false)); } @Test