Only show face unlock indication if it applies
When trust is not managed or the indication is set for
a different than the current user, don't show it on the
lock screen.
Bug: 17034124
Change-Id: Ia470520d6bd05db8417b3b0bb1f55894f791554e
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java
index 58196f7..e5eef9d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java
@@ -38,6 +38,7 @@
private final ArrayList<OnUnlockMethodChangedListener> mListeners = new ArrayList<>();
private boolean mMethodInsecure;
private boolean mTrustManaged;
+ private boolean mFaceUnlockRunning;
private UnlockMethodCache(Context ctx) {
mLockPatternUtils = new LockPatternUtils(ctx);
@@ -73,10 +74,14 @@
boolean methodInsecure = !mLockPatternUtils.isSecure() ||
mKeyguardUpdateMonitor.getUserHasTrust(user);
boolean trustManaged = mKeyguardUpdateMonitor.getUserTrustIsManaged(user);
- boolean changed = methodInsecure != mMethodInsecure || trustManaged != mTrustManaged;
+ boolean faceUnlockRunning = mKeyguardUpdateMonitor.isFaceUnlockRunning(user)
+ && trustManaged;
+ boolean changed = methodInsecure != mMethodInsecure || trustManaged != mTrustManaged
+ || faceUnlockRunning != mFaceUnlockRunning;
if (changed || updateAlways) {
mMethodInsecure = methodInsecure;
mTrustManaged = trustManaged;
+ mFaceUnlockRunning = faceUnlockRunning;
notifyListeners(mMethodInsecure);
}
}
@@ -112,12 +117,21 @@
public void onFingerprintRecognized(int userId) {
updateMethodSecure(false /* updateAlways */);
}
+
+ @Override
+ public void onFaceUnlockStateChanged(boolean running, int userId) {
+ updateMethodSecure(false /* updateAlways */);
+ }
};
public boolean isTrustManaged() {
return mTrustManaged;
}
+ public boolean isFaceUnlockRunning() {
+ return mFaceUnlockRunning;
+ }
+
public static interface OnUnlockMethodChangedListener {
void onMethodSecureChanged(boolean methodSecure);
}