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

Commit 3088c286 authored by Ahmed Fakhry's avatar Ahmed Fakhry Committed by Android (Google) Code Review
Browse files

Merge "Add desk removal APIs to `IDesktopMode`." into main

parents 0f3b1103 0e66c46e
Loading
Loading
Loading
Loading
+19 −2
Original line number Diff line number Diff line
@@ -2943,6 +2943,11 @@ class DesktopTasksController(
        removeDesk(displayId = displayId, deskId = deskId)
    }

    /** Removes all the available desks on all displays. */
    fun removeAllDesks() {
        taskRepository.getAllDeskIds().forEach { deskId -> removeDesk(deskId) }
    }

    private fun removeDesk(displayId: Int, deskId: Int) {
        if (!DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_BACK_NAVIGATION.isTrue()) return
        logV("removeDesk deskId=%d from displayId=%d", deskId, displayId)
@@ -3709,6 +3714,18 @@ class DesktopTasksController(
            }
        }

        override fun removeDesk(deskId: Int) {
            executeRemoteCallWithTaskPermission(controller, "removeDesk") { c ->
                c.removeDesk(deskId)
            }
        }

        override fun removeAllDesks() {
            executeRemoteCallWithTaskPermission(controller, "removeAllDesks") { c ->
                c.removeAllDesks()
            }
        }

        override fun activateDesk(deskId: Int, remoteTransition: RemoteTransition?) {
            executeRemoteCallWithTaskPermission(controller, "activateDesk") { c ->
                c.activateDesk(deskId, remoteTransition)
@@ -3772,8 +3789,8 @@ class DesktopTasksController(
            }
        }

        override fun removeDesktop(displayId: Int) {
            executeRemoteCallWithTaskPermission(controller, "removeDesktop") { c ->
        override fun removeDefaultDeskInDisplay(displayId: Int) {
            executeRemoteCallWithTaskPermission(controller, "removeDefaultDeskInDisplay") { c ->
                c.removeDefaultDeskInDisplay(displayId)
            }
        }
+11 −2
Original line number Diff line number Diff line
@@ -35,6 +35,12 @@ interface IDesktopMode {
    /** Activates the desk whose ID is `deskId` on whatever display it currently exists on. */
    oneway void activateDesk(int deskId, in RemoteTransition remoteTransition);

    /** Removes the desk with the given `deskId`. */
    oneway void removeDesk(int deskId);

    /** Removes all the available desks on all displays. */
    oneway void removeAllDesks();

    /** Show apps on the desktop on the given display */
    void showDesktopApps(int displayId, in RemoteTransition remoteTransition);

@@ -64,8 +70,11 @@ interface IDesktopMode {
                        in @nullable RemoteTransition remoteTransition,
                        in @nullable IMoveToDesktopCallback callback);

    /** Remove desktop on the given display */
    oneway void removeDesktop(int displayId);
    /**
     * Removes the default desktop on the given display.
     * @deprecated with multi-desks, we should use `removeDesk()`.
     */
    oneway void removeDefaultDeskInDisplay(int displayId);

    /** Move a task with given `taskId` to external display */
    void moveToExternalDisplay(int taskId);