From 9471907b5b756b5220e6b50df4529147c01798dc Mon Sep 17 00:00:00 2001 From: Adam Powell Date: Thu, 10 Oct 2013 20:01:49 -0700 Subject: [PATCH] Toggle wallpaper window flag when setting custom keyguard background Disable the wallpaper when showing a full-screen custom keyguard background, e.g. artwork from the RemoteController. This has two nice effects: * The wallpaper doesn't visibly "leak" as the keyguard is dismissed and fades out * We save an extra compositing/overdraw step when drawing custom backgrounds Bug 11172944 Change-Id: Id635dcea6b48392f841c9c549327bccff3308c0a --- .../com/android/keyguard/KeyguardViewManager.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardViewManager.java b/packages/Keyguard/src/com/android/keyguard/KeyguardViewManager.java index 58ca0b086ce8c..d37aaaf112157 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardViewManager.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardViewManager.java @@ -85,6 +85,7 @@ public class KeyguardViewManager { public void onSetBackground(Bitmap bmp) { mKeyguardHost.setCustomBackground(bmp != null ? new BitmapDrawable(mContext.getResources(), bmp) : null); + updateShowWallpaper(bmp == null); } }; @@ -379,6 +380,16 @@ public class KeyguardViewManager { mViewManager.updateViewLayout(mKeyguardHost, mWindowLayoutParams); } + void updateShowWallpaper(boolean show) { + if (show) { + mWindowLayoutParams.flags |= WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; + } else { + mWindowLayoutParams.flags &= ~WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; + } + + mViewManager.updateViewLayout(mKeyguardHost, mWindowLayoutParams); + } + public void setNeedsInput(boolean needsInput) { mNeedsInput = needsInput; if (mWindowLayoutParams != null) { @@ -489,6 +500,7 @@ public class KeyguardViewManager { lastView.cleanUp(); // Let go of any large bitmaps. mKeyguardHost.setCustomBackground(null); + updateShowWallpaper(true); mKeyguardHost.removeView(lastView); } }