diff options
author | Doris Liu <tianliu@google.com> | 2016-02-19 17:19:24 -0800 |
---|---|---|
committer | Doris Liu <tianliu@google.com> | 2016-02-19 17:19:24 -0800 |
commit | 148f57fc267b3b0121ff66e4ec4f1798f5b67d52 (patch) | |
tree | f428fa6b88979fb7e738b7364919caac7f165337 /libs/hwui/Animator.cpp | |
parent | c21e8bcb013a6a562aa6288143368d9dba80fef4 (diff) |
Ensure animator's interpolator is set
Animator's play state can go from NotStarted to Finished directly
in the case of calling start() and end() within one frame. Previously
we only set animator's interpolator when the animator is transitioning
to Running state. So when Running state is skipped, the interpolator
is left unset.
Bug: 27224373
Change-Id: I5a53106fe1aae38ccaf1df8debd553be3bc56133
Diffstat (limited to 'libs/hwui/Animator.cpp')
-rw-r--r-- | libs/hwui/Animator.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libs/hwui/Animator.cpp b/libs/hwui/Animator.cpp index 294edb6ecd46..bd71e0d579f8 100644 --- a/libs/hwui/Animator.cpp +++ b/libs/hwui/Animator.cpp @@ -160,6 +160,10 @@ void BaseRenderNodeAnimator::pushStaging(AnimationContext& context) { } if (!mStagingRequests.empty()) { + // No interpolator was set, use the default + if (mPlayState == PlayState::NotStarted && !mInterpolator) { + mInterpolator.reset(Interpolator::createDefaultInterpolator()); + } // Keep track of the play state and play time before they are changed when // staging requests are resolved. nsecs_t currentPlayTime = mPlayTime; @@ -222,10 +226,6 @@ void BaseRenderNodeAnimator::transitionToRunning(AnimationContext& context) { // Set to 0 so that the animate() basically instantly finishes mStartTime = 0; } - // No interpolator was set, use the default - if (!mInterpolator) { - mInterpolator.reset(Interpolator::createDefaultInterpolator()); - } if (mDuration < 0 || mDuration > 50000) { ALOGW("Your duration is strange and confusing: %" PRId64, mDuration); } |