Merge "Generate challenge and reset lockout only if user has enrolled biometrics" into qt-dev
This commit is contained in:
@@ -760,7 +760,6 @@ public class BiometricService extends SystemService {
|
|||||||
@Override // Binder call
|
@Override // Binder call
|
||||||
public int canAuthenticate(String opPackageName) {
|
public int canAuthenticate(String opPackageName) {
|
||||||
checkPermission();
|
checkPermission();
|
||||||
checkAppOp(opPackageName, Binder.getCallingUid());
|
|
||||||
|
|
||||||
final int userId = UserHandle.getCallingUserId();
|
final int userId = UserHandle.getCallingUserId();
|
||||||
final long ident = Binder.clearCallingIdentity();
|
final long ident = Binder.clearCallingIdentity();
|
||||||
@@ -833,9 +832,9 @@ public class BiometricService extends SystemService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkPermission() {
|
private void checkPermission() {
|
||||||
if (getContext().checkCallingPermission(USE_FINGERPRINT)
|
if (getContext().checkCallingOrSelfPermission(USE_FINGERPRINT)
|
||||||
!= PackageManager.PERMISSION_GRANTED) {
|
!= PackageManager.PERMISSION_GRANTED) {
|
||||||
getContext().enforceCallingPermission(USE_BIOMETRIC,
|
getContext().enforceCallingOrSelfPermission(USE_BIOMETRIC,
|
||||||
"Must have USE_BIOMETRIC permission");
|
"Must have USE_BIOMETRIC permission");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -421,8 +421,9 @@ public class LockSettingsService extends ILockSettings.Stub {
|
|||||||
new PasswordSlotManager());
|
new PasswordSlotManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasBiometrics() {
|
public boolean hasEnrolledBiometrics() {
|
||||||
return BiometricManager.hasBiometrics(mContext);
|
BiometricManager bm = mContext.getSystemService(BiometricManager.class);
|
||||||
|
return bm.canAuthenticate() == BiometricManager.BIOMETRIC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int binderGetCallingUid() {
|
public int binderGetCallingUid() {
|
||||||
@@ -2502,7 +2503,8 @@ public class LockSettingsService extends ILockSettings.Stub {
|
|||||||
// TODO: When lockout is handled under the HAL for all biometrics (fingerprint),
|
// TODO: When lockout is handled under the HAL for all biometrics (fingerprint),
|
||||||
// we need to generate challenge for each one, have it signed by GK and reset lockout
|
// we need to generate challenge for each one, have it signed by GK and reset lockout
|
||||||
// for each modality.
|
// for each modality.
|
||||||
if (!hasChallenge && pm.hasSystemFeature(PackageManager.FEATURE_FACE)) {
|
if (!hasChallenge && pm.hasSystemFeature(PackageManager.FEATURE_FACE)
|
||||||
|
&& mInjector.hasEnrolledBiometrics()) {
|
||||||
challenge = mContext.getSystemService(FaceManager.class).generateChallenge();
|
challenge = mContext.getSystemService(FaceManager.class).generateChallenge();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2544,8 +2546,8 @@ public class LockSettingsService extends ILockSettings.Stub {
|
|||||||
if (response.getResponseCode() == VerifyCredentialResponse.RESPONSE_OK) {
|
if (response.getResponseCode() == VerifyCredentialResponse.RESPONSE_OK) {
|
||||||
notifyActivePasswordMetricsAvailable(credentialType, userCredential, userId);
|
notifyActivePasswordMetricsAvailable(credentialType, userCredential, userId);
|
||||||
unlockKeystore(authResult.authToken.deriveKeyStorePassword(), userId);
|
unlockKeystore(authResult.authToken.deriveKeyStorePassword(), userId);
|
||||||
// Reset lockout
|
// Reset lockout only if user has enrolled templates
|
||||||
if (mInjector.hasBiometrics()) {
|
if (mInjector.hasEnrolledBiometrics()) {
|
||||||
BiometricManager bm = mContext.getSystemService(BiometricManager.class);
|
BiometricManager bm = mContext.getSystemService(BiometricManager.class);
|
||||||
Slog.i(TAG, "Resetting lockout, length: "
|
Slog.i(TAG, "Resetting lockout, length: "
|
||||||
+ authResult.gkResponse.getPayload().length);
|
+ authResult.gkResponse.getPayload().length);
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ public class LockSettingsServiceTestable extends LockSettingsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasBiometrics() {
|
public boolean hasEnrolledBiometrics() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user