Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9471907b authored by Adam Powell's avatar Adam Powell
Browse files

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
parent 896a9b17
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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);
                        }
                    }