From 6e2281d44c9b71a03a50ed24d654927111cd2b72 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Tue, 19 Jun 2012 17:48:32 -0700 Subject: Fix issue #6686339: 2 taps required to launch notification... ...or settings from lock screen When a window is drawn, the code to determine whether it should now be shown was calling WindowState.isReadyForDisplay(). Part of the condition of this function is that it is not ready if a policy is forcing the window to be hidden -- which is the case when the lock screen is shown. As a result, we wouldn't show the window at that point, so wouldn't tell the activity manager that the token's windows are visibible, and wouldn't tell the lock screen to go away. This adds a new variation WindowState.isReadyForDisplayIgnoringKeyguard(), which is the same as the original method but ignores the policy visibility for app windows. This allows windows to be go through the complete path of handling when the window is finally drawn and telling the activity manager about it, even if behind the lock screen. By making it a separate function, we don't impact any other code that is calling the old function and may be relying on its behavior. Also cleaned up a little of the dumpsys output. Most important, the new ANR section is now moved to the top, since we want "adb shell dumpsys window" to still give a nice summary of what we normally care about -- the window stack and important global state. Change-Id: Ica3ea85ce46f3f5f5cd2cc30fbd9de13d3885a57 --- .../java/com/android/server/wm/WindowState.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'services/java/com/android/server/wm/WindowState.java') diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java index 8f2ef76..f94bacd 100644 --- a/services/java/com/android/server/wm/WindowState.java +++ b/services/java/com/android/server/wm/WindowState.java @@ -719,6 +719,28 @@ final class WindowState implements WindowManagerPolicy.WindowState { } /** + * Like isReadyForDisplay(), but ignores any force hiding of the window due + * to the keyguard. + */ + boolean isReadyForDisplayIgnoringKeyguard() { + if (mRootToken.waitingToShow && + mService.mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) { + return false; + } + final AppWindowToken atoken = mAppToken; + if (atoken == null && !mPolicyVisibility) { + // If this is not an app window, and the policy has asked to force + // hide, then we really do want to hide. + return false; + } + return mHasSurface && !mDestroying + && ((!mAttachedHidden && mViewVisibility == View.VISIBLE + && !mRootToken.hidden) + || mWinAnimator.mAnimation != null + || ((atoken != null) && (atoken.mAppAnimator.animation != null))); + } + + /** * Like isOnScreen, but returns false if the surface hasn't yet * been drawn. */ -- cgit v1.1