From af7c86ada5ce013fd6172095b571a119cb899744 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Wed, 12 May 2021 20:33:13 -0700 Subject: [PATCH] Skip setting up ui if the handler is already invalidated - Also unregister the task stack listener in case the restart message comes in right before the animation is finished Bug: 186760990 Test: Swipe up/quickswitch repeatedly Change-Id: I5af7a26f05e7c15e099d6666e4662fd1af9aa861 --- quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java | 3 +++ .../src/com/android/quickstep/TaskAnimationManager.java | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index d04bfe95e2..bc98dabdd9 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -1518,6 +1518,9 @@ public abstract class AbsSwipeUpHandler, protected abstract void finishRecentsControllerToHome(Runnable callback); private void setupLauncherUiAfterSwipeUpToRecentsAnimation() { + if (mStateCallback.hasStates(STATE_HANDLER_INVALIDATED)) { + return; + } endLauncherTransitionController(); mActivityInterface.onSwipeUpToRecentsComplete(); mRecentsView.onSwipeUpAnimationSuccess(); diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java index 44a3e95744..e90a1ab7b1 100644 --- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java +++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java @@ -57,6 +57,11 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn @Override public void onActivityRestartAttempt(ActivityManager.RunningTaskInfo task, boolean homeTaskVisible, boolean clearedTask, boolean wasVisible) { + if (mLastGestureState == null) { + ActivityManagerWrapper.getInstance().unregisterTaskStackListener( + mLiveTileRestartListener); + return; + } BaseActivityInterface activityInterface = mLastGestureState.getActivityInterface(); if (LIVE_TILE.get() && activityInterface.isInLiveTileMode() && activityInterface.getCreatedActivity() != null) {