Merge "Fix switching a background task into split screen unexpectedly" into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2a3709618b
@@ -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