summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-02-10 06:23:25 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-02-10 06:23:25 +0000
commitdbdce2174f359fbc3a08801e9ca4242904425b80 (patch)
tree93017b54443f6a457b14f2b8837836710230c46a
parent615fa5fd2adb79e875d9d2d3d1cd294358d0fc39 (diff)
parent92bf23dde8aa10838ead8436478fd9f3b1f35685 (diff)
downloadbase-dbdce2174f359fbc3a08801e9ca4242904425b80.tar.gz
Merge cherrypicks of ['googleplex-android-review.googlesource.com/21273360'] into tm-d4-release.
Change-Id: I3c7b607fbe6ac663fb9123079f23b7e06fb6ca94
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java18
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java25
2 files changed, 38 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 90ed293c73c9..9a898f9c47d5 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -93,6 +93,7 @@ import android.hardware.biometrics.BiometricFingerprintConstants;
import android.hardware.biometrics.BiometricManager;
import android.hardware.biometrics.BiometricSourceType;
import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback;
+import android.hardware.biometrics.SensorProperties;
import android.hardware.face.FaceManager;
import android.hardware.face.FaceSensorPropertiesInternal;
import android.hardware.fingerprint.FingerprintManager;
@@ -2952,6 +2953,23 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
return isUnlockWithFacePossible(userId) || isUnlockWithFingerprintPossible(userId);
}
+ /**
+ * If non-strong (i.e. weak or convenience) biometrics hardware is available, not disabled, and
+ * user has enrolled templates. This does NOT check if the device is encrypted or in lockdown.
+ *
+ * @param userId User that's trying to unlock.
+ * @return {@code true} if possible.
+ */
+ public boolean isUnlockingWithNonStrongBiometricsPossible(int userId) {
+ // This assumes that there is at most one face and at most one fingerprint sensor
+ return (mFaceManager != null && !mFaceSensorProperties.isEmpty()
+ && (mFaceSensorProperties.get(0).sensorStrength != SensorProperties.STRENGTH_STRONG)
+ && isUnlockWithFacePossible(userId))
+ || (mFpm != null && !mFingerprintSensorProperties.isEmpty()
+ && (mFingerprintSensorProperties.get(0).sensorStrength
+ != SensorProperties.STRENGTH_STRONG) && isUnlockWithFingerprintPossible(userId));
+ }
+
@SuppressLint("MissingPermission")
@VisibleForTesting
boolean isUnlockWithFingerprintPossible(int userId) {
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 6ed555056cb1..739b3252f7bf 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -2411,15 +2411,28 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
}
mKeyguardDisplayManager.show();
- // schedule 4hr idle timeout after which non-strong biometrics (i.e. weak or convenience
- // biometric) can't be used to unlock device until unlocking with strong biometric or
- // primary auth (i.e. PIN/pattern/password)
- mLockPatternUtils.scheduleNonStrongBiometricIdleTimeout(
- KeyguardUpdateMonitor.getCurrentUser());
+ scheduleNonStrongBiometricIdleTimeout();
Trace.endSection();
}
+ /**
+ * Schedule 4-hour idle timeout for non-strong biometrics when the device is locked
+ */
+ private void scheduleNonStrongBiometricIdleTimeout() {
+ final int currentUser = KeyguardUpdateMonitor.getCurrentUser();
+ // If unlocking with non-strong (i.e. weak or convenience) biometrics is possible, schedule
+ // 4hr idle timeout after which non-strong biometrics can't be used to unlock device until
+ // unlocking with strong biometric or primary auth (i.e. PIN/pattern/password)
+ if (mUpdateMonitor.isUnlockingWithNonStrongBiometricsPossible(currentUser)) {
+ if (DEBUG) {
+ Log.d(TAG, "scheduleNonStrongBiometricIdleTimeout: schedule an alarm for "
+ + "currentUser=" + currentUser);
+ }
+ mLockPatternUtils.scheduleNonStrongBiometricIdleTimeout(currentUser);
+ }
+ }
+
private final Runnable mKeyguardGoingAwayRunnable = new Runnable() {
@Override
public void run() {
@@ -2898,6 +2911,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
if (DEBUG) Log.d(TAG, "handleReset");
mKeyguardViewControllerLazy.get().reset(true /* hideBouncerWhenShowing */);
}
+
+ scheduleNonStrongBiometricIdleTimeout();
}
/**