summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorDoris Liu <tianliu@google.com>2016-05-25 01:41:11 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-05-25 01:41:14 +0000
commit54d89e078d4a4abd6a06362c04f3329fdebd6d7b (patch)
tree92205b53187c9aa34248a6030efb455726c85329 /core/java/android
parentba2cc82399b89d92f766bbee3b2504a5cdf56215 (diff)
parent61045c518b18a7cee30954fe45f9db8c14e705e1 (diff)
Merge "Clamp start delay to non-negative range" into nyc-dev
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/animation/AnimatorSet.java14
-rw-r--r--core/java/android/animation/ValueAnimator.java10
2 files changed, 18 insertions, 6 deletions
diff --git a/core/java/android/animation/AnimatorSet.java b/core/java/android/animation/AnimatorSet.java
index 8ff38bb8647b..7841d29b5700 100644
--- a/core/java/android/animation/AnimatorSet.java
+++ b/core/java/android/animation/AnimatorSet.java
@@ -465,20 +465,26 @@ public final class AnimatorSet extends Animator {
/**
* The amount of time, in milliseconds, to delay starting the animation after
- * {@link #start()} is called.
-
+ * {@link #start()} is called. Note that the start delay should always be non-negative. Any
+ * negative start delay will be clamped to 0 on N and above.
+ *
* @param startDelay The amount of the delay, in milliseconds
*/
@Override
public void setStartDelay(long startDelay) {
- if (mStartDelay > 0) {
- mReversible = false;
+ // Clamp start delay to non-negative range.
+ if (startDelay < 0) {
+ Log.w(TAG, "Start delay should always be non-negative");
+ startDelay = 0;
}
long delta = startDelay - mStartDelay;
if (delta == 0) {
return;
}
mStartDelay = startDelay;
+ if (mStartDelay > 0) {
+ mReversible = false;
+ }
if (!mDependencyDirty) {
// Dependency graph already constructed, update all the nodes' start/end time
int size = mNodes.size();
diff --git a/core/java/android/animation/ValueAnimator.java b/core/java/android/animation/ValueAnimator.java
index 0a9b5ded8924..4edf249ce065 100644
--- a/core/java/android/animation/ValueAnimator.java
+++ b/core/java/android/animation/ValueAnimator.java
@@ -708,12 +708,18 @@ public class ValueAnimator extends Animator implements AnimationHandler.Animatio
/**
* The amount of time, in milliseconds, to delay starting the animation after
- * {@link #start()} is called.
-
+ * {@link #start()} is called. Note that the start delay should always be non-negative. Any
+ * negative start delay will be clamped to 0 on N and above.
+ *
* @param startDelay The amount of the delay, in milliseconds
*/
@Override
public void setStartDelay(long startDelay) {
+ // Clamp start delay to non-negative range.
+ if (startDelay < 0) {
+ Log.w(TAG, "Start delay should always be non-negative");
+ startDelay = 0;
+ }
mStartDelay = startDelay;
}