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

Commit 605e8aba authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Run animation end callback directly for zero duration or requested end

The use case may want to go end state directly without animation effect,
so it is unnecessary to defer the end callback.

Bug: 300035126
Flag: com.android.window.flags.system_ui_post_animation_end
Test: atest SystemUITests:AuthContainerViewTest
      (AuthContainerView(mSkipAnimation=true))
Test: atest SystemUITests:DialogTransitionAnimatorTest
      (fakeDialogTransitionAnimator > fakeTransitionAnimator)
Change-Id: I3605c2bb3647dffc09d9e93dd7ddc75f04a2d347
parent 70964774
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1227,7 +1227,7 @@ public final class AnimatorSet extends Animator implements AnimationHandler.Anim
        }

        if (finished) {
            endAnimation();
            endAnimation(true /* fromLastFrame */);
            return true;
        }
        return false;
@@ -1442,8 +1442,12 @@ public final class AnimatorSet extends Animator implements AnimationHandler.Anim
    }

    private void endAnimation() {
        endAnimation(false /* fromLastFrame */);
    }

    private void endAnimation(boolean fromLastFrame) {
        final boolean postNotifyEndListener = sPostNotifyEndListenerEnabled && mListeners != null
                && mLastFrameTime > 0;
                && fromLastFrame && mTotalDuration > 0;
        mStarted = false;
        mLastFrameTime = -1;
        mFirstFrame = -1;
+7 −3
Original line number Diff line number Diff line
@@ -1281,16 +1281,20 @@ public class ValueAnimator extends Animator implements AnimationHandler.Animatio
        return true;
    }

    private void endAnimation() {
        endAnimation(false /* fromLastFrame */);
    }

    /**
     * Called internally to end an animation by removing it from the animations list. Must be
     * called on the UI thread.
     */
    private void endAnimation() {
    private void endAnimation(boolean fromLastFrame) {
        if (mAnimationEndRequested) {
            return;
        }
        final boolean postNotifyEndListener = sPostNotifyEndListenerEnabled && mListeners != null
                && mLastFrameTime > 0;
                && fromLastFrame && getScaledDuration() > 0;
        removeAnimationCallback();

        mAnimationEndRequested = true;
@@ -1570,7 +1574,7 @@ public class ValueAnimator extends Animator implements AnimationHandler.Animatio
        boolean finished = animateBasedOnTime(currentTime);

        if (finished) {
            endAnimation();
            endAnimation(true /* fromLastFrame */);
        }
        return finished;
    }