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

Commit 53a14933 authored by Ats Jenk's avatar Ats Jenk
Browse files

Execute WCT when showDesktopApps is called

When shell transitions were enabled, we were not exeucting the WCT that
brings desktop apps to front.
Ensure that this is called when shell transitions are enabled.

Bug: 254738174
Test: atest DesktopModeControllerTest
Change-Id: Ie8391867a1d89ecdab7cbd5afd8cd80ecdc5b78c
parent 40828e97
Loading
Loading
Loading
Loading
+14 −7
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_TO_FRONT;


import static com.android.wm.shell.common.ExecutorUtils.executeRemoteCallWithTaskPermission;
import static com.android.wm.shell.common.ExecutorUtils.executeRemoteCallWithTaskPermission;
import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE;
import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE;
@@ -181,7 +182,18 @@ public class DesktopModeController implements RemoteCallable<DesktopModeControll
    /**
    /**
     * Show apps on desktop
     * Show apps on desktop
     */
     */
    WindowContainerTransaction showDesktopApps() {
    void showDesktopApps() {
        WindowContainerTransaction wct = bringDesktopAppsToFront();

        if (Transitions.ENABLE_SHELL_TRANSITIONS) {
            mTransitions.startTransition(TRANSIT_TO_FRONT, wct, null /* handler */);
        } else {
            mShellTaskOrganizer.applyTransaction(wct);
        }
    }

    @NonNull
    private WindowContainerTransaction bringDesktopAppsToFront() {
        ArraySet<Integer> activeTasks = mDesktopModeTaskRepository.getActiveTasks();
        ArraySet<Integer> activeTasks = mDesktopModeTaskRepository.getActiveTasks();
        ProtoLog.d(WM_SHELL_DESKTOP_MODE, "bringDesktopAppsToFront: tasks=%s", activeTasks.size());
        ProtoLog.d(WM_SHELL_DESKTOP_MODE, "bringDesktopAppsToFront: tasks=%s", activeTasks.size());
        ArrayList<RunningTaskInfo> taskInfos = new ArrayList<>();
        ArrayList<RunningTaskInfo> taskInfos = new ArrayList<>();
@@ -197,11 +209,6 @@ public class DesktopModeController implements RemoteCallable<DesktopModeControll
        for (RunningTaskInfo task : taskInfos) {
        for (RunningTaskInfo task : taskInfos) {
            wct.reorder(task.token, true);
            wct.reorder(task.token, true);
        }
        }

        if (!Transitions.ENABLE_SHELL_TRANSITIONS) {
            mShellTaskOrganizer.applyTransaction(wct);
        }

        return wct;
        return wct;
    }
    }


@@ -259,7 +266,7 @@ public class DesktopModeController implements RemoteCallable<DesktopModeControll
        if (wct == null) {
        if (wct == null) {
            wct = new WindowContainerTransaction();
            wct = new WindowContainerTransaction();
        }
        }
        wct.merge(showDesktopApps(), true /* transfer */);
        wct.merge(bringDesktopAppsToFront(), true /* transfer */);
        wct.reorder(request.getTriggerTask().token, true /* onTop */);
        wct.reorder(request.getTriggerTask().token, true /* onTop */);


        return wct;
        return wct;