From 6ec76b728871407cf19fac4bd802e1b0eb3a2a30 Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Wed, 25 Apr 2018 14:01:11 +0200 Subject: [PATCH] Keyguard: fix possible divergent state Fixes an issue where the state in SystemUI and AM/WM could get out of sync: If the keyguardGoingAway transition is started and then later canceled by SystemUI, it never tells AM that it canceled it. This causes SystemUI to show itself in keyguard mode, meanwhile AM/WM do not hide the underlying app because the status bar is in the going away transition as far as it is concerned. Change-Id: I5966f0655fd694ae599a83dda7a9f6463088632b Fixes: 76367931 Test: delay keyguard going away callback, unlock phone, during the delay, remove SIM; verify it does not end up in bad state --- .../src/com/android/systemui/keyguard/KeyguardViewMediator.java | 2 ++ .../core/java/com/android/server/am/KeyguardController.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 5993c396d0a10..0e560f27924f9 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -1857,6 +1857,8 @@ public class KeyguardViewMediator extends SystemUI { synchronized (KeyguardViewMediator.this) { if (!mHiding) { + // Tell ActivityManager that we canceled the keyguardExitAnimation. + setShowingLocked(mShowing, mAodShowing, mSecondaryDisplayShowing, true /* force */); return; } mHiding = false; diff --git a/services/core/java/com/android/server/am/KeyguardController.java b/services/core/java/com/android/server/am/KeyguardController.java index 1b7f75b2d52cd..57643822b1a43 100644 --- a/services/core/java/com/android/server/am/KeyguardController.java +++ b/services/core/java/com/android/server/am/KeyguardController.java @@ -121,6 +121,8 @@ class KeyguardController { void setKeyguardShown(boolean keyguardShowing, boolean aodShowing, int secondaryDisplayShowing) { boolean showingChanged = keyguardShowing != mKeyguardShowing || aodShowing != mAodShowing; + // If keyguard is going away, but SystemUI aborted the transition, need to reset state. + showingChanged |= mKeyguardGoingAway && keyguardShowing; if (!showingChanged && secondaryDisplayShowing == mSecondaryDisplayShowing) { return; }