Skip to content

Commit 1db8cf1

Browse files
adampAndroid (Google) Code Review
authored and
Android (Google) Code Review
committed
Merge "Toggle wallpaper window flag when setting custom keyguard background" into klp-dev
2 parents bea75db + 9471907 commit 1db8cf1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/Keyguard/src/com/android/keyguard/KeyguardViewManager.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public class KeyguardViewManager {
8585
public void onSetBackground(Bitmap bmp) {
8686
mKeyguardHost.setCustomBackground(bmp != null ?
8787
new BitmapDrawable(mContext.getResources(), bmp) : null);
88+
updateShowWallpaper(bmp == null);
8889
}
8990
};
9091

@@ -379,6 +380,16 @@ private void maybeEnableScreenRotation(boolean enableScreenRotation) {
379380
mViewManager.updateViewLayout(mKeyguardHost, mWindowLayoutParams);
380381
}
381382

383+
void updateShowWallpaper(boolean show) {
384+
if (show) {
385+
mWindowLayoutParams.flags |= WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
386+
} else {
387+
mWindowLayoutParams.flags &= ~WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
388+
}
389+
390+
mViewManager.updateViewLayout(mKeyguardHost, mWindowLayoutParams);
391+
}
392+
382393
public void setNeedsInput(boolean needsInput) {
383394
mNeedsInput = needsInput;
384395
if (mWindowLayoutParams != null) {
@@ -489,6 +500,7 @@ public void run() {
489500
lastView.cleanUp();
490501
// Let go of any large bitmaps.
491502
mKeyguardHost.setCustomBackground(null);
503+
updateShowWallpaper(true);
492504
mKeyguardHost.removeView(lastView);
493505
}
494506
}

0 commit comments

Comments
 (0)