Merge "Ensure taskbar animation ends when running window animation does" into sc-dev

This commit is contained in:
Tony Wickham
2021-04-06 19:35:38 +00:00
committed by Android (Google) Code Review
3 changed files with 22 additions and 5 deletions
@@ -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) {
@@ -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;
}
/**
@@ -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