Loading services/core/java/com/android/server/wm/ActivityRecord.java +6 −1 Original line number Diff line number Diff line Loading @@ -271,7 +271,10 @@ final class ActivityRecord extends ConfigurationContainer { boolean fullscreen; // The activity is opaque and fills the entire space of this task. // TODO: See if it possible to combine this with the fullscreen field. final boolean hasWallpaper; // Has a wallpaper window as a background. final boolean noDisplay; // activity is not displayed? @VisibleForTesting boolean noDisplay; // activity is not displayed? @VisibleForTesting int mHandoverLaunchDisplayId = INVALID_DISPLAY; // Handover launch display id to next activity. private final boolean componentSpecified; // did caller specify an explicit component? final boolean rootVoiceInteraction; // was this the root activity of a voice interaction? Loading Loading @@ -1019,6 +1022,8 @@ final class ActivityRecord extends ConfigurationContainer { if (useLockTask && lockTaskLaunchMode == LOCK_TASK_LAUNCH_MODE_DEFAULT) { lockTaskLaunchMode = LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED; } // Gets launch display id from options. It returns INVALID_DISPLAY if not set. mHandoverLaunchDisplayId = options.getLaunchDisplayId(); } } Loading services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java +7 −0 Original line number Diff line number Diff line Loading @@ -305,6 +305,13 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier { displayId = optionLaunchId; } // If the source activity is a no-display activity, pass on the launch display id from // source activity as currently preferred. if (displayId == INVALID_DISPLAY && source != null && source.noDisplay) { displayId = source.mHandoverLaunchDisplayId; if (DEBUG) appendLog("display-from-no-display-source=" + displayId); } ActivityStack stack = (displayId == INVALID_DISPLAY && task != null) ? task.getStack() : null; if (stack != null) { Loading services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java +19 −0 Original line number Diff line number Diff line Loading @@ -199,6 +199,25 @@ public class TaskLaunchParamsModifierTests extends ActivityTestsBase { assertEquals(freeformDisplay.mDisplayId, mResult.mPreferredDisplayId); } @Test public void testUsesNoDisplaySourceHandoverDisplayIdIfSet() { final TestActivityDisplay freeformDisplay = createNewActivityDisplay( WINDOWING_MODE_FREEFORM); final TestActivityDisplay fullscreenDisplay = createNewActivityDisplay( WINDOWING_MODE_FULLSCREEN); mCurrent.mPreferredDisplayId = fullscreenDisplay.mDisplayId; ActivityRecord reusableActivity = createSourceActivity(fullscreenDisplay); ActivityRecord source = createSourceActivity(freeformDisplay); source.mHandoverLaunchDisplayId = freeformDisplay.mDisplayId; source.noDisplay = true; assertEquals(RESULT_CONTINUE, mTarget.onCalculate(reusableActivity.getTaskRecord(), null /* layout */, mActivity, source, null /* options */, mCurrent, mResult)); assertEquals(freeformDisplay.mDisplayId, mResult.mPreferredDisplayId); } // ===================================== // Launch Windowing Mode Related Tests // ===================================== Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +6 −1 Original line number Diff line number Diff line Loading @@ -271,7 +271,10 @@ final class ActivityRecord extends ConfigurationContainer { boolean fullscreen; // The activity is opaque and fills the entire space of this task. // TODO: See if it possible to combine this with the fullscreen field. final boolean hasWallpaper; // Has a wallpaper window as a background. final boolean noDisplay; // activity is not displayed? @VisibleForTesting boolean noDisplay; // activity is not displayed? @VisibleForTesting int mHandoverLaunchDisplayId = INVALID_DISPLAY; // Handover launch display id to next activity. private final boolean componentSpecified; // did caller specify an explicit component? final boolean rootVoiceInteraction; // was this the root activity of a voice interaction? Loading Loading @@ -1019,6 +1022,8 @@ final class ActivityRecord extends ConfigurationContainer { if (useLockTask && lockTaskLaunchMode == LOCK_TASK_LAUNCH_MODE_DEFAULT) { lockTaskLaunchMode = LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED; } // Gets launch display id from options. It returns INVALID_DISPLAY if not set. mHandoverLaunchDisplayId = options.getLaunchDisplayId(); } } Loading
services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java +7 −0 Original line number Diff line number Diff line Loading @@ -305,6 +305,13 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier { displayId = optionLaunchId; } // If the source activity is a no-display activity, pass on the launch display id from // source activity as currently preferred. if (displayId == INVALID_DISPLAY && source != null && source.noDisplay) { displayId = source.mHandoverLaunchDisplayId; if (DEBUG) appendLog("display-from-no-display-source=" + displayId); } ActivityStack stack = (displayId == INVALID_DISPLAY && task != null) ? task.getStack() : null; if (stack != null) { Loading
services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java +19 −0 Original line number Diff line number Diff line Loading @@ -199,6 +199,25 @@ public class TaskLaunchParamsModifierTests extends ActivityTestsBase { assertEquals(freeformDisplay.mDisplayId, mResult.mPreferredDisplayId); } @Test public void testUsesNoDisplaySourceHandoverDisplayIdIfSet() { final TestActivityDisplay freeformDisplay = createNewActivityDisplay( WINDOWING_MODE_FREEFORM); final TestActivityDisplay fullscreenDisplay = createNewActivityDisplay( WINDOWING_MODE_FULLSCREEN); mCurrent.mPreferredDisplayId = fullscreenDisplay.mDisplayId; ActivityRecord reusableActivity = createSourceActivity(fullscreenDisplay); ActivityRecord source = createSourceActivity(freeformDisplay); source.mHandoverLaunchDisplayId = freeformDisplay.mDisplayId; source.noDisplay = true; assertEquals(RESULT_CONTINUE, mTarget.onCalculate(reusableActivity.getTaskRecord(), null /* layout */, mActivity, source, null /* options */, mCurrent, mResult)); assertEquals(freeformDisplay.mDisplayId, mResult.mPreferredDisplayId); } // ===================================== // Launch Windowing Mode Related Tests // ===================================== Loading