From 1615d63b8fd58d1e8d19207ffb0aeccf09840021 Mon Sep 17 00:00:00 2001 From: Suchi Amalapurapu Date: Thu, 14 May 2009 18:01:07 -0700 Subject: [PATCH] If a window specifies flag to show even when screen is locked, the keyguard is hidden and conversely if the keyguard has been hidden its shown. this lets the window manager to hide or unhide the keyguard based on activities that specify if they want to be displayed inspite of the keyguard being shown or not. --- .../internal/policy/impl/PhoneWindowManager.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/phone/com/android/internal/policy/impl/PhoneWindowManager.java b/phone/com/android/internal/policy/impl/PhoneWindowManager.java index 2a54e3d..bb41538 100644 --- a/phone/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/phone/com/android/internal/policy/impl/PhoneWindowManager.java @@ -65,6 +65,7 @@ import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN; import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR; import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS; +import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED; import static android.view.WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST; import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE; import static android.view.WindowManager.LayoutParams.LAST_APPLICATION_WINDOW; @@ -197,6 +198,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { WindowState mTopFullscreenOpaqueWindowState; boolean mForceStatusBar; + boolean mHideKeyguard; boolean mHomePressed; Intent mHomeIntent; boolean mSearchKeyPressed; @@ -988,6 +990,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { mTopFullscreenOpaqueWindowState = null; mForceStatusBar = false; + mHideKeyguard = false; // decide where the status bar goes ahead of time if (mStatusBar != null) { @@ -1195,6 +1198,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (DEBUG_LAYOUT) Log.v(TAG, "Fullscreen window: " + win); mTopFullscreenOpaqueWindowState = win; } + if ((attrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0) { + // TODO Add a check for the window to be full screen + if (localLOGV) Log.i(TAG, "Setting mHideKeyguard to true by win " + win); + mHideKeyguard = true; + } } // Dock windows carve out the bottom of the screen, so normal windows @@ -1244,6 +1252,16 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } } + // Hide the key guard if a visible window explicitly specifies that it wants to be displayed + // when the screen is locked + if (mKeyguard != null) { + if (localLOGV) Log.i(TAG, "finishLayoutLw::mHideKeyguard="+mHideKeyguard); + if (mHideKeyguard) { + changed |= mKeyguard.hideLw(true); + } else { + changed |= mKeyguard.showLw(true); + } + } if (changed && hiding) { IStatusBar sbs = IStatusBar.Stub.asInterface(ServiceManager.getService("statusbar")); -- 2.11.0