Exit split-screen when primary stack moved behind a fullscreen stack.

Activities can request their task be moved to the back of the stack,
which subsequently causes the stack to move as well. When the stack
is a split screen primary stack, this causes an ordering issue where
the secondary will not move back while a fullscreen stack has moved
in front of the primary. This leads to further ordering issues once
the front secondary is dismissed as other stacks are also in the
secondary windowing mode.

To address this issue, we exit split-screen mode when the primary
split-screen stack is moved back.

Test: atest ActivityStackTests#testPrimarySplitScreenToFullscreenWhenMovedToBack
Change-Id: Ic0597831e046a254b3cba216e1cb2fb11191f2c6
Fixes: 69662547
This commit is contained in:
Bryce Lee
2018-01-05 09:00:49 -08:00
parent d93d206cfe
commit 8cab4a02bb
2 changed files with 32 additions and 1 deletions

View File

@@ -1013,6 +1013,14 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
return;
}
/**
* 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.
*/
if (getWindowingMode() == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
setWindowingMode(WINDOWING_MODE_FULLSCREEN);
}
getDisplay().positionChildAtBottom(this);
mStackSupervisor.setFocusStackUnchecked(reason, getDisplay().getTopStack());
if (task != null) {

View File

@@ -47,7 +47,7 @@ import org.junit.Test;
* Tests for the {@link ActivityStack} class.
*
* Build/Install/Run:
* bit FrameworksServicesTests:com.android.server.am.ActivityStackTests
* atest ActivityStackTests
*/
@SmallTest
@Presubmit
@@ -103,6 +103,29 @@ public class ActivityStackTests extends ActivityTestsBase {
assertEquals(mStack.mResumedActivity, r);
}
@Test
public void testPrimarySplitScreenToFullscreenWhenMovedToBack() throws Exception {
// Create primary splitscreen stack. This will create secondary stacks and places the
// existing fullscreen stack on the bottom.
final ActivityStack primarySplitScreen = mService.mStackSupervisor.getDefaultDisplay()
.createStack(WINDOWING_MODE_SPLIT_SCREEN_PRIMARY, ACTIVITY_TYPE_STANDARD,
true /* onTop */);
// Assert windowing mode.
assertEquals(primarySplitScreen.getWindowingMode(), WINDOWING_MODE_SPLIT_SCREEN_PRIMARY);
// Move primary to back.
primarySplitScreen.moveToBack("testPrimarySplitScreenToFullscreenWhenMovedToBack",
null /* task */);
// Assert that stack is at the bottom.
assertEquals(mService.mStackSupervisor.getDefaultDisplay().getIndexOf(primarySplitScreen),
0);
// Ensure no longer in splitscreen.
assertEquals(primarySplitScreen.getWindowingMode(), WINDOWING_MODE_FULLSCREEN);
}
@Test
public void testStopActivityWhenActivityDestroyed() throws Exception {
final ActivityRecord r = new ActivityBuilder(mService).setTask(mTask).build();