More fix #2163209: alarm clock rings but is hidden behind lock screen

Another way we could miss the application's flags is because the
system now force hides application windows behind the lock screen.  So
we need to use this new API to actually take those into account when
looking for the top-most window that can specify for the lock screen
to be removed or hidden.

I have tested with pulling the device in and out of the desktop with
all kinds of random speeds and ways and this -seems- to now cover
everything.  Keeping fingers crossed.

Change-Id: Ice640eea6ee06ee27f069d60856fb394c7eeae51
diff --git a/policy/com/android/internal/policy/impl/ b/policy/com/android/internal/policy/impl/
index 549fb87..4699638 100755
--- a/policy/com/android/internal/policy/impl/
+++ b/policy/com/android/internal/policy/impl/
@@ -1359,12 +1359,12 @@
         win.computeFrameLw(pf, df, cf, vf);
-        if (win.isVisibleLw()) {
+        if (mTopFullscreenOpaqueWindowState == null &&
+                win.isVisibleOrBehindKeyguardLw()) {
             if ((attrs.flags & FLAG_FORCE_NOT_FULLSCREEN) != 0) {
                 mForceStatusBar = true;
-            if (mTopFullscreenOpaqueWindowState == null
-                    && attrs.type >= FIRST_APPLICATION_WINDOW
+            if (attrs.type >= FIRST_APPLICATION_WINDOW
                     && attrs.type <= LAST_APPLICATION_WINDOW
                     && win.fillsScreenLw(mW, mH, false, false)) {
                 if (DEBUG_LAYOUT) Log.v(TAG, "Fullscreen window: " + win);