From aeb283f9f66300b78b3d406bf0f38eaad827b332 Mon Sep 17 00:00:00 2001 From: wilsonshih Date: Mon, 25 Oct 2021 20:40:13 +0800 Subject: [PATCH] Prevent receive extra callbacks from AnimatorListener. There will receive another onAnimationStart/onAnimationEnd callback when calling ValueAnimator#end if the animation is not running, which is not necessary if the animation was finished already. Bug: 195736656 Test: atest SplashscreenTests Change-Id: Ifbbf2f799e3e69624626b16e08f40b562fe483a8 --- .../shell/startingsurface/SplashscreenIconDrawableFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenIconDrawableFactory.java b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenIconDrawableFactory.java index 38122ffc032b5..e2a72bdc872a1 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenIconDrawableFactory.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenIconDrawableFactory.java @@ -314,7 +314,7 @@ public class SplashscreenIconDrawableFactory { @Override public void stopAnimation() { - if (mIconAnimator != null) { + if (mIconAnimator != null && mIconAnimator.isRunning()) { mIconAnimator.end(); } }