summaryrefslogtreecommitdiff
path: root/core/java/android/animation/Animator.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/animation/Animator.java')
-rw-r--r--core/java/android/animation/Animator.java44
1 files changed, 44 insertions, 0 deletions
diff --git a/core/java/android/animation/Animator.java b/core/java/android/animation/Animator.java
index a8ff36aae098..a9d14df8bcf4 100644
--- a/core/java/android/animation/Animator.java
+++ b/core/java/android/animation/Animator.java
@@ -18,6 +18,7 @@ package android.animation;
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.annotation.TestApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.pm.ActivityInfo.Config;
import android.content.res.ConstantState;
@@ -64,6 +65,49 @@ public abstract class Animator implements Cloneable {
private AnimatorConstantState mConstantState;
/**
+ * backing field for backgroundPauseDelay property. This could be simply a hardcoded
+ * value in AnimationHandler, but it is useful to be able to change the value in tests.
+ */
+ private static long sBackgroundPauseDelay = 10000;
+
+ /**
+ * Sets the duration for delaying pausing animators when apps go into the background.
+ * Used by AnimationHandler when requested to pause animators.
+ *
+ * @hide
+ */
+ @TestApi
+ public static void setBackgroundPauseDelay(long value) {
+ sBackgroundPauseDelay = value;
+ }
+
+ /**
+ * Gets the duration for delaying pausing animators when apps go into the background.
+ * Used by AnimationHandler when requested to pause animators.
+ *
+ * @hide
+ */
+ @TestApi
+ public static long getBackgroundPauseDelay() {
+ return sBackgroundPauseDelay;
+ }
+
+ /**
+ * Sets the behavior of animator pausing when apps go into the background.
+ * This is exposed as a test API for verification, but is intended for use by internal/
+ * platform code, potentially for use by a system property that could disable it
+ * system wide.
+ *
+ * @param enable Enable (default behavior) or disable background pausing behavior.
+ * @hide
+ */
+ @TestApi
+ public static void setAnimatorPausingEnabled(boolean enable) {
+ AnimationHandler.setAnimatorPausingEnabled(enable);
+ AnimationHandler.setOverrideAnimatorPausingSystemProperty(!enable);
+ }
+
+ /**
* Starts this animation. If the animation has a nonzero startDelay, the animation will start
* running after that delay elapses. A non-delayed animation will have its initial
* value(s) set immediately, followed by calls to