From 63517a7a0721a5b3c176f9a80a78a2e19827dd26 Mon Sep 17 00:00:00 2001 From: Kevin Date: Thu, 9 May 2019 16:01:01 -0700 Subject: [PATCH] Fix anim done callback not being called sometimes We should call dispatchFinishedWhenDone in endAnimations instead of calling dispatchAnimationsFinished as the former will run the listener. However, we only do this if we were running animations in the first place. Bug: 132285006 Test: Build and manual test endAnimations() call Change-Id: I31afdc4c9e3ef5f56eda6178569d5c264c16ae78 --- .../src/com/android/quickstep/ContentFillItemAnimator.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/go/quickstep/src/com/android/quickstep/ContentFillItemAnimator.java b/go/quickstep/src/com/android/quickstep/ContentFillItemAnimator.java index 87ae6955e6..9b4ab8e30e 100644 --- a/go/quickstep/src/com/android/quickstep/ContentFillItemAnimator.java +++ b/go/quickstep/src/com/android/quickstep/ContentFillItemAnimator.java @@ -235,6 +235,9 @@ public final class ContentFillItemAnimator extends SimpleItemAnimator { @Override public void endAnimations() { + if (!isRunning()) { + return; + } for (int i = mPendingAnims.size() - 1; i >= 0; i--) { PendingAnimation pendAnim = mPendingAnims.get(i); ViewHolder item = pendAnim.viewHolder; @@ -254,7 +257,7 @@ public final class ContentFillItemAnimator extends SimpleItemAnimator { ObjectAnimator anim = mRunningAnims.get(i); anim.end(); } - dispatchAnimationsFinished(); + dispatchFinishedWhenDone(); } @Override