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

Commit 4a1ea9ba authored by Doris Liu's avatar Doris Liu Committed by android-build-merger
Browse files

Support calling start() in onAnimationFinished(...) in AVD

am: 679fe6ab

Change-Id: I2999f6fc543f56d73cd03fe74b466c033d6c7d1a
parents 180ebf16 679fe6ab
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -46,8 +46,17 @@ PropertyValuesAnimatorSet::PropertyValuesAnimatorSet()

void PropertyValuesAnimatorSet::onFinished(BaseRenderNodeAnimator* animator) {
    if (mOneShotListener.get()) {
        mOneShotListener->onAnimationFinished(animator);
        sp<AnimationListener> listener = std::move(mOneShotListener);
        // Set the listener to nullptr before the onAnimationFinished callback, rather than after,
        // for two reasons:
        // 1) We need to prevent changes to mOneShotListener during the onAnimationFinished
        // callback (specifically in AnimationListenerBridge::onAnimationFinished(...) from
        // triggering dtor of the bridge and potentially unsafely re-entering
        // AnimationListenerBridge::onAnimationFinished(...).
        // 2) It's possible that there are changes to the listener during the callback, therefore
        // we need to reset the listener before the callback rather than afterwards.
        mOneShotListener = nullptr;
        listener->onAnimationFinished(animator);
    }
}