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

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

Desks: Check desks exists before attempting to activate it

Sanitize desk-activation requests from Launcher to avoid a SysUI crash
if an unknown desk id is supplied.

Flag: com.android.window.flags.enable_multiple_desktops_backend
Fix: 416166930
Test: atest WMShellUnitTests
Change-Id: I20da7ab70c7a57932acb7e3e9930e7a46bbf7318
parent b5aff7b0
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -3783,6 +3783,20 @@ class DesktopTasksController(
        remoteTransition: RemoteTransition? = null,
        taskIdToReorderToFront: Int? = null,
    ) {
        logD(
            "activateDesk deskId=%d taskIdToReorderToFront=%d remoteTransition=%s",
            deskId,
            taskIdToReorderToFront,
            remoteTransition,
        )
        if (!taskRepository.getAllDeskIds().contains(deskId)) {
            logW(
                "Request to activate desk=%d but desk not found for user=%d",
                deskId,
                taskRepository.userId,
            )
            return
        }
        if (
            taskIdToReorderToFront != null &&
                taskRepository.getDeskIdForTask(taskIdToReorderToFront) != deskId