Animate scrim colors when unlocking
Test: Set different wallpapers on home and lock screen, unlock the phone
Change-Id: Ifba44be747f0ad7b6ed4aec75197746edbbecfd2
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ScrimView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ScrimView.java
index d9ac4d5..8588668 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ScrimView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ScrimView.java
@@ -167,6 +167,10 @@
}
public void setColors(@NonNull ColorExtractor.GradientColors colors) {
+ setColors(colors, false);
+ }
+
+ public void setColors(@NonNull ColorExtractor.GradientColors colors, boolean animated) {
if (colors == null) {
throw new IllegalArgumentException("Colors cannot be null");
}
@@ -174,7 +178,7 @@
return;
}
mColors.set(colors);
- updateColorWithTint();
+ updateColorWithTint(animated);
}
@VisibleForTesting
@@ -183,14 +187,18 @@
}
public void setTint(int color) {
+ setTint(color, false);
+ }
+
+ public void setTint(int color, boolean animated) {
if (mTintColor == color) {
return;
}
mTintColor = color;
- updateColorWithTint();
+ updateColorWithTint(animated);
}
- private void updateColorWithTint() {
+ private void updateColorWithTint(boolean animated) {
if (mDrawable instanceof GradientDrawable) {
// Optimization to blend colors and avoid a color filter
GradientDrawable drawable = (GradientDrawable) mDrawable;
@@ -199,7 +207,7 @@
tintAmount);
int secondaryTinted = ColorUtils.blendARGB(mColors.getSecondaryColor(), mTintColor,
tintAmount);
- drawable.setColors(mainTinted, secondaryTinted, false);
+ drawable.setColors(mainTinted, secondaryTinted, animated);
} else {
if (mColorFilter == null) {
mColorFilter = new PorterDuffColorFilter(mTintColor, PorterDuff.Mode.SRC_OVER);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
index 2be5b83..d29b356 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -277,8 +277,8 @@
mScrimInFront.setColors(mLockColors);
mScrimBehind.setColors(mLockColors);
} else {
- mScrimInFront.setColors(mSystemColors);
- mScrimBehind.setColors(mSystemColors);
+ mScrimInFront.setColors(mSystemColors, true);
+ mScrimBehind.setColors(mSystemColors, true);
}
}