diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java index 482348fb32..345a147ca5 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java @@ -917,6 +917,12 @@ public class LauncherSwipeHandler windowAnim.addAnimatorListener(new AnimationSuccessListener() { @Override public void onAnimationSuccess(Animator animator) { + if (mRecentsAnimationController == null) { + // If the recents animation is interrupted, we still end the running + // animation (not canceled) so this is still called. In that case, we can + // skip doing any future work here for the current gesture. + return; + } // Finalize the state and notify of the change mGestureState.setState(STATE_END_TARGET_ANIMATION_FINISHED); } @@ -938,6 +944,12 @@ public class LauncherSwipeHandler windowAnim.addListener(new AnimationSuccessListener() { @Override public void onAnimationSuccess(Animator animator) { + if (mRecentsAnimationController == null) { + // If the recents animation is interrupted, we still end the running + // animation (not canceled) so this is still called. In that case, we can + // skip doing any future work here for the current gesture. + return; + } if (target == NEW_TASK && mRecentsView != null && mRecentsView.getNextPage() == mRecentsView.getRunningTaskIndex()) { // We are about to launch the current running task, so use LAST_TASK state