From 3d163f073f5cf3b3bf0287fc7d60fabce0269748 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Wed, 7 Oct 2009 21:26:57 -0700 Subject: [PATCH] More fix #2163209: alarm clock rings but is hidden behind lock screen There was another way we could ignore the application windows flags while the lock screen was displayed. This is the infrastructure to deal with that. Change-Id: Id8c9cb2f7081df6757ccb797a7cde618e82f7b38 --- core/java/android/view/WindowManagerPolicy.java | 7 +++++++ .../com/android/server/WindowManagerService.java | 15 +++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java index 78999fa51bbab..916fc2d78cb52 100644 --- a/core/java/android/view/WindowManagerPolicy.java +++ b/core/java/android/view/WindowManagerPolicy.java @@ -262,6 +262,13 @@ public interface WindowManagerPolicy { */ boolean isVisibleLw(); + /** + * Like {@link #isVisibleLw}, but also counts a window that is currently + * "hidden" behind the keyguard as visible. This allows us to apply + * things like window flags that impact the keyguard. + */ + boolean isVisibleOrBehindKeyguardLw(); + /** * Is this window currently visible to the user on-screen? It is * displayed either if it is visible or it is currently running an diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index 67b8a855ed6bb..00636c400ae52 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -7573,6 +7573,21 @@ public class WindowManagerService extends IWindowManager.Stub && !mExiting && !mDestroying; } + /** + * Like {@link #isVisibleLw}, but also counts a window that is currently + * "hidden" behind the keyguard as visible. This allows us to apply + * things like window flags that impact the keyguard. + * XXX I am starting to think we need to have ANOTHER visibility flag + * for this "hidden behind keyguard" state rather than overloading + * mPolicyVisibility. Ungh. + */ + public boolean isVisibleOrBehindKeyguardLw() { + final AppWindowToken atoken = mAppToken; + return mSurface != null && !mAttachedHidden + && (atoken == null ? mPolicyVisibility : !atoken.hiddenRequested) + && !mExiting && !mDestroying; + } + /** * Is this window visible, ignoring its app token? It is not visible * if there is no surface, or we are in the process of running an exit animation