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
This commit is contained in:
Jeff Chang
2022-11-09 16:39:42 +08:00
committed by Tony Huang
parent 715ec8b312
commit 76ce5869fc

View File

@@ -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();