From 6e7fd3e2d6388905e78c4da74091228a7b28d7b7 Mon Sep 17 00:00:00 2001 From: JinsungKim Date: Mon, 17 Jun 2019 18:31:28 +0900 Subject: [PATCH] [wm]: Move split-secondary stack to front when split-screen is dismissed In ATMS. Move the split-secondary stack to the front if the split-screen primary stack shouldn't be focused after it goes fullscreen. In AS. If the activity in the primary stack calls moveTaskToBack, both stacks are dismissed and the launcher is shown. So move the stack to the bottom before changing the primary stack to fullscreen stack. Test: Manual - Exit an app in the split primary stack with the back key, or drag the divider to the top of the screen. Test: CtsWindowManagerDeviceTestCases:SplitScreenTests Bug: 129508970 Change-Id: Ia00fd6ea814b58d59165e860d5390fcfbf1623f6 (cherry picked from commit 19469da7c2053e2c211f73c6da3d25dcaebc3498) --- .../core/java/com/android/server/wm/ActivityStack.java | 10 +++++----- .../android/server/wm/ActivityTaskManagerService.java | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/services/core/java/com/android/server/wm/ActivityStack.java b/services/core/java/com/android/server/wm/ActivityStack.java index 156fb983e7b92..c1821203032ac 100644 --- a/services/core/java/com/android/server/wm/ActivityStack.java +++ b/services/core/java/com/android/server/wm/ActivityStack.java @@ -1302,6 +1302,11 @@ class ActivityStack extends ConfigurationContainer { return; } + getDisplay().positionChildAtBottom(this, reason); + if (task != null) { + insertTaskAtBottom(task); + } + /** * The intent behind moving a primary split screen stack to the back is usually to hide * behind the home stack. Exit split screen in this case. @@ -1309,11 +1314,6 @@ class ActivityStack extends ConfigurationContainer { if (getWindowingMode() == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) { setWindowingMode(WINDOWING_MODE_UNDEFINED); } - - getDisplay().positionChildAtBottom(this, reason); - if (task != null) { - insertTaskAtBottom(task); - } } boolean isFocusable() { diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java index 16dd5552d693a..6e3f03d34cab8 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java +++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java @@ -3918,10 +3918,10 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { // Caller wants the current split-screen primary stack to be the top stack after // it goes fullscreen, so move it to the front. stack.moveToFront("dismissSplitScreenMode"); - } else if (mRootActivityContainer.isTopDisplayFocusedStack(stack)) { + } else { // In this case the current split-screen primary stack shouldn't be the top - // stack after it goes fullscreen, but it current has focus, so we move the - // focus to the top-most split-screen secondary stack next to it. + // stack after it goes fullscreen, so we move the focus to the top-most + // split-screen secondary stack next to it. final ActivityStack otherStack = stack.getDisplay().getTopStackInWindowingMode( WINDOWING_MODE_SPLIT_SCREEN_SECONDARY); if (otherStack != null) {