diff options
| author | 2022-11-09 16:39:42 +0800 | |
|---|---|---|
| committer | 2022-12-13 07:52:49 +0000 | |
| commit | 76ce5869fc9acbd8b925682d99dc73833bc5aa2c (patch) | |
| tree | 80aaf8f21a1d54887542b53676c08700f65826d6 | |
| parent | 715ec8b312ad224bac02f35ab8cf8a6ca172bd03 (diff) | |
Support back gesture to split pair in background
Split screen will be dismissed right after both sides of the split
were occluded. So if users try to use a back-gesture to go back to
the previous split pair, it’ll be back to home instead of going
back to the split pair. This CL support the split pair in background
to make split experience better.
Bug: 236317871
Test: atest com.android.wm.shell.SplitLayoutTests
Change-Id: I1ead65011ced82e1faa24ccfbc8bf474828fc7dc
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java | 17 |
1 files changed, 12 insertions, 5 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 da8dc8733ef5..80149996cf6c 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 @@ -1064,6 +1064,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, wct.setSmallestScreenWidthDp(childrenToTop.mRootTaskInfo.token, SMALLEST_SCREEN_WIDTH_DP_UNDEFINED); } + wct.setReparentLeafTaskIfRelaunch(mRootTaskInfo.token, + false /* reparentLeafTaskIfRelaunch */); mSyncQueue.queue(wct); mSyncQueue.runInSync(t -> { t.setWindowCrop(mMainStage.mRootLeash, null) @@ -1441,16 +1443,19 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, return; } + final WindowContainerTransaction wct = new WindowContainerTransaction(); if (!mainStageVisible) { + wct.setReparentLeafTaskIfRelaunch(mRootTaskInfo.token, + true /* setReparentLeafTaskIfRelaunch */); // Both stages are not visible, check if it needs to dismiss split screen. - if (mExitSplitScreenOnHide - // Don't dismiss split screen when both stages are not visible due to sleeping - // display. - || (!mMainStage.mRootTaskInfo.isSleeping - && !mSideStage.mRootTaskInfo.isSleeping)) { + if (mExitSplitScreenOnHide) { exitSplitScreen(null /* childrenToTop */, EXIT_REASON_RETURN_HOME); } + } else { + wct.setReparentLeafTaskIfRelaunch(mRootTaskInfo.token, + false /* setReparentLeafTaskIfRelaunch */); } + mSyncQueue.queue(wct); mSyncQueue.runInSync(t -> { t.setVisibility(mSideStage.mRootLeash, sideStageVisible) @@ -1571,6 +1576,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, mSideStagePosition != SPLIT_POSITION_BOTTOM_OR_RIGHT, EXIT_REASON_APP_FINISHED); } + } else { + exitSplitScreen(null /* childrenToTop */, EXIT_REASON_UNKNOWN); } } else if (isSideStage && hasChildren && !mMainStage.isActive()) { final WindowContainerTransaction wct = new WindowContainerTransaction(); |