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

Commit 75700555 authored by Kazuki Takise's avatar Kazuki Takise
Browse files

Don't override PiP windowing mode in LPM

This change fixes a regression caused by ag/26034822, where PiP
gets unexpectedly expanded via intent.

Note that this CL is simpler than the original CL merged to
main-arc-dev, as I've just realized excluding PIP win mode is
sufficient to fix the regression.

Bug: 323209868
Test: PinnedStackTests#testLaunchTaskByAffinityMatchSingleTask
Change-Id: I82eafd441c7667a7275ef85dd5ed3ee94cb3e9ff
(cherry picked from commit eef52ebe84c8f581602bad047b7df030ddc9fac2)
parent 89e122c8
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -303,15 +303,9 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier {
        } else {
            if (DEBUG) appendLog("non-freeform-task-display-area");
        }
        final boolean isUpdatingExistingTaskWindowingMode = task != null
                && task.getRequestedOverrideWindowingMode() != WINDOWING_MODE_UNDEFINED
                && launchMode != task.getRequestedOverrideWindowingMode();
        if (DEBUG && isUpdatingExistingTaskWindowingMode) {
            appendLog("updating-existing-task-windowing-mode");
        }
        // If launch mode matches display windowing mode, let it inherit from display.
        outParams.mWindowingMode = launchMode == suggestedDisplayArea.getWindowingMode()
                && !isUpdatingExistingTaskWindowingMode
                && !shouldUpdateExistingTaskWindowingMode(task, launchMode)
                ? WINDOWING_MODE_UNDEFINED : launchMode;

        if (phase == PHASE_WINDOWING_MODE) {
@@ -403,6 +397,13 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier {
        return RESULT_CONTINUE;
    }

    private boolean shouldUpdateExistingTaskWindowingMode(Task task, int launchMode) {
        return task != null
                && task.getRequestedOverrideWindowingMode() != WINDOWING_MODE_UNDEFINED
                && task.getRequestedOverrideWindowingMode() != WINDOWING_MODE_PINNED
                && launchMode != task.getRequestedOverrideWindowingMode();
    }

    private TaskDisplayArea getPreferredLaunchTaskDisplayArea(@Nullable Task task,
            @Nullable ActivityOptions options, @Nullable ActivityRecord source,
            @Nullable LaunchParams currentParams, @Nullable ActivityRecord activityRecord,