Fix 5493266: Properly restore background after playing music
KeyguardViewBase maintains the transparent background for all lock screen
views. The background was being overwritten by the change to make lock
screen opaque when music was being shown.
Change-Id: Id1ab415f68746b20c9229fa58fef9ec8be354f01
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java b/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java
index de156c9..26bd697 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java
@@ -47,29 +47,34 @@
private AudioManager mAudioManager;
private TelephonyManager mTelephonyManager = null;
+ // This is a faster way to draw the background on devices without hardware acceleration
+ Drawable mBackgroundDrawable = new Drawable() {
+ @Override
+ public void draw(Canvas canvas) {
+ canvas.drawColor(BACKGROUND_COLOR, PorterDuff.Mode.SRC);
+ }
+
+ @Override
+ public void setAlpha(int alpha) {
+ }
+
+ @Override
+ public void setColorFilter(ColorFilter cf) {
+ }
+
+ @Override
+ public int getOpacity() {
+ return PixelFormat.TRANSLUCENT;
+ }
+ };
+
public KeyguardViewBase(Context context) {
super(context);
+ resetBackground();
+ }
- // This is a faster way to draw the background on devices without hardware acceleration
- setBackgroundDrawable(new Drawable() {
- @Override
- public void draw(Canvas canvas) {
- canvas.drawColor(BACKGROUND_COLOR, PorterDuff.Mode.SRC);
- }
-
- @Override
- public void setAlpha(int alpha) {
- }
-
- @Override
- public void setColorFilter(ColorFilter cf) {
- }
-
- @Override
- public int getOpacity() {
- return PixelFormat.TRANSLUCENT;
- }
- });
+ public void resetBackground() {
+ setBackgroundDrawable(mBackgroundDrawable);
}
// used to inject callback
diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
index 7a72dcf..b4db01d 100644
--- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
+++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
@@ -254,7 +254,7 @@
// TODO: examine all widgets to derive clock status
mUpdateMonitor.reportClockVisible(true);
- setBackgroundDrawable(null);
+ resetBackground();
}
public boolean isVisible(View self) {