diff options
| author | Pablo Gamito <pablogamito@google.com> | 2021-09-13 15:20:05 +0200 |
|---|---|---|
| committer | Pablo Gamito <pablogamito@google.com> | 2021-09-20 19:30:17 +0200 |
| commit | 2ccc829e71dca5af5eba565319911a53499e99ef (patch) | |
| tree | 87a12245ac7bd3edd4dd6feecc7b417c464eeaf5 /core/java | |
| parent | 9349f6a8f6dc0a276772efb02cfc2e59e343c138 (diff) | |
Add API to specify background color for animations
To be used for new task transtion animations
(go/android-new-task-motion) to set a background color behind the
animations instead of showing the wallpaper.
Test: atest FlickerTests:TaskTransitionTest
Bug: 199507257
Change-Id: I7fabfdcaf90be63c11eb3b18d65259c620570cab
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/view/animation/Animation.java | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/core/java/android/view/animation/Animation.java b/core/java/android/view/animation/Animation.java index b1d618eff40a..b296d6f6a052 100644 --- a/core/java/android/view/animation/Animation.java +++ b/core/java/android/view/animation/Animation.java @@ -19,6 +19,7 @@ package android.view.animation; import android.annotation.AnimRes; import android.annotation.ColorInt; import android.annotation.InterpolatorRes; +import android.app.ActivityThread; import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.content.res.TypedArray; @@ -258,8 +259,6 @@ 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)); - setDetachWallpaper( a.getBoolean(com.android.internal.R.styleable.Animation_detachWallpaper, false)); setShowWallpaper( @@ -271,6 +270,15 @@ public abstract class Animation implements Cloneable { a.recycle(); + Context uiContext = ActivityThread.currentActivityThread().getSystemUiContext(); + TypedArray uiStyledAttrs = uiContext + .obtainStyledAttributes(attrs, com.android.internal.R.styleable.Animation); + + setBackgroundColor( + uiStyledAttrs.getColor(com.android.internal.R.styleable.Animation_background, 0)); + + uiStyledAttrs.recycle(); + if (resID > 0) { setInterpolator(context, resID); } @@ -632,16 +640,15 @@ public abstract class Animation implements Cloneable { } /** - * Set background behind animation. + * Set background behind an animation. * - * @param bg The background color. If 0, no background. Currently must - * be black, with any desired alpha level. + * @param bg The background color. If 0, no background. * * @deprecated None of window animations are running with background color. */ @Deprecated public void setBackgroundColor(@ColorInt int bg) { - // The background color is not needed any more, do nothing. + mBackgroundColor = bg; } /** @@ -803,7 +810,7 @@ public abstract class Animation implements Cloneable { @Deprecated @ColorInt public int getBackgroundColor() { - return 0; + return mBackgroundColor; } /** |
