Allow caller dismissing split to specify top stack
When starting a non-resizeable activity while in split-mode it is
important the non-resizeable activity causing the dismisal of the split
end up on top. This change allows the callers of dismiss split to
specify which stack will be topmost.
Fixes: 152943129
Test: atest testNonResizeableWhenAlreadyInSplitScreenPrimary testNonResizeableWhenAlreadyInSplitScreenSecondary
Change-Id: Iefba54183273f1d075fbeacdcd87133eb1f2e3ad
diff --git a/services/core/java/com/android/server/wm/ActivityStack.java b/services/core/java/com/android/server/wm/ActivityStack.java
index 78d2afc..0f52248 100644
--- a/services/core/java/com/android/server/wm/ActivityStack.java
+++ b/services/core/java/com/android/server/wm/ActivityStack.java
@@ -757,7 +757,7 @@
// warning toast about it.
mAtmService.getTaskChangeNotificationController()
.notifyActivityDismissingDockedStack();
- taskDisplayArea.onSplitScreenModeDismissed();
+ taskDisplayArea.onSplitScreenModeDismissed(this);
}
}
diff --git a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java
index 1e5a924..89cf6d4 100644
--- a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java
@@ -2198,7 +2198,7 @@
// split-screen in split-screen.
mService.getTaskChangeNotificationController()
.notifyActivityDismissingDockedStack();
- taskDisplayArea.onSplitScreenModeDismissed();
+ taskDisplayArea.onSplitScreenModeDismissed(task.getStack());
taskDisplayArea.mDisplayContent.ensureActivitiesVisible(null, 0, PRESERVE_WINDOWS,
true /* notifyClients */);
}
diff --git a/services/core/java/com/android/server/wm/TaskDisplayArea.java b/services/core/java/com/android/server/wm/TaskDisplayArea.java
index ec3c99b..6016648 100644
--- a/services/core/java/com/android/server/wm/TaskDisplayArea.java
+++ b/services/core/java/com/android/server/wm/TaskDisplayArea.java
@@ -1165,17 +1165,23 @@
}
void onSplitScreenModeDismissed() {
+ onSplitScreenModeDismissed(null /* toTop */);
+ }
+
+ void onSplitScreenModeDismissed(ActivityStack toTop) {
mAtmService.deferWindowLayout();
try {
mLaunchRootTask = null;
moveSplitScreenTasksToFullScreen();
} finally {
- final ActivityStack topFullscreenStack =
- getTopStackInWindowingMode(WINDOWING_MODE_FULLSCREEN);
+ final ActivityStack topFullscreenStack = toTop != null
+ ? toTop : getTopStackInWindowingMode(WINDOWING_MODE_FULLSCREEN);
final ActivityStack homeStack = getOrCreateRootHomeTask();
- if (topFullscreenStack != null && homeStack != null && !isTopStack(homeStack)) {
+ if (homeStack != null && ((topFullscreenStack != null && !isTopStack(homeStack))
+ || toTop != null)) {
// Whenever split-screen is dismissed we want the home stack directly behind the
// current top fullscreen stack so it shows up when the top stack is finished.
+ // Or, if the caller specified a stack to be on top after split-screen is dismissed.
// TODO: Would be better to use ActivityDisplay.positionChildAt() for this, however
// ActivityDisplay doesn't have a direct controller to WM side yet. We can switch
// once we have that.