Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a4e35ce8 authored by Vadim Caen's avatar Vadim Caen Committed by Android (Google) Code Review
Browse files

Merge "Check nullity of finished callback"

parents b74b62d5 9745f975
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ class SurfaceAnimator {
    final Animatable mAnimatable;
    private final OnAnimationFinishedCallback mInnerAnimationFinishedCallback;
    @VisibleForTesting
    @Nullable
    final Runnable mAnimationFinishedCallback;
    private boolean mAnimationStartDelayed;

@@ -262,7 +263,7 @@ class SurfaceAnimator {
            if (!mAnimationStartDelayed && forwardCancel) {
                animation.onAnimationCancelled(leash);
            }
            if (!restarting) {
            if (!restarting && mAnimationFinishedCallback != null) {
                mAnimationFinishedCallback.run();
            }
        }
+13 −0
Original line number Diff line number Diff line
@@ -137,6 +137,19 @@ public class SurfaceAnimatorTest extends WindowTestsBase {
        verify(mTransaction).remove(eq(mAnimatable.mLeash));
    }

    @Test
    public void testCancelWithNullFinishCallbackAnimation() {
        SurfaceAnimator animator = new SurfaceAnimator(mAnimatable, null, mWm);
        animator.startAnimation(mTransaction, mSpec, true /* hidden */);
        assertTrue(animator.isAnimating());
        assertNotNull(animator.getAnimation());
        animator.cancelAnimation();
        assertFalse(animator.isAnimating());
        assertNull(animator.getAnimation());
        verify(mSpec).onAnimationCancelled(any());
        verify(mTransaction).remove(eq(mAnimatable.mLeash));
    }

    @Test
    public void testDelayingAnimationStart() {
        mAnimatable.mSurfaceAnimator.startDelayingAnimationStart();