Skip to content

Commit 2928c9d

Browse files
author
Jim Miller
committed
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
1 parent 957ad44 commit 2928c9d

File tree

2 files changed

+25
-20
lines changed

2 files changed

+25
-20
lines changed

policy/src/com/android/internal/policy/impl/KeyguardViewBase.java

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,29 +47,34 @@ public abstract class KeyguardViewBase extends FrameLayout {
4747
private AudioManager mAudioManager;
4848
private TelephonyManager mTelephonyManager = null;
4949

50-
public KeyguardViewBase(Context context) {
51-
super(context);
50+
// This is a faster way to draw the background on devices without hardware acceleration
51+
Drawable mBackgroundDrawable = new Drawable() {
52+
@Override
53+
public void draw(Canvas canvas) {
54+
canvas.drawColor(BACKGROUND_COLOR, PorterDuff.Mode.SRC);
55+
}
5256

53-
// This is a faster way to draw the background on devices without hardware acceleration
54-
setBackgroundDrawable(new Drawable() {
55-
@Override
56-
public void draw(Canvas canvas) {
57-
canvas.drawColor(BACKGROUND_COLOR, PorterDuff.Mode.SRC);
58-
}
57+
@Override
58+
public void setAlpha(int alpha) {
59+
}
5960

60-
@Override
61-
public void setAlpha(int alpha) {
62-
}
61+
@Override
62+
public void setColorFilter(ColorFilter cf) {
63+
}
6364

64-
@Override
65-
public void setColorFilter(ColorFilter cf) {
66-
}
65+
@Override
66+
public int getOpacity() {
67+
return PixelFormat.TRANSLUCENT;
68+
}
69+
};
6770

68-
@Override
69-
public int getOpacity() {
70-
return PixelFormat.TRANSLUCENT;
71-
}
72-
});
71+
public KeyguardViewBase(Context context) {
72+
super(context);
73+
resetBackground();
74+
}
75+
76+
public void resetBackground() {
77+
setBackgroundDrawable(mBackgroundDrawable);
7378
}
7479

7580
// used to inject callback

policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ public void requestHide(View view) {
254254

255255
// TODO: examine all widgets to derive clock status
256256
mUpdateMonitor.reportClockVisible(true);
257-
setBackgroundDrawable(null);
257+
resetBackground();
258258
}
259259

260260
public boolean isVisible(View self) {

0 commit comments

Comments
 (0)