summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Beverly <beverlyt@google.com> 2022-03-24 13:34:08 +0000
committer Beverly Tai <beverlyt@google.com> 2022-03-24 13:49:36 +0000
commitd5584538f1aef379840ed1748a8b990670a68f11 (patch)
tree979760a2bf1e4331338423555f163ced6c5affbd
parentad2185f625ce072741f548de74f2f268e0c6fd58 (diff)
Add Keyguard DPM state change callback
DevicePolicyManager can change the security mode (ie: pin/pattern/password/none), so on DPM state changes, update SecurityContainer so that the Bouncer will be in the correct security mode if there are any changes while the device is already on the keyguard. Prior to this CL, the security mode would eventually be reset when the device went to sleep & woke back up; however, this issue was causing flaky & slow tests. Test: manual From home screen: adb shell locksettings set-pin "1234" From lock screen: adb shell locksettings clear --old "1234" On lock screen: adb shell wm dismiss-keyguard Observe & expect: keyguard is dismissed (previously bouncer would show) Fixes: 223440441 Change-Id: I22281dcc85d75509f1a754d57359d5f862e3d8d0
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java9
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java10
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java5
3 files changed, 23 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java
index 57997d8efd6f..1a325d3586f4 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java
@@ -233,6 +233,13 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
mSecurityViewFlipperController.reloadColors();
}
};
+ private final KeyguardUpdateMonitorCallback mKeyguardUpdateMonitorCallback =
+ new KeyguardUpdateMonitorCallback() {
+ @Override
+ public void onDevicePolicyManagerStateChanged() {
+ showPrimarySecurityScreen(false);
+ }
+ };
private KeyguardSecurityContainerController(KeyguardSecurityContainer view,
AdminSecondaryLockScreenController.Factory adminSecondaryLockScreenControllerFactory,
@@ -279,6 +286,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
@Override
protected void onViewAttached() {
+ mUpdateMonitor.registerCallback(mKeyguardUpdateMonitorCallback);
mView.setSwipeListener(mSwipeListener);
mView.addMotionEventListener(mGlobalTouchListener);
mConfigurationController.addCallback(mConfigurationListener);
@@ -286,6 +294,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
@Override
protected void onViewDetached() {
+ mUpdateMonitor.removeCallback(mKeyguardUpdateMonitorCallback);
mConfigurationController.removeCallback(mConfigurationListener);
mView.removeMotionEventListener(mGlobalTouchListener);
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 74a88bd5f19a..d2a0eb3ce450 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -2717,12 +2717,20 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
}
/**
- * Handle {@link #MSG_DPM_STATE_CHANGED}
+ * Handle {@link #MSG_DPM_STATE_CHANGED} which can change primary authentication methods to
+ * pin/pattern/password/none.
*/
private void handleDevicePolicyManagerStateChanged(int userId) {
Assert.isMainThread();
updateFingerprintListeningState(BIOMETRIC_ACTION_UPDATE);
updateSecondaryLockscreenRequirement(userId);
+
+ for (int i = 0; i < mCallbacks.size(); i++) {
+ KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
+ if (cb != null) {
+ cb.onDevicePolicyManagerStateChanged();
+ }
+ }
}
/**
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
index ad2053cbc31b..9373ea8f459c 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
@@ -300,6 +300,11 @@ public class KeyguardUpdateMonitorCallback {
public void onSecondaryLockscreenRequirementChanged(int userId) { }
/**
+ * Called when device policy manager state changes.
+ */
+ public void onDevicePolicyManagerStateChanged() { }
+
+ /**
* Called when notifying user to unlock in order to use NFC.
*/
public void onRequireUnlockForNfc() { }