Fix VPA.cancel()
Bug: 15978905
Need to make sure we re-sync the UI properties on animator cancel, also
don't animate for 1 frame after cancel() is called
Change-Id: Ib660c0fb195b9f02bd795d03d43ea67bffebb499
diff --git a/libs/hwui/Animator.cpp b/libs/hwui/Animator.cpp
index f3ef48b..d35dce9 100644
--- a/libs/hwui/Animator.cpp
+++ b/libs/hwui/Animator.cpp
@@ -126,6 +126,9 @@
if (mPlayState < RUNNING) {
return false;
}
+ if (mPlayState == FINISHED) {
+ return true;
+ }
// If BaseRenderNodeAnimator is handling the delay (not typical), then
// because the staging properties reflect the final value, we always need
@@ -209,6 +212,10 @@
void RenderPropertyAnimator::onStagingPlayStateChanged() {
if (mStagingPlayState == RUNNING) {
(mTarget->mutateStagingProperties().*mPropertyAccess->setter)(finalValue());
+ } else if (mStagingPlayState == FINISHED) {
+ // We're being canceled, so make sure that whatever values the UI thread
+ // is observing for us is pushed over
+ mTarget->setPropertyFieldsDirty(dirtyMask());
}
}