OSDN Git Service

If a window specifies flag to show even when screen is locked, the keyguard is hidden...
authorSuchi Amalapurapu <asuchitra@google.com>
Fri, 15 May 2009 01:01:07 +0000 (18:01 -0700)
committerSuchi Amalapurapu <asuchitra@google.com>
Mon, 18 May 2009 17:47:44 +0000 (10:47 -0700)
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.

phone/com/android/internal/policy/impl/PhoneWindowManager.java

index 2a54e3d..bb41538 100644 (file)
@@ -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"));