summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2022-04-01 11:48:52 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2022-04-01 11:48:52 +0000
commitc5866bede052eb6e96d6b1bf33e03d20189f6312 (patch)
tree25ec9078464cbcc0ac230055563380ec3bb90595
parentfbcaefde6cd48ce56ce4bf819732cb0723cd7809 (diff)
parent2b770a7e86f7d5f7c10f7b77a136bd15592be08a (diff)
Merge "Re-deprecate animation backgroundColor API" into tm-dev
-rw-r--r--core/api/current.txt13
-rw-r--r--core/java/android/view/animation/Animation.java92
-rw-r--r--core/res/res/values/attrs.xml6
-rw-r--r--core/res/res/values/public-staging.xml3
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java6
-rw-r--r--services/core/java/com/android/server/wm/AnimationAdapter.java4
-rw-r--r--services/core/java/com/android/server/wm/AppTransition.java2
-rw-r--r--services/core/java/com/android/server/wm/WindowAnimationSpec.java4
8 files changed, 87 insertions, 43 deletions
diff --git a/core/api/current.txt b/core/api/current.txt
index 349324b0459a..8e58803243b4 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -390,6 +390,7 @@ package android {
field public static final int autoVerify = 16844014; // 0x10104ee
field public static final int autofillHints = 16844118; // 0x1010556
field public static final int autofilledHighlight = 16844136; // 0x1010568
+ field public static final int backdropColor;
field public static final int background = 16842964; // 0x10100d4
field public static final int backgroundDimAmount = 16842802; // 0x1010032
field public static final int backgroundDimEnabled = 16843295; // 0x101021f
@@ -1345,7 +1346,7 @@ package android {
field public static final int shouldDisableView = 16843246; // 0x10101ee
field public static final int shouldUseDefaultUnfoldTransition = 16844364; // 0x101064c
field public static final int showAsAction = 16843481; // 0x10102d9
- field public static final int showBackground;
+ field public static final int showBackdrop;
field public static final int showClockAndComplications;
field public static final int showDefault = 16843258; // 0x10101fa
field public static final int showDividers = 16843561; // 0x1010329
@@ -52277,7 +52278,8 @@ package android.view.animation {
method protected android.view.animation.Animation clone() throws java.lang.CloneNotSupportedException;
method public long computeDurationHint();
method protected void ensureInterpolator();
- method @ColorInt public int getBackgroundColor();
+ method @ColorInt public int getBackdropColor();
+ method @Deprecated @ColorInt public int getBackgroundColor();
method @Deprecated public boolean getDetachWallpaper();
method public long getDuration();
method public boolean getFillAfter();
@@ -52286,7 +52288,7 @@ package android.view.animation {
method public int getRepeatCount();
method public int getRepeatMode();
method protected float getScaleFactor();
- method public boolean getShowBackground();
+ method public boolean getShowBackdrop();
method public long getStartOffset();
method public long getStartTime();
method public boolean getTransformation(long, android.view.animation.Transformation);
@@ -52302,7 +52304,8 @@ package android.view.animation {
method public void restrictDuration(long);
method public void scaleCurrentDuration(float);
method public void setAnimationListener(android.view.animation.Animation.AnimationListener);
- method public void setBackgroundColor(@ColorInt int);
+ method public void setBackdropColor(@ColorInt int);
+ method @Deprecated public void setBackgroundColor(@ColorInt int);
method @Deprecated public void setDetachWallpaper(boolean);
method public void setDuration(long);
method public void setFillAfter(boolean);
@@ -52312,7 +52315,7 @@ package android.view.animation {
method public void setInterpolator(android.view.animation.Interpolator);
method public void setRepeatCount(int);
method public void setRepeatMode(int);
- method public void setShowBackground(boolean);
+ method public void setShowBackdrop(boolean);
method public void setStartOffset(long);
method public void setStartTime(long);
method public void setZAdjustment(int);
diff --git a/core/java/android/view/animation/Animation.java b/core/java/android/view/animation/Animation.java
index 464414d861fd..09306c791537 100644
--- a/core/java/android/view/animation/Animation.java
+++ b/core/java/android/view/animation/Animation.java
@@ -196,9 +196,9 @@ public abstract class Animation implements Cloneable {
private int mZAdjustment;
/**
- * Desired background color behind animation.
+ * The desired color of the backdrop to show behind the animation.
*/
- private int mBackgroundColor;
+ private int mBackdropColor;
/**
* scalefactor to apply to pivot points, etc. during animation. Subclasses retrieve the
@@ -211,10 +211,10 @@ public abstract class Animation implements Cloneable {
/**
* Whether to show a background behind the windows during the animation.
- * @see #getShowBackground()
- * @see #setShowBackground(boolean)
+ * @see #getShowBackdrop()
+ * @see #setShowBackdrop(boolean)
*/
- private boolean mShowBackground;
+ private boolean mShowBackdrop;
private boolean mMore = true;
private boolean mOneMoreTime = true;
@@ -265,7 +265,7 @@ public abstract class Animation implements Cloneable {
setZAdjustment(a.getInt(com.android.internal.R.styleable.Animation_zAdjustment, ZORDER_NORMAL));
- setBackgroundColor(a.getInt(com.android.internal.R.styleable.Animation_background, 0));
+ setBackdropColor(a.getInt(com.android.internal.R.styleable.Animation_backdropColor, 0));
setDetachWallpaper(
a.getBoolean(com.android.internal.R.styleable.Animation_detachWallpaper, false));
@@ -273,8 +273,8 @@ public abstract class Animation implements Cloneable {
a.getBoolean(com.android.internal.R.styleable.Animation_showWallpaper, false));
setHasRoundedCorners(
a.getBoolean(com.android.internal.R.styleable.Animation_hasRoundedCorners, false));
- setShowBackground(
- a.getBoolean(com.android.internal.R.styleable.Animation_showBackground, false));
+ setShowBackdrop(
+ a.getBoolean(com.android.internal.R.styleable.Animation_showBackdrop, false));
final int resID = a.getResourceId(com.android.internal.R.styleable.Animation_interpolator, 0);
@@ -646,9 +646,12 @@ public abstract class Animation implements Cloneable {
* @param bg The background color. If 0, no background. Currently must
* be black, with any desired alpha level.
*
+ * @deprecated None of window animations are running with background color.
+ * @see #setBackdropColor(int) for an alternative.
*/
+ @Deprecated
public void setBackgroundColor(@ColorInt int bg) {
- mBackgroundColor = bg;
+ // The background color is not needed any more, do nothing.
}
/**
@@ -705,21 +708,35 @@ public abstract class Animation implements Cloneable {
}
/**
- * If showBackground is {@code true} and this animation is applied on a window, then the windows
+ * If showBackdrop is {@code true} and this animation is applied on a window, then the windows
* in the animation will animate with the background associated with this window behind them.
*
- * The background comes from the {@link android.R.styleable#Theme_colorBackground} that is
- * applied to this window through its theme.
+ * If no backdrop color is explicitly set, the backdrop's color comes from the
+ * {@link android.R.styleable#Theme_colorBackground} that is applied to this window through its
+ * theme.
*
- * If multiple animating windows have showBackground set to {@code true} during an animation,
- * the top most window with showBackground set to {@code true} and a valid background color
+ * If multiple animating windows have showBackdrop set to {@code true} during an animation,
+ * the top most window with showBackdrop set to {@code true} and a valid background color
* takes precedence.
*
- * @param showBackground Whether to show a background behind the windows during the animation.
- * @attr ref android.R.styleable#Animation_showBackground
+ * @param showBackdrop Whether to show a background behind the windows during the animation.
+ * @attr ref android.R.styleable#Animation_showBackdrop
+ */
+ public void setShowBackdrop(boolean showBackdrop) {
+ mShowBackdrop = showBackdrop;
+ }
+
+ /**
+ * Set the color to use for the backdrop shown behind the animating windows.
+ *
+ * Will only show the backdrop if showBackdrop was set to true.
+ * See {@link #setShowBackdrop(boolean)}.
+ *
+ * @param backdropColor The backdrop color. If 0, the backdrop color will not apply.
+ * @attr ref android.R.styleable#Animation_backdropColor
*/
- public void setShowBackground(boolean showBackground) {
- mShowBackground = showBackground;
+ public void setBackdropColor(@ColorInt int backdropColor) {
+ mBackdropColor = backdropColor;
}
/**
@@ -822,10 +839,14 @@ public abstract class Animation implements Cloneable {
/**
* Returns the background color behind the animation.
+ *
+ * @deprecated None of window animations are running with background color.
+ * @see #getBackdropColor() for an alternative.
*/
+ @Deprecated
@ColorInt
public int getBackgroundColor() {
- return mBackgroundColor;
+ return 0;
}
/**
@@ -869,21 +890,36 @@ public abstract class Animation implements Cloneable {
}
/**
- * If showBackground is {@code true} and this animation is applied on a window, then the windows
+ * If showBackdrop is {@code true} and this animation is applied on a window, then the windows
* in the animation will animate with the background associated with this window behind them.
*
- * The background comes from the {@link android.R.styleable#Theme_colorBackground} that is
- * applied to this window through its theme.
+ * If no backdrop color is explicitly set, the backdrop's color comes from the
+ * {@link android.R.styleable#Theme_colorBackground} that is applied to this window
+ * through its theme.
*
- * If multiple animating windows have showBackground set to {@code true} during an animation,
- * the top most window with showBackground set to {@code true} and a valid background color
+ * If multiple animating windows have showBackdrop set to {@code true} during an animation,
+ * the top most window with showBackdrop set to {@code true} and a valid background color
* takes precedence.
*
- * @return if the background of this window should be shown behind the animating windows.
- * @attr ref android.R.styleable#Animation_showBackground
+ * @return if a backdrop should be shown behind the animating windows.
+ * @attr ref android.R.styleable#Animation_showBackdrop
+ */
+ public boolean getShowBackdrop() {
+ return mShowBackdrop;
+ }
+
+ /**
+ * Returns the background color to show behind the animating windows.
+ *
+ * Will only show the background if showBackdrop was set to true.
+ * See {@link #setShowBackdrop(boolean)}.
+ *
+ * @return The backdrop color. If 0, the backdrop color will not apply.
+ * @attr ref android.R.styleable#Animation_backdropColor
*/
- public boolean getShowBackground() {
- return mShowBackground;
+ @ColorInt
+ public int getBackdropColor() {
+ return mBackdropColor;
}
/**
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 2f77eb0a8652..d2f31b05313d 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -6960,9 +6960,13 @@
<!-- Special option for window animations: whether window should have rounded corners.
@see ScreenDecorationsUtils#getWindowCornerRadius(Resources) -->
<attr name="hasRoundedCorners" format="boolean" />
+ <!-- Special option for window animations: whether to show a background behind the animating
+ windows. By default the window's background is used unless overridden by the
+ animation. -->
+ <attr name="showBackdrop" format="boolean" />
<!-- Special option for window animations: whether the window's background should be used as
a background to the animation. -->
- <attr name="showBackground" format="boolean" />
+ <attr name="backdropColor" format="color" />
</declare-styleable>
<declare-styleable name="AnimationSet">
diff --git a/core/res/res/values/public-staging.xml b/core/res/res/values/public-staging.xml
index b37c9017f9ae..870f54989674 100644
--- a/core/res/res/values/public-staging.xml
+++ b/core/res/res/values/public-staging.xml
@@ -126,7 +126,7 @@
<public name="allowGameDownscaling" />
<public name="allowGameFpsOverride" />
<public name="localeConfig" />
- <public name="showBackground" />
+ <public name="showBackdrop" />
<public name="removed_useTargetActivityForQuickAccess"/>
<public name="removed_inheritKeyStoreKeys" />
<public name="preferKeepClear" />
@@ -152,6 +152,7 @@
<public name="maxDrawableWidth" />
<!-- @hide -->
<public name="maxDrawableHeight" />
+ <public name="backdropColor" />
</staging-public-group>
<staging-public-group type="id" first-id="0x01de0000">
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java
index 542ddeea769c..3ea57b0520b7 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java
@@ -437,15 +437,15 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
cornerRadius = 0;
}
- if (a.getShowBackground()) {
+ if (a.getShowBackdrop()) {
if (info.getAnimationOptions().getBackgroundColor() != 0) {
// If available use the background color provided through AnimationOptions
backgroundColorForTransition =
info.getAnimationOptions().getBackgroundColor();
- } else if (a.getBackgroundColor() != 0) {
+ } else if (a.getBackdropColor() != 0) {
// Otherwise fallback on the background color provided through the animation
// definition.
- backgroundColorForTransition = a.getBackgroundColor();
+ backgroundColorForTransition = a.getBackdropColor();
} else if (change.getBackgroundColor() != 0) {
// Otherwise default to the window's background color if provided through
// the theme as the background color for the animation - the top most window
diff --git a/services/core/java/com/android/server/wm/AnimationAdapter.java b/services/core/java/com/android/server/wm/AnimationAdapter.java
index a7430912c0b9..b039646c1697 100644
--- a/services/core/java/com/android/server/wm/AnimationAdapter.java
+++ b/services/core/java/com/android/server/wm/AnimationAdapter.java
@@ -43,7 +43,7 @@ interface AnimationAdapter {
/**
* @return Whether we should show a background behind the animating windows.
- * @see Animation#getShowBackground()
+ * @see Animation#getShowBackdrop()
*/
default boolean getShowBackground() {
return false;
@@ -51,7 +51,7 @@ interface AnimationAdapter {
/**
* @return The background color to use during an animation if getShowBackground returns true.
- * @see Animation#getBackgroundColor()
+ * @see Animation#getBackdropColor()
*/
default int getBackgroundColor() {
return 0;
diff --git a/services/core/java/com/android/server/wm/AppTransition.java b/services/core/java/com/android/server/wm/AppTransition.java
index 5c09f09d9313..68a09a6d4b9b 100644
--- a/services/core/java/com/android/server/wm/AppTransition.java
+++ b/services/core/java/com/android/server/wm/AppTransition.java
@@ -843,7 +843,7 @@ public class AppTransition implements Dump {
setAppTransitionFinishedCallbackIfNeeded(a);
if (mNextAppTransitionBackgroundColor != 0) {
- a.setBackgroundColor(mNextAppTransitionBackgroundColor);
+ a.setBackdropColor(mNextAppTransitionBackgroundColor);
}
return a;
diff --git a/services/core/java/com/android/server/wm/WindowAnimationSpec.java b/services/core/java/com/android/server/wm/WindowAnimationSpec.java
index b6d668dde9d8..34b9913c9738 100644
--- a/services/core/java/com/android/server/wm/WindowAnimationSpec.java
+++ b/services/core/java/com/android/server/wm/WindowAnimationSpec.java
@@ -87,12 +87,12 @@ public class WindowAnimationSpec implements AnimationSpec {
@Override
public boolean getShowBackground() {
- return mAnimation.getShowBackground();
+ return mAnimation.getShowBackdrop();
}
@Override
public int getBackgroundColor() {
- return mAnimation.getBackgroundColor();
+ return mAnimation.getBackdropColor();
}
/**