From 8cba1bc488a32e07b9cb83d6fa40d458bfa8d4c3 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Thu, 13 Feb 2020 15:36:16 -0800 Subject: [PATCH] Skip setting end target if the recents animation was canceled or ended Bug: 147249069 Change-Id: Ie13db509466776873df383eef599c11c5cd32ab2 --- .../com/android/quickstep/LauncherSwipeHandler.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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