From a6616dec286e2f70b6136aa8f03443157d5e21ea Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 4 May 2018 10:09:41 -0700 Subject: [PATCH] Fixing stateManager not correctly deduping existing animations Bug: 79251716 Change-Id: I40c3ebf0ec4d49aa1fe1948ad3d83eb87cc1c5f1 --- src/com/android/launcher3/LauncherStateManager.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java index 7f25301ac6..1b9ac21511 100644 --- a/src/com/android/launcher3/LauncherStateManager.java +++ b/src/com/android/launcher3/LauncherStateManager.java @@ -374,7 +374,18 @@ public class LauncherStateManager { */ public void setCurrentAnimation(AnimatorSet anim, Animator... childAnimations) { for (Animator childAnim : childAnimations) { - if (childAnim != null && mConfig.mCurrentAnimation == childAnim) { + if (childAnim == null) { + continue; + } + if (mConfig.playbackController != null + && mConfig.playbackController.getTarget() == childAnim) { + if (mConfig.mCurrentAnimation != null) { + mConfig.mCurrentAnimation.removeListener(mConfig); + mConfig.mCurrentAnimation = null; + } + mConfig.playbackController = null; + break; + } else if (mConfig.mCurrentAnimation == childAnim) { mConfig.mCurrentAnimation.removeListener(mConfig); mConfig.mCurrentAnimation = null; break;