Merge "Fix the root task of secondary split screen could be overwritten." into rvc-dev am: 67a056a94c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11716093

Change-Id: Ia0619f4429508d84386f68e16871a294dcf248e6
This commit is contained in:
Wei Sheng Shih
2020-06-15 09:47:14 +00:00
committed by Automerger Merge Worker

View File

@@ -1742,21 +1742,23 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> {
// reparenting stack finished. // reparenting stack finished.
// Keep the order from bottom to top. // Keep the order from bottom to top.
int numStacks = getStackCount(); int numStacks = getStackCount();
final boolean splitScreenActivated = toDisplayArea.isSplitScreenModeActivated();
final ActivityStack rootStack = splitScreenActivated ? toDisplayArea
.getTopStackInWindowingMode(WINDOWING_MODE_SPLIT_SCREEN_SECONDARY) : null;
for (int stackNdx = 0; stackNdx < numStacks; stackNdx++) { for (int stackNdx = 0; stackNdx < numStacks; stackNdx++) {
final ActivityStack stack = getStackAt(stackNdx); final ActivityStack stack = getStackAt(stackNdx);
// Always finish non-standard type stacks. // Always finish non-standard type stacks.
if (destroyContentOnRemoval || !stack.isActivityTypeStandardOrUndefined()) { if (destroyContentOnRemoval || !stack.isActivityTypeStandardOrUndefined()) {
stack.finishAllActivitiesImmediately(); stack.finishAllActivitiesImmediately();
} else { } else {
// If default display is in split-window mode, set windowing mode of the // Reparent the stack to the root task of secondary-split-screen or display area.
// stack to split-screen secondary. Otherwise, set the windowing mode to stack.reparent(stack.supportsSplitScreenWindowingMode() && rootStack != null
// undefined by default to let stack inherited the windowing mode from the ? rootStack : toDisplayArea, POSITION_TOP);
// new display.
final int windowingMode = toDisplayArea.isSplitScreenModeActivated() // Set the windowing mode to undefined by default to let the stack inherited the
? WINDOWING_MODE_SPLIT_SCREEN_SECONDARY // windowing mode.
: WINDOWING_MODE_UNDEFINED; stack.setWindowingMode(WINDOWING_MODE_UNDEFINED);
stack.reparent(toDisplayArea, true /* onTop */);
stack.setWindowingMode(windowingMode);
lastReparentedStack = stack; lastReparentedStack = stack;
} }
// Stacks may be removed from this display. Ensure each stack will be processed // Stacks may be removed from this display. Ensure each stack will be processed
@@ -1764,6 +1766,17 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> {
stackNdx -= numStacks - getStackCount(); stackNdx -= numStacks - getStackCount();
numStacks = getStackCount(); numStacks = getStackCount();
} }
if (lastReparentedStack != null && splitScreenActivated) {
if (!lastReparentedStack.supportsSplitScreenWindowingMode()) {
mAtmService.getTaskChangeNotificationController()
.notifyActivityDismissingDockedStack();
toDisplayArea.onSplitScreenModeDismissed(lastReparentedStack);
} else if (rootStack != null) {
// update focus
rootStack.moveToFront("display-removed");
}
}
mRemoved = true; mRemoved = true;
return lastReparentedStack; return lastReparentedStack;