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

Commit 75e7c2fc authored by Omar Elmekkawy's avatar Omar Elmekkawy Committed by Android (Google) Code Review
Browse files

Merge "Bring both tiled tasks to front when exploded view tiled task is picked." into main

parents aa3ec79b d05fae8c
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -5177,7 +5177,6 @@ class DesktopTasksController(
                    userId = userId,
                    userId = userId,
                    enterReason = enterReason,
                    enterReason = enterReason,
                )
                )

            // Put task with [taskIdToReorderToFront] to front.
            // Put task with [taskIdToReorderToFront] to front.
            when (newTaskInFront) {
            when (newTaskInFront) {
                is RunningTaskInfo -> {
                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 transitionType = transitionType(remoteTransition)
            val handler =
            val handler =
                remoteTransition?.let {
                remoteTransition?.let {
@@ -5209,7 +5214,6 @@ class DesktopTasksController(
            val transition = transitions.startTransition(transitionType, wct, handler)
            val transition = transitions.startTransition(transitionType, wct, handler)
            handler?.setTransition(transition)
            handler?.setTransition(transition)
            runOnTransitStart?.invoke(transition)
            runOnTransitStart?.invoke(transition)

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


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

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


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

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


+14 −0
Original line number Original line 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.sysui.ShellController
import com.android.wm.shell.transition.FocusTransitionObserver
import com.android.wm.shell.transition.FocusTransitionObserver
import com.android.wm.shell.transition.Transitions
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_MINIMIZE
import com.android.wm.shell.transition.Transitions.TRANSIT_START_RECENTS_TRANSITION
import com.android.wm.shell.transition.Transitions.TRANSIT_START_RECENTS_TRANSITION
import com.android.wm.shell.windowdecor.DragPositioningCallbackUtility
import com.android.wm.shell.windowdecor.DragPositioningCallbackUtility
@@ -118,6 +119,8 @@ class DesktopTilingWindowDecoration(


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

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

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


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


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

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


    /** Notifies the snap event handler of a desk being removed. */
    /** Notifies the snap event handler of a desk being removed. */
    fun onDeskRemoved(deskId: Int)
    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