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

Commit d05fae8c authored by Omar Elmekkawy's avatar Omar Elmekkawy
Browse files

Bring both tiled tasks to front when exploded view tiled task is picked.

Flag: com.android.window.flags.enable_tile_resizing
Test: on device testing and unit tests.
Bug: 441604731
Change-Id: Ie6494c403f516171f5ee0a991fff6d78e939627e
parent 5ea5c7e5
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -5177,7 +5177,6 @@ class DesktopTasksController(
                    userId = userId,
                    enterReason = enterReason,
                )

            // Put task with [taskIdToReorderToFront] to front.
            when (newTaskInFront) {
                is RunningTaskInfo -> {
@@ -5200,6 +5199,12 @@ class DesktopTasksController(
                }
            }

            // Exploded view is where tasks are exploded within a desktop on entering recents,
            // so if the user selects a tiled task to be in front, tiling should handle this
            // to bring all tiled tasks to front.
            if (taskIdToReorderToFront != INVALID_TASK_ID && taskIdToReorderToFront != null) {
                snapEventHandler.notifyTilingOfExplodedViewReorder(deskId, taskIdToReorderToFront)
            }
            val transitionType = transitionType(remoteTransition)
            val handler =
                remoteTransition?.let {
@@ -5209,7 +5214,6 @@ class DesktopTasksController(
            val transition = transitions.startTransition(transitionType, wct, handler)
            handler?.setTransition(transition)
            runOnTransitStart?.invoke(transition)

            // Replaced by |IDesktopTaskListener#onActiveDeskChanged|.
            if (!desktopState.enableMultipleDesktops) {
                desktopModeEnterExitTransitionListener?.onEnterDesktopModeTransitionStarted(
+5 −0
Original line number Diff line number Diff line
@@ -1049,6 +1049,11 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
                currentDragBounds);
    }

    @Override
    public void notifyTilingOfExplodedViewReorder(int deskId, int topTaskId) {
        mDesktopTilingDecorViewModel.onExplodedViewReorder(deskId, topTaskId);
    }

    @Override
    public void onDeskActivated(int deskId, int displayId) {
        if (mDesktopTilingDecorViewModel.tilingDeskActive(deskId)) {
+4 −0
Original line number Diff line number Diff line
@@ -266,6 +266,10 @@ class DesktopTilingDecorViewModel(
        tilingHandlerByUserAndDeskId[currentUserId]?.remove(deskId)
    }

    fun onExplodedViewReorder(deskId: Int, topTaskId: Int) {
        tilingHandlerByUserAndDeskId[currentUserId]?.get(deskId)?.onExplodedViewReorder(topTaskId)
    }

    fun getCurrentActiveDeskForDisplay(displayId: Int): Int? =
        desktopUserRepositories.current.getActiveDeskId(displayId)

+14 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ import com.android.wm.shell.shared.desktopmode.DesktopState
import com.android.wm.shell.sysui.ShellController
import com.android.wm.shell.transition.FocusTransitionObserver
import com.android.wm.shell.transition.Transitions
import com.android.wm.shell.transition.Transitions.TRANSIT_END_RECENTS_TRANSITION
import com.android.wm.shell.transition.Transitions.TRANSIT_MINIMIZE
import com.android.wm.shell.transition.Transitions.TRANSIT_START_RECENTS_TRANSITION
import com.android.wm.shell.windowdecor.DragPositioningCallbackUtility
@@ -118,6 +119,8 @@ class DesktopTilingWindowDecoration(

    var leftTaskResizingHelper: AppResizingHelper? = null
    var rightTaskResizingHelper: AppResizingHelper? = null

    var explodedViewTopTaskId: Int? = null
    @VisibleForTesting var isTilingManagerInitialised = false
    @VisibleForTesting
    var desktopTilingDividerWindowManager: DesktopTilingDividerWindowManager? = null
@@ -518,6 +521,13 @@ class DesktopTilingWindowDecoration(
            desktopTilingDividerWindowManager?.showDividerBar(hiddenByOverviewAnimation)
            hiddenByOverviewAnimation = false
        }

        if (info.type == TRANSIT_END_RECENTS_TRANSITION) {
            explodedViewTopTaskId?.let {
                moveTiledPairToFront(taskId = it, isFocusedOnDisplay = true)
            }
            explodedViewTopTaskId = null
        }
    }

    private fun handleTaskBroughtToFront(taskId: Int) {
@@ -721,6 +731,10 @@ class DesktopTilingWindowDecoration(
        }
    }

    fun onExplodedViewReorder(topTaskId: Int) {
        explodedViewTopTaskId = topTaskId
    }

    fun resetTilingSession(shouldPersistTilingData: Boolean = false) {
        logD("Resetting tiling session.")
        if (leftTaskResizingHelper != null) {
+3 −0
Original line number Diff line number Diff line
@@ -71,4 +71,7 @@ interface SnapEventHandler {

    /** Notifies the snap event handler of a desk being removed. */
    fun onDeskRemoved(deskId: Int)

    /** Notifies tiling of an exploded view reorder to prepare the tiling view for the event. */
    fun notifyTilingOfExplodedViewReorder(deskId: Int, topTaskId: Int)
}
Loading