Skip to content
Snippets Groups Projects
Commit c2076853 authored by Paul Sowden's avatar Paul Sowden Committed by Gerrit Code Review
Browse files

Merge "Only set `mEnded` to true if `pulseAnimationFrame` returns true" into main

parents 322a4767 a172b3f1
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
}
}
......
......@@ -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;
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment