Skip to content

Commit 6e2281d

Browse files
author
Dianne Hackborn
committed
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
1 parent 0abe556 commit 6e2281d

File tree

4 files changed

+46
-20
lines changed

4 files changed

+46
-20
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4397,20 +4397,21 @@ public void dump(String prefix, PrintWriter pw, String[] args) {
43974397
pw.print(prefix); pw.print("mUserRotationMode="); pw.print(mUserRotationMode);
43984398
pw.print(" mUserRotation="); pw.print(mUserRotation);
43994399
pw.print(" mAllowAllRotations="); pw.println(mAllowAllRotations);
4400-
pw.print(prefix); pw.print(" mCurrentAppOrientation="); pw.println(mCurrentAppOrientation);
4400+
pw.print(prefix); pw.print("mCurrentAppOrientation="); pw.println(mCurrentAppOrientation);
44014401
pw.print(prefix); pw.print("mCarDockEnablesAccelerometer=");
44024402
pw.print(mCarDockEnablesAccelerometer);
44034403
pw.print(" mDeskDockEnablesAccelerometer=");
44044404
pw.println(mDeskDockEnablesAccelerometer);
44054405
pw.print(prefix); pw.print("mLidKeyboardAccessibility=");
44064406
pw.print(mLidKeyboardAccessibility);
44074407
pw.print(" mLidNavigationAccessibility="); pw.print(mLidNavigationAccessibility);
4408-
pw.print(" mLidControlsSleep="); pw.print(mLidControlsSleep);
4409-
pw.print(" mLongPressOnPowerBehavior="); pw.println(mLongPressOnPowerBehavior);
4408+
pw.print(" mLidControlsSleep="); pw.println(mLidControlsSleep);
4409+
pw.print(prefix); pw.print("mLongPressOnPowerBehavior=");
4410+
pw.print(mLongPressOnPowerBehavior);
4411+
pw.print(" mHasSoftInput="); pw.println(mHasSoftInput);
44104412
pw.print(prefix); pw.print("mScreenOnEarly="); pw.print(mScreenOnEarly);
44114413
pw.print(" mScreenOnFully="); pw.print(mScreenOnFully);
4412-
pw.print(" mOrientationSensorEnabled="); pw.print(mOrientationSensorEnabled);
4413-
pw.print(" mHasSoftInput="); pw.println(mHasSoftInput);
4414+
pw.print(" mOrientationSensorEnabled="); pw.println(mOrientationSensorEnabled);
44144415
pw.print(prefix); pw.print("mUnrestrictedScreen=("); pw.print(mUnrestrictedScreenLeft);
44154416
pw.print(","); pw.print(mUnrestrictedScreenTop);
44164417
pw.print(") "); pw.print(mUnrestrictedScreenWidth);

services/java/com/android/server/wm/WindowManagerService.java

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9537,12 +9537,14 @@ void dumpTokensLocked(PrintWriter pw, boolean dumpAll) {
95379537
}
95389538
}
95399539
}
9540-
pw.println();
9541-
if (mOpeningApps.size() > 0) {
9542-
pw.print(" mOpeningApps="); pw.println(mOpeningApps);
9543-
}
9544-
if (mClosingApps.size() > 0) {
9545-
pw.print(" mClosingApps="); pw.println(mClosingApps);
9540+
if (mOpeningApps.size() > 0 || mClosingApps.size() > 0) {
9541+
pw.println();
9542+
if (mOpeningApps.size() > 0) {
9543+
pw.print(" mOpeningApps="); pw.println(mOpeningApps);
9544+
}
9545+
if (mClosingApps.size() > 0) {
9546+
pw.print(" mClosingApps="); pw.println(mClosingApps);
9547+
}
95469548
}
95479549
}
95489550

@@ -9756,7 +9758,7 @@ void dumpWindowsNoHeaderLocked(PrintWriter pw, boolean dumpAll,
97569758
pw.print(" mTransitionWindowAnimationScale="); pw.print(mTransitionAnimationScale);
97579759
pw.print(" mAnimatorDurationScale="); pw.println(mAnimatorDurationScale);
97589760
pw.print(" mTraversalScheduled="); pw.print(mTraversalScheduled);
9759-
pw.print(" mNextAppTransition=0x");
9761+
pw.print(" mNextAppTransition=0x");
97609762
pw.print(Integer.toHexString(mNextAppTransition));
97619763
pw.print(" mAppTransitionReady="); pw.println(mAppTransitionReady);
97629764
pw.print(" mAppTransitionRunning="); pw.print(mAppTransitionRunning);
@@ -9798,7 +9800,7 @@ void dumpWindowsNoHeaderLocked(PrintWriter pw, boolean dumpAll,
97989800
pw.println(mNextAppTransitionCallback);
97999801
}
98009802
pw.print(" mStartingIconInTransition="); pw.print(mStartingIconInTransition);
9801-
pw.print(", mSkipAppTransitionAnimation="); pw.println(mSkipAppTransitionAnimation);
9803+
pw.print(" mSkipAppTransitionAnimation="); pw.println(mSkipAppTransitionAnimation);
98029804
}
98039805
}
98049806

@@ -9966,30 +9968,31 @@ public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
99669968
}
99679969

99689970
synchronized(mWindowMap) {
9971+
pw.println();
99699972
if (dumpAll) {
99709973
pw.println("-------------------------------------------------------------------------------");
99719974
}
9972-
dumpPolicyLocked(pw, args, dumpAll);
9975+
dumpLastANRLocked(pw);
99739976
pw.println();
99749977
if (dumpAll) {
99759978
pw.println("-------------------------------------------------------------------------------");
99769979
}
9977-
dumpSessionsLocked(pw, dumpAll);
9980+
dumpPolicyLocked(pw, args, dumpAll);
99789981
pw.println();
99799982
if (dumpAll) {
99809983
pw.println("-------------------------------------------------------------------------------");
99819984
}
9982-
dumpTokensLocked(pw, dumpAll);
9985+
dumpSessionsLocked(pw, dumpAll);
99839986
pw.println();
99849987
if (dumpAll) {
99859988
pw.println("-------------------------------------------------------------------------------");
99869989
}
9987-
dumpWindowsLocked(pw, dumpAll, null);
9990+
dumpTokensLocked(pw, dumpAll);
99889991
pw.println();
99899992
if (dumpAll) {
99909993
pw.println("-------------------------------------------------------------------------------");
99919994
}
9992-
dumpLastANRLocked(pw);
9995+
dumpWindowsLocked(pw, dumpAll, null);
99939996
}
99949997
}
99959998

services/java/com/android/server/wm/WindowState.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,28 @@ boolean isReadyForDisplay() {
718718
|| ((mAppToken != null) && (mAppToken.mAppAnimator.animation != null)));
719719
}
720720

721+
/**
722+
* Like isReadyForDisplay(), but ignores any force hiding of the window due
723+
* to the keyguard.
724+
*/
725+
boolean isReadyForDisplayIgnoringKeyguard() {
726+
if (mRootToken.waitingToShow &&
727+
mService.mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
728+
return false;
729+
}
730+
final AppWindowToken atoken = mAppToken;
731+
if (atoken == null && !mPolicyVisibility) {
732+
// If this is not an app window, and the policy has asked to force
733+
// hide, then we really do want to hide.
734+
return false;
735+
}
736+
return mHasSurface && !mDestroying
737+
&& ((!mAttachedHidden && mViewVisibility == View.VISIBLE
738+
&& !mRootToken.hidden)
739+
|| mWinAnimator.mAnimation != null
740+
|| ((atoken != null) && (atoken.mAppAnimator.animation != null)));
741+
}
742+
721743
/**
722744
* Like isOnScreen, but returns false if the surface hasn't yet
723745
* been drawn.

services/java/com/android/server/wm/WindowStateAnimator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,10 +1218,10 @@ boolean performShowLocked() {
12181218
}
12191219
Slog.v(TAG, "performShow on " + this
12201220
+ ": mDrawState=" + mDrawState + " readyForDisplay="
1221-
+ mWin.isReadyForDisplay()
1221+
+ mWin.isReadyForDisplayIgnoringKeyguard()
12221222
+ " starting=" + (mWin.mAttrs.type == TYPE_APPLICATION_STARTING), e);
12231223
}
1224-
if (mDrawState == READY_TO_SHOW && mWin.isReadyForDisplay()) {
1224+
if (mDrawState == READY_TO_SHOW && mWin.isReadyForDisplayIgnoringKeyguard()) {
12251225
if (SHOW_TRANSACTIONS || DEBUG_ORIENTATION)
12261226
WindowManagerService.logSurface(mWin, "SHOW (performShowLocked)", null);
12271227
if (DEBUG_VISIBILITY) Slog.v(TAG, "Showing " + this

0 commit comments

Comments
 (0)