Fix issue with out of order callbacks

- If any call to finish the recents animation comes in before
  onRecentsAnimationStarted, we'll clear the callbacks but the listener
  registered in startRecentsAnimation will persist.  Since the call
  to actually finish the animation with the system is posted on the
  main thread, if the animation started callback returns in that time,
  the controller will be set (via the listener) but the callbacks will
  be unset.  Instead, we can clear all the listeners from the previous
  callbacks when cleaning up the animation.

Bug: 145758818
Change-Id: I29dab94f5fb25f762a823d59ef318a361282b595
This commit is contained in:
Winson Chung
2020-02-13 16:04:11 -08:00
parent 8cba1bc488
commit b53573d651
2 changed files with 9 additions and 3 deletions

View File

@@ -62,6 +62,12 @@ public class RecentsAnimationCallbacks implements
mListeners.remove(listener);
}
@UiThread
public void removeAllListeners() {
Preconditions.assertUIThread();
mListeners.clear();
}
public void notifyAnimationCanceled() {
mCancelled = true;
onAnimationCanceled(null);