Merge "Fix issues with SHOW_WHEN_LOCKED windows" into nyc-mr1-dev

This commit is contained in:
TreeHugger Robot
2016-09-09 19:17:44 +00:00
committed by Android (Google) Code Review

View File

@@ -121,6 +121,9 @@ public class WindowAnimator {
private final AppTokenList mTmpExitingAppTokens = new AppTokenList(); private final AppTokenList mTmpExitingAppTokens = new AppTokenList();
/** The window that was previously hiding the Keyguard. */
private WindowState mLastShowWinWhenLocked;
private String forceHidingToString() { private String forceHidingToString() {
switch (mForceHiding) { switch (mForceHiding) {
case KEYGUARD_NOT_SHOWN: return "KEYGUARD_NOT_SHOWN"; case KEYGUARD_NOT_SHOWN: return "KEYGUARD_NOT_SHOWN";
@@ -221,27 +224,43 @@ public class WindowAnimator {
} }
} }
/**
* @return The window that is currently hiding the Keyguard, or if it was hiding the Keyguard,
* and it's still animating.
*/
private WindowState getWinShowWhenLockedOrAnimating() {
final WindowState winShowWhenLocked = (WindowState) mPolicy.getWinShowWhenLockedLw();
if (winShowWhenLocked != null) {
return winShowWhenLocked;
}
if (mLastShowWinWhenLocked != null && mLastShowWinWhenLocked.isOnScreen()
&& mLastShowWinWhenLocked.isAnimatingLw()
&& (mLastShowWinWhenLocked.mAttrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0) {
return mLastShowWinWhenLocked;
}
return null;
}
private boolean shouldForceHide(WindowState win) { private boolean shouldForceHide(WindowState win) {
final WindowState imeTarget = mService.mInputMethodTarget; final WindowState imeTarget = mService.mInputMethodTarget;
final boolean showImeOverKeyguard = imeTarget != null && imeTarget.isVisibleNow() && final boolean showImeOverKeyguard = imeTarget != null && imeTarget.isVisibleNow() &&
((imeTarget.getAttrs().flags & FLAG_SHOW_WHEN_LOCKED) != 0 ((imeTarget.getAttrs().flags & FLAG_SHOW_WHEN_LOCKED) != 0
|| !mPolicy.canBeForceHidden(imeTarget, imeTarget.mAttrs)); || !mPolicy.canBeForceHidden(imeTarget, imeTarget.mAttrs));
final WindowState winShowWhenLocked = (WindowState) mPolicy.getWinShowWhenLockedLw(); final WindowState winShowWhenLocked = getWinShowWhenLockedOrAnimating();
final AppWindowToken appShowWhenLocked = winShowWhenLocked == null ? final AppWindowToken appShowWhenLocked = winShowWhenLocked == null ?
null : winShowWhenLocked.mAppToken; null : winShowWhenLocked.mAppToken;
boolean allowWhenLocked = false; boolean allowWhenLocked = false;
// Show IME over the keyguard if the target allows it // Show IME over the keyguard if the target allows it
allowWhenLocked |= (win.mIsImWindow || imeTarget == win) && showImeOverKeyguard; allowWhenLocked |= (win.mIsImWindow || imeTarget == win) && showImeOverKeyguard;
// Show SHOW_WHEN_LOCKED windows // Show SHOW_WHEN_LOCKED windows that turn on the screen
allowWhenLocked |= (win.mAttrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0; allowWhenLocked |= (win.mAttrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0 && win.mTurnOnScreen;
// Show windows that are attached to SHOW_WHEN_LOCKED windows
allowWhenLocked |= win.mAttachedWindow != null
&& (win.mAttachedWindow.mAttrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0;
if (appShowWhenLocked != null) { if (appShowWhenLocked != null) {
allowWhenLocked |= appShowWhenLocked == win.mAppToken allowWhenLocked |= appShowWhenLocked == win.mAppToken
// Show all SHOW_WHEN_LOCKED windows if some apps are shown over lockscreen
|| (win.mAttrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0
// Show error dialogs over apps that are shown on lockscreen // Show error dialogs over apps that are shown on lockscreen
|| (win.mAttrs.privateFlags & PRIVATE_FLAG_SYSTEM_ERROR) != 0; || (win.mAttrs.privateFlags & PRIVATE_FLAG_SYSTEM_ERROR) != 0;
} }
@@ -556,6 +575,11 @@ public class WindowAnimator {
mPostKeyguardExitAnimation = null; mPostKeyguardExitAnimation = null;
} }
} }
final WindowState winShowWhenLocked = (WindowState) mPolicy.getWinShowWhenLockedLw();
if (winShowWhenLocked != null) {
mLastShowWinWhenLocked = winShowWhenLocked;
}
} }
private void updateWallpaperLocked(int displayId) { private void updateWallpaperLocked(int displayId) {