Loading services/core/java/com/android/server/wm/ActivityStarter.java +5 −0 Original line number Diff line number Diff line Loading @@ -2451,6 +2451,11 @@ class ActivityStarter { } } if ((mLaunchFlags & FLAG_ACTIVITY_LAUNCH_ADJACENT) != 0 && mSourceRecord == null) { // ignore the flag if there is no the sourceRecord mLaunchFlags &= ~FLAG_ACTIVITY_LAUNCH_ADJACENT; } // We'll invoke onUserLeaving before onPause only if the launching // activity did not explicitly state that this is an automated launch. mSupervisor.mUserLeaving = (mLaunchFlags & FLAG_ACTIVITY_NO_USER_ACTION) == 0; Loading services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java +8 −9 Original line number Diff line number Diff line Loading @@ -1120,28 +1120,27 @@ public class ActivityStarterTests extends WindowTestsBase { } @Test public void testTargetStackInSplitScreen() { public void testTargetTaskInSplitScreen() { final ActivityStarter starter = prepareStarter(FLAG_ACTIVITY_LAUNCH_ADJACENT, false /* mockGetRootTask */); final ActivityRecord top = new ActivityBuilder(mAtm).setCreateTask(true).build(); final ActivityOptions options = ActivityOptions.makeBasic(); final ActivityRecord[] outActivity = new ActivityRecord[1]; // Activity must not land on split-screen stack if currently not in split-screen mode. // Activity must not land on split-screen task if currently not in split-screen mode. starter.setActivityOptions(options.toBundle()) .setReason("testWindowingModeOptionsLaunchAdjacent") .setReason("testTargetTaskInSplitScreen") .setOutActivity(outActivity).execute(); assertThat(outActivity[0].inMultiWindowMode()).isFalse(); // Move activity to split-screen-primary stack and make sure it has the focus. // Move activity to split-screen-primary task and make sure it has the focus. TestSplitOrganizer splitOrg = new TestSplitOrganizer(mAtm, top.getDisplayContent()); top.getRootTask().reparent(splitOrg.mPrimary, POSITION_BOTTOM); top.getRootTask().moveToFront("testWindowingModeOptionsLaunchAdjacent"); top.getRootTask().moveToFront("testTargetTaskInSplitScreen"); // Activity must landed on split-screen-secondary when launch adjacent. starter.setActivityOptions(options.toBundle()) .setReason("testWindowingModeOptionsLaunchAdjacent") .setOutActivity(outActivity).execute(); // Activity must land on split-screen-secondary when launch adjacent. startActivityInner(starter, outActivity[0], top, options, null /* inTask */, null /* taskFragment*/); assertThat(outActivity[0].inMultiWindowMode()).isTrue(); } Loading Loading
services/core/java/com/android/server/wm/ActivityStarter.java +5 −0 Original line number Diff line number Diff line Loading @@ -2451,6 +2451,11 @@ class ActivityStarter { } } if ((mLaunchFlags & FLAG_ACTIVITY_LAUNCH_ADJACENT) != 0 && mSourceRecord == null) { // ignore the flag if there is no the sourceRecord mLaunchFlags &= ~FLAG_ACTIVITY_LAUNCH_ADJACENT; } // We'll invoke onUserLeaving before onPause only if the launching // activity did not explicitly state that this is an automated launch. mSupervisor.mUserLeaving = (mLaunchFlags & FLAG_ACTIVITY_NO_USER_ACTION) == 0; Loading
services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java +8 −9 Original line number Diff line number Diff line Loading @@ -1120,28 +1120,27 @@ public class ActivityStarterTests extends WindowTestsBase { } @Test public void testTargetStackInSplitScreen() { public void testTargetTaskInSplitScreen() { final ActivityStarter starter = prepareStarter(FLAG_ACTIVITY_LAUNCH_ADJACENT, false /* mockGetRootTask */); final ActivityRecord top = new ActivityBuilder(mAtm).setCreateTask(true).build(); final ActivityOptions options = ActivityOptions.makeBasic(); final ActivityRecord[] outActivity = new ActivityRecord[1]; // Activity must not land on split-screen stack if currently not in split-screen mode. // Activity must not land on split-screen task if currently not in split-screen mode. starter.setActivityOptions(options.toBundle()) .setReason("testWindowingModeOptionsLaunchAdjacent") .setReason("testTargetTaskInSplitScreen") .setOutActivity(outActivity).execute(); assertThat(outActivity[0].inMultiWindowMode()).isFalse(); // Move activity to split-screen-primary stack and make sure it has the focus. // Move activity to split-screen-primary task and make sure it has the focus. TestSplitOrganizer splitOrg = new TestSplitOrganizer(mAtm, top.getDisplayContent()); top.getRootTask().reparent(splitOrg.mPrimary, POSITION_BOTTOM); top.getRootTask().moveToFront("testWindowingModeOptionsLaunchAdjacent"); top.getRootTask().moveToFront("testTargetTaskInSplitScreen"); // Activity must landed on split-screen-secondary when launch adjacent. starter.setActivityOptions(options.toBundle()) .setReason("testWindowingModeOptionsLaunchAdjacent") .setOutActivity(outActivity).execute(); // Activity must land on split-screen-secondary when launch adjacent. startActivityInner(starter, outActivity[0], top, options, null /* inTask */, null /* taskFragment*/); assertThat(outActivity[0].inMultiWindowMode()).isTrue(); } Loading