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

Commit 75346f3b authored by Jorge Gil's avatar Jorge Gil Committed by Android (Google) Code Review
Browse files

Merge "Prevent task from exiting immersive twice on close" into main

parents 54325903 883b4082
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ class DesktopFullImmersiveTransitionHandler(

    /** Whether there is an immersive transition that hasn't completed yet. */
    private val inProgress: Boolean
        get() = state != null
        get() = state != null || pendingExternalExitTransitions.isNotEmpty()

    private val rectEvaluator = RectEvaluator()

+2 −2
Original line number Diff line number Diff line
@@ -58,9 +58,9 @@ class DesktopMixedTransitionHandler(
        freeformTaskTransitionHandler.startMinimizedModeTransition(wct)

    /** Starts close transition and handles or delegates desktop task close animation. */
    override fun startRemoveTransition(wct: WindowContainerTransaction?) {
    override fun startRemoveTransition(wct: WindowContainerTransaction?): IBinder {
        requireNotNull(wct)
        transitions.startTransition(WindowManager.TRANSIT_CLOSE, wct, /* handler= */ this)
        return transitions.startTransition(WindowManager.TRANSIT_CLOSE, wct, /* handler= */ this)
    }

    /** Returns null, as it only handles transitions started from Shell. */
+7 −1
Original line number Diff line number Diff line
@@ -461,7 +461,12 @@ class DesktopTasksController(
     * @param displayId display id of the window that's being closed
     * @param taskId task id of the window that's being closed
     */
    fun onDesktopWindowClose(wct: WindowContainerTransaction, displayId: Int, taskId: Int) {
    fun onDesktopWindowClose(
        wct: WindowContainerTransaction,
        displayId: Int,
        taskInfo: RunningTaskInfo,
    ): ((IBinder) -> Unit)? {
        val taskId = taskInfo.taskId
        if (taskRepository.isOnlyVisibleNonClosingTask(taskId)) {
            removeWallpaperActivity(wct)
        }
@@ -472,6 +477,7 @@ class DesktopTasksController(
                taskId
            )
        )
        return immersiveTransitionHandler.exitImmersiveIfApplicable(wct, taskInfo)
    }

    fun minimizeTask(taskInfo: RunningTaskInfo) {
+5 −4
Original line number Diff line number Diff line
@@ -99,9 +99,11 @@ public class FreeformTaskTransitionHandler


    @Override
    public void startRemoveTransition(WindowContainerTransaction wct) {
    public IBinder startRemoveTransition(WindowContainerTransaction wct) {
        final int type = WindowManager.TRANSIT_CLOSE;
        mPendingTransitionTokens.add(mTransitions.startTransition(type, wct, this));
        final IBinder transition = mTransitions.startTransition(type, wct, this);
        mPendingTransitionTokens.add(transition);
        return transition;
    }

    @Override
@@ -229,8 +231,7 @@ public class FreeformTaskTransitionHandler
        SurfaceControl.Transaction t = new SurfaceControl.Transaction();
        SurfaceControl sc = change.getLeash();
        finishT.hide(sc);
        Rect startBounds = new Rect(change.getTaskInfo().configuration.windowConfiguration
                .getBounds());
        final Rect startBounds = new Rect(change.getStartAbsBounds());
        animator.addUpdateListener(animation -> {
            t.setPosition(sc, startBounds.left,
                    startBounds.top + (animation.getAnimatedFraction() * screenHeight));
+2 −1
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ public interface FreeformTaskTransitionStarter {
     *
     * @param wct the {@link WindowContainerTransaction} that closes the task
     *
     * @return the started transition
     */
    void startRemoveTransition(WindowContainerTransaction wct);
    IBinder startRemoveTransition(WindowContainerTransaction wct);
}
 No newline at end of file
Loading