summaryrefslogtreecommitdiffstats
path: root/core/java/android/animation
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2014-10-07 15:55:35 -0700
committerJeff Brown <jeffbrown@google.com>2014-10-07 15:55:35 -0700
commit7a08fe0e09c9bd5b66049738617cc9972651bf5b (patch)
tree50d8e55555e0eec764c0acd9c7b9565397741d2c /core/java/android/animation
parent99586dc0108d0f4311c8af4d06ed113bbf40a6ee (diff)
downloadframeworks_base-7a08fe0e09c9bd5b66049738617cc9972651bf5b.zip
frameworks_base-7a08fe0e09c9bd5b66049738617cc9972651bf5b.tar.gz
frameworks_base-7a08fe0e09c9bd5b66049738617cc9972651bf5b.tar.bz2
Reapply animation duration scale each time it is started.
When Battery Saver mode is enabled, we set the animation duration scale factor to 0 to effectively disable all animations. Later when it is disabled, we reset the animation duration scale factor to 1. This change ensures that we reapply the duration scale factor whenever the animation is started instead of only applying it once when the duration is set (usually when the animation is created). This ensures that the correct scale factor is applied even when it changes after the animation has been initialized. Previously, certain animations would continue to be suppressed even after Battery Saver mode was disengaged. This wasn't much of an issue when the duration scale was initially implemented as a developer setting but now that it is exposed via Battery Saver the artifacts caused by this bug have become visible to users. Bug: 17887431 Change-Id: I91ba5ca0505d02ac389a31d067e38886112fa0c8
Diffstat (limited to 'core/java/android/animation')
-rw-r--r--core/java/android/animation/ValueAnimator.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/java/android/animation/ValueAnimator.java b/core/java/android/animation/ValueAnimator.java
index 9435dfb..0d17d67 100644
--- a/core/java/android/animation/ValueAnimator.java
+++ b/core/java/android/animation/ValueAnimator.java
@@ -508,10 +508,14 @@ public class ValueAnimator extends Animator {
duration);
}
mUnscaledDuration = duration;
- mDuration = (long)(duration * sDurationScale);
+ updateScaledDuration();
return this;
}
+ private void updateScaledDuration() {
+ mDuration = (long)(mUnscaledDuration * sDurationScale);
+ }
+
/**
* Gets the length of the animation. The default duration is 300 milliseconds.
*
@@ -947,6 +951,7 @@ public class ValueAnimator extends Animator {
mStarted = true;
mStartedDelay = false;
mPaused = false;
+ updateScaledDuration(); // in case the scale factor has changed since creation time
AnimationHandler animationHandler = getOrCreateAnimationHandler();
animationHandler.mPendingAnimations.add(this);
if (mStartDelay == 0) {