diff options
| author | 2022-05-18 18:11:39 +0000 | |
|---|---|---|
| committer | 2022-05-18 18:11:39 +0000 | |
| commit | 2a3709618b5540065e76b9968df2c9a307752d0d (patch) | |
| tree | 95f947f9b8c621f7b6efb5b7f014810983341c2a | |
| parent | 26b096d28823465513e824c2c229fe2f11ee8291 (diff) | |
| parent | 514a576b9e7b4d132b8d42744addcb1c9cbb6368 (diff) | |
Merge "Fix switching a background task into split screen unexpectedly" into tm-dev
3 files changed, 21 insertions, 0 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 ac76d17e2a51..31b510c38457 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 @@ -414,6 +414,13 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, } RemoteAnimationTarget[] onGoingToRecentsLegacy(RemoteAnimationTarget[] apps) { + if (isSplitScreenVisible()) { + // Evict child tasks except the top visible one under split root to ensure it could be + // launched as full screen when switching to it on recents. + final WindowContainerTransaction wct = new WindowContainerTransaction(); + mStageCoordinator.prepareEvictInvisibleChildTasks(wct); + mSyncQueue.queue(wct); + } return reparentSplitTasksForAnimation(apps, true /*splitExpectedToBeVisible*/); } 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 1d976cea96a3..7ea32a6d8f86 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 @@ -533,6 +533,11 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler, } } + void prepareEvictInvisibleChildTasks(WindowContainerTransaction wct) { + mMainStage.evictInvisibleChildren(wct); + mSideStage.evictInvisibleChildren(wct); + } + Bundle resolveStartStage(@StageType int stage, @SplitPosition int position, @androidx.annotation.Nullable Bundle options, @androidx.annotation.Nullable WindowContainerTransaction wct) { 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 7571e29a86a3..949bf5f55808 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 @@ -341,6 +341,15 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { } } + void evictInvisibleChildren(WindowContainerTransaction wct) { + for (int i = mChildrenTaskInfo.size() - 1; i >= 0; i--) { + final ActivityManager.RunningTaskInfo taskInfo = mChildrenTaskInfo.valueAt(i); + if (!taskInfo.isVisible) { + wct.reparent(taskInfo.token, null /* parent */, false /* onTop */); + } + } + } + void onSplitScreenListenerRegistered(SplitScreen.SplitScreenListener listener, @StageType int stage) { for (int i = mChildrenTaskInfo.size() - 1; i >= 0; --i) { |