diff options
| author | 2023-05-03 15:16:15 +0000 | |
|---|---|---|
| committer | 2023-05-04 07:09:08 +0000 | |
| commit | f79c8e919127bb97c8b2685af95975da7ccc5de0 (patch) | |
| tree | d51b88d254af2d7521b6f2224cf9b91363799c69 | |
| parent | 22cc6b63520fb51ec209055b6689e97574d38acf (diff) | |
Keep splitting tasks in the background with shell transition
Align with legacy transition to not breaks splitting tasks in the
background and set the flag to support relaunching background splitting
tasks to fullscreen.
Also fix not collecting move_to_front transition changes when
reparenting an existing task to top.
Bug: 275664132
Fix: 280523948
Test: atest WMShellUnitTests WMShellFlickerTests
Test: having a fullscreen app occludings a split pair, launching one of
the splitting task breaks the split and brings up in fullscreen
Test: going from a split pair to home, launching one of the splitting
task breaks the split and brings up in fullscreen
Test: having a task supporting auto-pip in split, going to home breaks
the split pair and entering pip
Change-Id: I134c8c4ecdfe3ee29df9de7b32cfa501c88510c6
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java | 36 | ||||
| -rw-r--r-- | services/core/java/com/android/server/wm/ActivityStarter.java | 6 |
2 files changed, 32 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 e5ae10c097a5..6125768fdb4d 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 @@ -1476,6 +1476,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, mSideStage.removeAllTasks(wct, false /* toTop */); mMainStage.deactivate(wct, false /* toTop */); } + wct.setReparentLeafTaskIfRelaunch(mRootTaskInfo.token, + false /* reparentLeafTaskIfRelaunch */); } private void prepareEnterSplitScreen(WindowContainerTransaction wct) { @@ -2327,6 +2329,15 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, // the remote handler. return null; } + + if ((mMainStage.containsTask(triggerTask.taskId) + && mMainStage.getChildCount() == 1) + || (mSideStage.containsTask(triggerTask.taskId) + && mSideStage.getChildCount() == 1)) { + // A splitting task is opening to fullscreen causes one side of the split empty, + // so appends operations to exit split. + prepareExitSplitScreen(STAGE_TYPE_UNDEFINED, out); + } } } else { if (isOpening && getStageOfTask(triggerTask) != null) { @@ -2409,9 +2420,23 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, if (isOpeningType(change.getMode())) { // Split is opened by someone so set it as visible. setSplitsVisible(true); + // TODO(b/275664132): Find a way to integrate this with finishWct. + // This is setting the flag to a task and not interfering with the + // transition. + final WindowContainerTransaction wct = new WindowContainerTransaction(); + wct.setReparentLeafTaskIfRelaunch(mRootTaskInfo.token, + false /* reparentLeafTaskIfRelaunch */); + mTaskOrganizer.applyTransaction(wct); } else if (isClosingType(change.getMode())) { // Split is closed by someone so set it as invisible. setSplitsVisible(false); + // TODO(b/275664132): Find a way to integrate this with finishWct. + // This is setting the flag to a task and not interfering with the + // transition. + final WindowContainerTransaction wct = new WindowContainerTransaction(); + wct.setReparentLeafTaskIfRelaunch(mRootTaskInfo.token, + true /* reparentLeafTaskIfRelaunch */); + mTaskOrganizer.applyTransaction(wct); } continue; } @@ -2811,16 +2836,9 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, } } - // TODO(b/275664132): Remove dismissing split screen here to fit in back-to-split support. - // Dismiss the split screen if it's not returning to split. - prepareExitSplitScreen(STAGE_TYPE_UNDEFINED, finishWct); - for (TransitionInfo.Change change : info.getChanges()) { - if (change.getTaskInfo() != null && TransitionUtil.isClosingType(change.getMode())) { - finishT.setCrop(change.getLeash(), null).hide(change.getLeash()); - } - } setSplitsVisible(false); - setDividerVisibility(false, finishT); + finishWct.setReparentLeafTaskIfRelaunch(mRootTaskInfo.token, + true /* reparentLeafTaskIfRelaunch */); logExit(EXIT_REASON_UNKNOWN); } diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java index 19a12f2b9cc0..e8acbe43689c 100644 --- a/services/core/java/com/android/server/wm/ActivityStarter.java +++ b/services/core/java/com/android/server/wm/ActivityStarter.java @@ -2909,6 +2909,9 @@ class ActivityStarter { private void setTargetRootTaskIfNeeded(ActivityRecord intentActivity) { intentActivity.getTaskFragment().clearLastPausedActivity(); Task intentTask = intentActivity.getTask(); + // The intent task might be reparented while in getOrCreateRootTask, caches the original + // root task to distinguish if it is moving to front or not. + final Task origRootTask = intentTask != null ? intentTask.getRootTask() : null; if (mTargetRootTask == null) { // Update launch target task when it is not indicated. @@ -2941,7 +2944,8 @@ class ActivityStarter { ? null : focusRootTask.topRunningNonDelayedActivityLocked(mNotTop); final Task topTask = curTop != null ? curTop.getTask() : null; differentTopTask = topTask != intentTask - || (focusRootTask != null && topTask != focusRootTask.getTopMostTask()); + || (focusRootTask != null && topTask != focusRootTask.getTopMostTask()) + || (focusRootTask != null && focusRootTask != origRootTask); } else { // The existing task should always be different from those in other displays. differentTopTask = true; |