Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 79ce09a0 authored by Sean Stout's avatar Sean Stout
Browse files

Modify multi-display Activity launching behavior

When choosing the display on which to launch an Activity, prefer the
display of the launching app over the display the launched Application
is already on.

Bug: 176199388
Test: manual - launch app on external display, launch via Launcher on
primary display, relaunch on external display

Change-Id: I95d8bce2662a0d38ce8399450ccf246a72afb9fd
parent 2573939d
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -380,6 +380,12 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier {
            }
        }

        if (taskDisplayArea == null && source != null) {
            final TaskDisplayArea sourceDisplayArea = source.getDisplayArea();
            if (DEBUG) appendLog("display-area-from-source=" + sourceDisplayArea);
            taskDisplayArea = sourceDisplayArea;
        }

        Task rootTask = (taskDisplayArea == null && task != null)
                ? task.getRootTask() : null;
        if (rootTask != null) {
@@ -387,12 +393,6 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier {
            taskDisplayArea = rootTask.getDisplayArea();
        }

        if (taskDisplayArea == null && source != null) {
            final TaskDisplayArea sourceDisplayArea = source.getDisplayArea();
            if (DEBUG) appendLog("display-area-from-source=" + sourceDisplayArea);
            taskDisplayArea = sourceDisplayArea;
        }

        if (taskDisplayArea == null && options != null) {
            final int callerDisplayId = options.getCallerDisplayId();
            final DisplayContent dc =
+2 −2
Original line number Diff line number Diff line
@@ -195,7 +195,7 @@ public class TaskLaunchParamsModifierTests extends WindowTestsBase {
    }

    @Test
    public void testUsesTasksDisplayAreaIdPriorToSourceIfSet() {
    public void testUsesSourcesDisplayAreaIdPriorToTaskIfSet() {
        final TestDisplayContent freeformDisplay = createNewDisplayContent(
                WINDOWING_MODE_FREEFORM);
        final TestDisplayContent fullscreenDisplay = createNewDisplayContent(
@@ -211,7 +211,7 @@ public class TaskLaunchParamsModifierTests extends WindowTestsBase {
                        .setSource(source)
                        .calculate());

        assertEquals(fullscreenDisplay.getDefaultTaskDisplayArea(),
        assertEquals(freeformDisplay.getDefaultTaskDisplayArea(),
                mResult.mPreferredTaskDisplayArea);
    }