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

Commit 8d6c4051 authored by Jorge Gil's avatar Jorge Gil Committed by Android (Google) Code Review
Browse files

Merge "Desks: Do not separate recent tasks into desks without frontend" into main

parents 8233b61b 9f819162
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@ import android.os.Bundle;
import android.os.RemoteException;
import android.util.Slog;
import android.util.SparseIntArray;
import android.window.DesktopExperienceFlags;
import android.window.DesktopModeFlags;
import android.window.WindowContainerToken;
import android.window.WindowContainerTransaction;
@@ -580,10 +579,10 @@ public class RecentTasksController implements TaskStackListenerCallback,
     * displays, without adding any desk tasks. This is a preparation step so that tasks can be
     * added to these desks in `generateList()`.
     *
     * This is needed since with the `ENABLE_MULTIPLE_DESKTOPS_BACKEND` flag, we want to include
     * desk even if they're empty (i.e. have no tasks).
     * This is needed since with the multiple-desktops flags, we want to include desk even if
     * they're empty (i.e. have no tasks).
     *
     * @param multipleDesktopsEnabled whether the multiple desktops backend feature is enabled.
     * @param multipleDesktopsEnabled whether the multiple desktops feature is enabled.
     */
    private void initializeDesksMap(boolean multipleDesktopsEnabled) {
        mTmpDesks.clear();
@@ -610,8 +609,13 @@ public class RecentTasksController implements TaskStackListenerCallback,
    private Desk getOrCreateDesk(int deskId) {
        var desk = mTmpDesks.get(deskId);
        if (desk == null) {
            desk = new Desk(deskId,
                    mDesktopUserRepositories.get().getCurrent().getDisplayForDesk(deskId));
            final int displayId;
            if (deskId == INVALID_DESK_ID) {
                displayId = INVALID_DISPLAY;
            } else {
                displayId = mDesktopUserRepositories.get().getCurrent().getDisplayForDesk(deskId);
            }
            desk = new Desk(deskId, displayId);
            mTmpDesks.put(deskId, desk);
        }
        return desk;
@@ -644,8 +648,7 @@ public class RecentTasksController implements TaskStackListenerCallback,
            ProtoLog.v(WM_SHELL_TASK_OBSERVER, "RecentTasksController.generateList(%s)", reason);
        }

        final boolean multipleDesktopsEnabled =
                DesktopExperienceFlags.ENABLE_MULTIPLE_DESKTOPS_BACKEND.isTrue();
        final boolean multipleDesktopsEnabled = mDesktopState.enableMultipleDesktops();
        initializeDesksMap(multipleDesktopsEnabled);

        // When the multiple desktops feature is enabled, we include all desks even if they're