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

Commit 9f436dfe authored by Tony Wickham's avatar Tony Wickham
Browse files

Ensure taskbar animation ends when running window animation does

- Store the possible parallel animation to cancel/end in
  AbsSwipeUpHandler#endRunningWindowAnim()

Test: 1. remove taskbar during transition, ensure cleaned up properly
2. open a second app during transition to home, ensure taskbar
maintains correct visibility
Bug: 182512211

Change-Id: I71a6b6ce624113d43ad5a599cb5cfec28a555310
parent 2e0eee4d
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -217,6 +217,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,

    // Either RectFSpringAnim (if animating home) or ObjectAnimator (from mCurrentShift) otherwise
    private RunningWindowAnim mRunningWindowAnim;
    // Possible second animation running at the same time as mRunningWindowAnim
    private Animator mParallelRunningAnim;
    private boolean mIsMotionPaused;
    private boolean mHasMotionEverBeenPaused;

@@ -798,6 +800,13 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
                mRunningWindowAnim.end();
            }
        }
        if (mParallelRunningAnim != null) {
            if (cancel) {
                mParallelRunningAnim.cancel();
            } else {
                mParallelRunningAnim.end();
            }
        }
    }

    private void onSettledOnEndTarget() {
@@ -1060,7 +1069,11 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
            ActivityManagerWrapper.getInstance().registerTaskStackListener(
                    mActivityRestartListener);

            mActivityInterface.onAnimateToLauncher(mGestureState.getEndTarget(), duration);
            mParallelRunningAnim = mActivityInterface.getParallelAnimationToLauncher(
                    mGestureState.getEndTarget(), duration);
            if (mParallelRunningAnim != null) {
                mParallelRunningAnim.start();
            }
        }

        if (mGestureState.getEndTarget() == HOME) {
+3 −1
Original line number Diff line number Diff line
@@ -347,7 +347,9 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
     * Called when the gesture ends and the animation starts towards the given target. No-op by
     * default, but subclasses can override to add an additional animation with the same duration.
     */
    public void onAnimateToLauncher(GestureState.GestureEndTarget endTarget, long duration) {
    public @Nullable Animator getParallelAnimationToLauncher(
            GestureState.GestureEndTarget endTarget, long duration) {
        return null;
    }

    /**
+5 −3
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static com.android.launcher3.LauncherState.QUICK_SWITCH;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SHOWING;

import android.animation.Animator;
import android.content.Context;
import android.graphics.Rect;
import android.view.MotionEvent;
@@ -267,13 +268,14 @@ public final class LauncherActivityInterface extends
    }

    @Override
    public void onAnimateToLauncher(GestureEndTarget endTarget, long duration) {
    public @Nullable Animator getParallelAnimationToLauncher(GestureEndTarget endTarget,
            long duration) {
        TaskbarController taskbarController = getTaskbarController();
        if (taskbarController == null) {
            return;
            return null;
        }
        LauncherState toState = stateFromGestureEndTarget(endTarget);
        taskbarController.createAnimToLauncher(toState, duration).start();
        return taskbarController.createAnimToLauncher(toState, duration);
    }

    @Override