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

Commit b3a00921 authored by Louis Chang's avatar Louis Chang
Browse files

Let fullscreen leafTask inherits windowingMode from multi-window rootTask

The test explicitly started an Activity in fullscreen windowingMode,
and the activity task was positioned in an organized multi-window
root-task. In that case, in TaskLaunchParamsModifier#calculate, the
calculated windowingMode was undefined, because the TDA was also
fullscreen, so the Task ended up as multi-window mode (inherit
from the root task).

But the resolved windowingMode was still fullscreen while calculating
the task bounds in TaskLaunchParamsModifier#calculate, so the
freeform bounds is returned and the task was updated to freeform
size while layout the Task.

This makes the Activity be launched in a smaller bounds than expected,
so as the windowMetrics of the embedding rules. So, the placeholder was
started and test failed while launching an activity on the secondary
display.

Bug: 408087047
Flag: EXEMPT bugfix
Test: MultiDisplayActivityEmbeddingPlaceholderTests

Change-Id: I1e99d415cd55e8a0fd0e51f8b61ef2e8b7594b6b
parent 8ae2f4fc
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -212,3 +212,14 @@ flag {
    bug: "407669465"
    is_fixed_read_only: true
}

flag {
    namespace: "windowing_sdk"
    name: "fix_fullscreen_in_multi_window"
    description: "Let leaf task inherits the windowing mode from the root task."
    bug: "408087047"
    is_fixed_read_only: true
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}
 No newline at end of file
+19 −2
Original line number Diff line number Diff line
@@ -303,6 +303,17 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier {
        } else {
            if (DEBUG) appendLog("non-freeform-task-display-area");
        }
        boolean isNonRootLeafTask =
                com.android.window.flags.Flags.fixFullscreenInMultiWindow() ? task != null
                        && !task.isRootTask() : false;
        if (launchMode == WINDOWING_MODE_FULLSCREEN && isNonRootLeafTask
                && task.getRootTask().inMultiWindowMode()) {
            // Seems not making sense to have a fullscreen task in a multi-window Task, let it
            // inherits from the root task.
            launchMode = WINDOWING_MODE_UNDEFINED;
            if (DEBUG) appendLog("inherit-rootTask");
        }

        // If launch mode matches display windowing mode, let it inherit from display.
        outParams.mWindowingMode = launchMode == suggestedDisplayArea.getWindowingMode()
                && !shouldUpdateExistingTaskWindowingMode(task, launchMode)
@@ -314,8 +325,14 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier {

        // STEP 3: Finalize the display area. Here we allow WM shell route all launches that match
        // certain criteria to specific task display areas.
        final int resolvedMode = (launchMode != WINDOWING_MODE_UNDEFINED) ? launchMode
        final int resolvedMode;
        if (launchMode == WINDOWING_MODE_UNDEFINED) {
            resolvedMode = isNonRootLeafTask ? task.getRootTask().getWindowingMode()
                    : suggestedDisplayArea.getWindowingMode();
        } else {
            resolvedMode = launchMode;
        }

        TaskDisplayArea taskDisplayArea = suggestedDisplayArea;
        // If launch task display area is set in options we should just use it. We assume the
        // suggestedDisplayArea has the right one in this case.