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

Commit eda48577 authored by Jorge Gil's avatar Jorge Gil
Browse files

[10/N] Desks: Let non-root organized leaves use launch bounds

Allows non-root, created-by-organizer tasks to use the launch bounds
calculated by LaunchParams, instead of always inheriting form the root
task.
Non-organized tasks are left unchanged, always inheriting from the root.

Flag: com.android.window.flags.enable_multiple_desktops_backend
Bug: 394189679
Test: with a desk active, open a new window from taskbar, verify it
opens with freeform bounds, not fullscreen

Change-Id: I5985242014e02e051fad98e89a38cf03cd096f66
parent 4787b0a7
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -2417,18 +2417,17 @@ class Task extends TaskFragment {
        mTaskSupervisor.mLaunchParamsPersister.saveTask(this, display);
    }

    Rect updateOverrideConfigurationFromLaunchBounds() {
    void updateOverrideConfigurationFromLaunchBounds() {
        // If the task is controlled by another organized task, do not set override
        // configurations and let its parent (organized task) to control it;
        final Task rootTask = getRootTask();
        final Rect bounds = rootTask != this && rootTask.isOrganized() ? null : getLaunchBounds();
        setBounds(bounds);
        if (bounds != null && !bounds.isEmpty()) {
            // TODO: Review if we actually want to do this - we are setting the launch bounds
            // directly here.
            bounds.set(getRequestedOverrideBounds());
        boolean shouldInheritBounds = rootTask != this && rootTask.isOrganized();
        if (Flags.enableMultipleDesktopsBackend()) {
            // Only inherit from organized parent when this task is not organized.
            shouldInheritBounds &= !isOrganized();
        }
        return bounds;
        final Rect bounds = shouldInheritBounds ? null : getLaunchBounds();
        setBounds(bounds);
    }

    /** Returns the bounds that should be used to launch this task. */