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

Commit 954fc33e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Handover launch display id when starting activity from no-display caller"

parents 9aa8aa1c d58cb67b
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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?

@@ -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();
        }
    }

+7 −0
Original line number Diff line number Diff line
@@ -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) {
+19 −0
Original line number Diff line number Diff line
@@ -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
    // =====================================