Merge "Schedule idle timeout when Keyguard state is reset and only if possible" into tm-qpr-dev
This commit is contained in:
@@ -94,6 +94,7 @@ import android.hardware.biometrics.BiometricFingerprintConstants;
|
|||||||
import android.hardware.biometrics.BiometricManager;
|
import android.hardware.biometrics.BiometricManager;
|
||||||
import android.hardware.biometrics.BiometricSourceType;
|
import android.hardware.biometrics.BiometricSourceType;
|
||||||
import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback;
|
import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback;
|
||||||
|
import android.hardware.biometrics.SensorProperties;
|
||||||
import android.hardware.face.FaceManager;
|
import android.hardware.face.FaceManager;
|
||||||
import android.hardware.face.FaceSensorPropertiesInternal;
|
import android.hardware.face.FaceSensorPropertiesInternal;
|
||||||
import android.hardware.fingerprint.FingerprintManager;
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
@@ -2999,6 +3000,23 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
return isUnlockWithFacePossible(userId) || isUnlockWithFingerprintPossible(userId);
|
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")
|
@SuppressLint("MissingPermission")
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
boolean isUnlockWithFingerprintPossible(int userId) {
|
boolean isUnlockWithFingerprintPossible(int userId) {
|
||||||
|
|||||||
@@ -2445,15 +2445,28 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
|
|||||||
}
|
}
|
||||||
mKeyguardDisplayManager.show();
|
mKeyguardDisplayManager.show();
|
||||||
|
|
||||||
// schedule 4hr idle timeout after which non-strong biometrics (i.e. weak or convenience
|
scheduleNonStrongBiometricIdleTimeout();
|
||||||
// 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());
|
|
||||||
|
|
||||||
Trace.endSection();
|
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() {
|
private final Runnable mKeyguardGoingAwayRunnable = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -2947,6 +2960,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
|
|||||||
if (DEBUG) Log.d(TAG, "handleReset");
|
if (DEBUG) Log.d(TAG, "handleReset");
|
||||||
mKeyguardViewControllerLazy.get().reset(true /* hideBouncerWhenShowing */);
|
mKeyguardViewControllerLazy.get().reset(true /* hideBouncerWhenShowing */);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scheduleNonStrongBiometricIdleTimeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user