Loading core/java/android/animation/AnimatorSet.java +3 −2 Original line number Diff line number Diff line Loading @@ -1311,8 +1311,9 @@ public final class AnimatorSet extends Animator implements AnimationHandler.Anim if (!node.mEnded) { float durationScale = ValueAnimator.getDurationScale(); durationScale = durationScale == 0 ? 1 : durationScale; node.mEnded = node.mAnimation.pulseAnimationFrame( (long) (animPlayTime * durationScale)); if (node.mAnimation.pulseAnimationFrame((long) (animPlayTime * durationScale))) { node.mEnded = true; } } } Loading core/tests/coretests/src/android/animation/AnimatorSetCallsTest.java +15 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.animation; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import android.util.PollingCheck; Loading Loading @@ -342,6 +343,20 @@ public class AnimatorSetCallsTest { }); } @Test public void childAnimatorCancelsDuringUpdate_animatorSetIsEnded() throws Throwable { mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { animation.cancel(); } }); mActivity.runOnUiThread(() -> { mSet1.start(); assertFalse(mSet1.isRunning()); }); } @Test public void reentrantStart() throws Throwable { CountDownLatch latch = new CountDownLatch(3); Loading Loading
core/java/android/animation/AnimatorSet.java +3 −2 Original line number Diff line number Diff line Loading @@ -1311,8 +1311,9 @@ public final class AnimatorSet extends Animator implements AnimationHandler.Anim if (!node.mEnded) { float durationScale = ValueAnimator.getDurationScale(); durationScale = durationScale == 0 ? 1 : durationScale; node.mEnded = node.mAnimation.pulseAnimationFrame( (long) (animPlayTime * durationScale)); if (node.mAnimation.pulseAnimationFrame((long) (animPlayTime * durationScale))) { node.mEnded = true; } } } Loading
core/tests/coretests/src/android/animation/AnimatorSetCallsTest.java +15 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.animation; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import android.util.PollingCheck; Loading Loading @@ -342,6 +343,20 @@ public class AnimatorSetCallsTest { }); } @Test public void childAnimatorCancelsDuringUpdate_animatorSetIsEnded() throws Throwable { mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { animation.cancel(); } }); mActivity.runOnUiThread(() -> { mSet1.start(); assertFalse(mSet1.isRunning()); }); } @Test public void reentrantStart() throws Throwable { CountDownLatch latch = new CountDownLatch(3); Loading