Merge "Fix switching a background task into split screen unexpectedly" into tm-dev am: 2a3709618b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18425971 Change-Id: I2b5f0d020e7f321bb1336003cdb25af3345c8a6a Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -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*/);
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user