summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jorim Jaggi <jjaggi@google.com> 2016-09-06 16:59:05 -0700
committer Jorim Jaggi <jjaggi@google.com> 2016-09-06 16:59:05 -0700
commitcbdd8dcf6adcb2f5df8ba65876f5e01a91f12d94 (patch)
treec698ed49cc2d917d362e60e8cee39441a1cc2796
parent6bd3890ff965c443b27d7e9224a34ba1312344ab (diff)
Fix issues with SHOW_WHEN_LOCKED windows
- Restore the previous logic to only show SHOW_WHEN_LOCKED windows if appShowWhenLocked is not null. - Add new logic to keep previous SHOW_WHEN_LOCKED window around if it's still animating, as well as all the other windows that are still visible. Test: - Make sure an SYSTEM_ALERT_WINDOW with SHOW_WHEN_LOCKED isn't visible on the lockscreen. - In Google Camera, click on the lock icon after launching it above lockscreen. Change-Id: Id33a8008c6edd6272e5110d9c0f1bf7aab007564 Fixes: 31300204 Fixes: 31319061
-rw-r--r--services/core/java/com/android/server/wm/WindowAnimator.java36
1 files changed, 30 insertions, 6 deletions
diff --git a/services/core/java/com/android/server/wm/WindowAnimator.java b/services/core/java/com/android/server/wm/WindowAnimator.java
index 022848eb37c3..1ee5a22195ef 100644
--- a/services/core/java/com/android/server/wm/WindowAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowAnimator.java
@@ -121,6 +121,9 @@ public class WindowAnimator {
private final AppTokenList mTmpExitingAppTokens = new AppTokenList();
+ /** The window that was previously hiding the Keyguard. */
+ private WindowState mLastShowWinWhenLocked;
+
private String forceHidingToString() {
switch (mForceHiding) {
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) {
final WindowState imeTarget = mService.mInputMethodTarget;
final boolean showImeOverKeyguard = imeTarget != null && imeTarget.isVisibleNow() &&
((imeTarget.getAttrs().flags & FLAG_SHOW_WHEN_LOCKED) != 0
|| !mPolicy.canBeForceHidden(imeTarget, imeTarget.mAttrs));
- final WindowState winShowWhenLocked = (WindowState) mPolicy.getWinShowWhenLockedLw();
+ final WindowState winShowWhenLocked = getWinShowWhenLockedOrAnimating();
final AppWindowToken appShowWhenLocked = winShowWhenLocked == null ?
null : winShowWhenLocked.mAppToken;
boolean allowWhenLocked = false;
// Show IME over the keyguard if the target allows it
allowWhenLocked |= (win.mIsImWindow || imeTarget == win) && showImeOverKeyguard;
- // Show SHOW_WHEN_LOCKED windows
- allowWhenLocked |= (win.mAttrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0;
- // Show windows that are attached to SHOW_WHEN_LOCKED windows
- allowWhenLocked |= win.mAttachedWindow != null
- && (win.mAttachedWindow.mAttrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0;
+ // Show SHOW_WHEN_LOCKED windows that turn on the screen
+ allowWhenLocked |= (win.mAttrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0 && win.mTurnOnScreen;
if (appShowWhenLocked != null) {
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
|| (win.mAttrs.privateFlags & PRIVATE_FLAG_SYSTEM_ERROR) != 0;
}
@@ -556,6 +575,11 @@ public class WindowAnimator {
mPostKeyguardExitAnimation = null;
}
}
+
+ final WindowState winShowWhenLocked = (WindowState) mPolicy.getWinShowWhenLockedLw();
+ if (winShowWhenLocked != null) {
+ mLastShowWinWhenLocked = winShowWhenLocked;
+ }
}
private void updateWallpaperLocked(int displayId) {