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

Commit 777d7862 authored by Louis Chang's avatar Louis Chang
Browse files

Changing the fallback behavior to launch on focused display

The original fallback behavior was to launch on the default display,
which seems not making sense anymore in a multi-display scenario.

Use the focused display instead as it is likely what the user
currently focus on.

Bug: 406967985
Test: MultiDisplayActivityLaunchTests
Flag: com.android.window.flags.fallback_to_focused_display

Change-Id: I9b63ece4a3c2728b19d6c25b25b518e8f36b1990
parent 42d4b63e
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -237,3 +237,11 @@ flag {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    namespace: "windowing_sdk"
    name: "fallback_to_focused_display"
    description: "Use the focused display as the fallback"
    bug: "406967985"
    is_fixed_read_only: true
}
 No newline at end of file
+13 −5
Original line number Diff line number Diff line
@@ -401,7 +401,7 @@ class LaunchParamsUtil {
     *     <li>The display area of the top activity from the launching process will be used</li>
     *     <li>The display area of the top activity from the real launching process will be used
     *     </li>
     *     <li>Default display area from the associated root window container.</li>
     *     <li>The default display area of the current focused display will be used.</li>
     * </ol>
     * @param activityRecord the activity being started
     * @param request optional {@link ActivityStarter.Request} made to start the activity record
@@ -452,9 +452,17 @@ class LaunchParamsUtil {
            }
        }

        if (com.android.window.flags.Flags.fallbackToFocusedDisplay()) {
            // Select the TDA from the top focused display.
            final TaskDisplayArea defaultTaskDisplayArea = supervisor.mRootWindowContainer
                    .getTopFocusedDisplayContent().getDefaultTaskDisplayArea();
            logger.accept("display-area-from-default-fallback=" + defaultTaskDisplayArea);
            return defaultTaskDisplayArea;
        } else {
            final TaskDisplayArea defaultTaskDisplayArea =
                    supervisor.mRootWindowContainer.getDefaultTaskDisplayArea();
            logger.accept("display-area-from-default-fallback=" + defaultTaskDisplayArea);
            return defaultTaskDisplayArea;
        }
    }
}