Ensure behavior consistency for 0 duration scale
BUG: 35590176
Test: cts in the same topic branch
Change-Id: Ia0a2518a1376d3f82ee6c5a7b27e3cb24ed54cbf
(cherry picked from commit 21ba77f6b6c037e9507e210e22c18614fa9d2e9b)
diff --git a/core/java/android/animation/AnimatorSet.java b/core/java/android/animation/AnimatorSet.java
index fca26f8..86adbb0 100644
--- a/core/java/android/animation/AnimatorSet.java
+++ b/core/java/android/animation/AnimatorSet.java
@@ -714,8 +714,8 @@
mReversing = inReverse;
// Now that all dependencies are set up, start the animations that should be started.
- boolean isZeroDuration = ValueAnimator.getDurationScale() == 0f || isEmptySet(this);
- if (!isZeroDuration) {
+ boolean isEmptySet = isEmptySet(this);
+ if (!isEmptySet) {
startAnimation();
}
@@ -727,7 +727,7 @@
tmpListeners.get(i).onAnimationStart(this, inReverse);
}
}
- if (isZeroDuration) {
+ if (isEmptySet) {
// In the case of empty AnimatorSet, or 0 duration scale, we will trigger the
// onAnimationEnd() right away.
forceToEnd();
@@ -979,7 +979,7 @@
public boolean doAnimationFrame(long frameTime) {
float durationScale = ValueAnimator.getDurationScale();
if (durationScale == 0f) {
- // Duration scale changed to 0 amid animation, end the animation right away.
+ // Duration scale is 0, end the animation right away.
forceToEnd();
return true;
}