Loading core/java/android/hardware/biometrics/BiometricAuthenticator.java +4 −0 Original line number Diff line number Diff line Loading @@ -201,6 +201,10 @@ public interface BiometricAuthenticator { throw new UnsupportedOperationException("Stub!"); } default boolean hasEnrolledTemplates(int userId) { throw new UnsupportedOperationException("Stub!"); } /** * This call warms up the hardware and starts scanning for valid biometrics. It terminates * when {@link AuthenticationCallback#onAuthenticationError(int, Loading core/java/android/hardware/face/FaceManager.java +1 −0 Original line number Diff line number Diff line Loading @@ -408,6 +408,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan @RequiresPermission(allOf = { USE_BIOMETRIC_INTERNAL, INTERACT_ACROSS_USERS}) @Override public boolean hasEnrolledTemplates(int userId) { if (mService != null) { try { Loading core/java/android/hardware/fingerprint/FingerprintManager.java +8 −0 Original line number Diff line number Diff line Loading @@ -636,6 +636,14 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing return hasEnrolledFingerprints(); } /** * @hide */ @Override public boolean hasEnrolledTemplates(int userId) { return hasEnrolledFingerprints(userId); } /** * Determine if there is at least one fingerprint enrolled. * Loading services/core/java/com/android/server/biometrics/BiometricService.java +8 −4 Original line number Diff line number Diff line Loading @@ -260,7 +260,7 @@ public class BiometricService extends SystemService { final int callingUserId = UserHandle.getCallingUserId(); mHandler.post(() -> { final Pair<Integer, Integer> result = checkAndGetBiometricModality(); final Pair<Integer, Integer> result = checkAndGetBiometricModality(callingUserId); final int modality = result.first; final int error = result.second; Loading Loading @@ -351,10 +351,11 @@ public class BiometricService extends SystemService { checkPermission(); checkAppOp(opPackageName, Binder.getCallingUid()); final int userId = UserHandle.getCallingUserId(); final long ident = Binder.clearCallingIdentity(); int error; try { final Pair<Integer, Integer> result = checkAndGetBiometricModality(); final Pair<Integer, Integer> result = checkAndGetBiometricModality(userId); error = result.second; } finally { Binder.restoreCallingIdentity(ident); Loading Loading @@ -466,7 +467,7 @@ public class BiometricService extends SystemService { * {@link #BIOMETRIC_FINGERPRINT}, {@link #BIOMETRIC_IRIS}, {@link #BIOMETRIC_FACE} * and the error containing one of the {@link BiometricConstants} errors. */ private Pair<Integer, Integer> checkAndGetBiometricModality() { private Pair<Integer, Integer> checkAndGetBiometricModality(int callingUid) { int modality = BIOMETRIC_NONE; // No biometric features, send error Loading Loading @@ -495,9 +496,12 @@ public class BiometricService extends SystemService { // order. firstHwAvailable = modality; } if (authenticator.hasEnrolledTemplates()) { if (authenticator.hasEnrolledTemplates(callingUid)) { hasTemplatesEnrolled = true; if (isEnabledForApp(modality)) { // TODO(b/110907543): When face settings (and other settings) have both a // user toggle as well as a work profile settings page, this needs to be // updated to reflect the correct setting. enabledForApps = true; break; } Loading Loading
core/java/android/hardware/biometrics/BiometricAuthenticator.java +4 −0 Original line number Diff line number Diff line Loading @@ -201,6 +201,10 @@ public interface BiometricAuthenticator { throw new UnsupportedOperationException("Stub!"); } default boolean hasEnrolledTemplates(int userId) { throw new UnsupportedOperationException("Stub!"); } /** * This call warms up the hardware and starts scanning for valid biometrics. It terminates * when {@link AuthenticationCallback#onAuthenticationError(int, Loading
core/java/android/hardware/face/FaceManager.java +1 −0 Original line number Diff line number Diff line Loading @@ -408,6 +408,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan @RequiresPermission(allOf = { USE_BIOMETRIC_INTERNAL, INTERACT_ACROSS_USERS}) @Override public boolean hasEnrolledTemplates(int userId) { if (mService != null) { try { Loading
core/java/android/hardware/fingerprint/FingerprintManager.java +8 −0 Original line number Diff line number Diff line Loading @@ -636,6 +636,14 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing return hasEnrolledFingerprints(); } /** * @hide */ @Override public boolean hasEnrolledTemplates(int userId) { return hasEnrolledFingerprints(userId); } /** * Determine if there is at least one fingerprint enrolled. * Loading
services/core/java/com/android/server/biometrics/BiometricService.java +8 −4 Original line number Diff line number Diff line Loading @@ -260,7 +260,7 @@ public class BiometricService extends SystemService { final int callingUserId = UserHandle.getCallingUserId(); mHandler.post(() -> { final Pair<Integer, Integer> result = checkAndGetBiometricModality(); final Pair<Integer, Integer> result = checkAndGetBiometricModality(callingUserId); final int modality = result.first; final int error = result.second; Loading Loading @@ -351,10 +351,11 @@ public class BiometricService extends SystemService { checkPermission(); checkAppOp(opPackageName, Binder.getCallingUid()); final int userId = UserHandle.getCallingUserId(); final long ident = Binder.clearCallingIdentity(); int error; try { final Pair<Integer, Integer> result = checkAndGetBiometricModality(); final Pair<Integer, Integer> result = checkAndGetBiometricModality(userId); error = result.second; } finally { Binder.restoreCallingIdentity(ident); Loading Loading @@ -466,7 +467,7 @@ public class BiometricService extends SystemService { * {@link #BIOMETRIC_FINGERPRINT}, {@link #BIOMETRIC_IRIS}, {@link #BIOMETRIC_FACE} * and the error containing one of the {@link BiometricConstants} errors. */ private Pair<Integer, Integer> checkAndGetBiometricModality() { private Pair<Integer, Integer> checkAndGetBiometricModality(int callingUid) { int modality = BIOMETRIC_NONE; // No biometric features, send error Loading Loading @@ -495,9 +496,12 @@ public class BiometricService extends SystemService { // order. firstHwAvailable = modality; } if (authenticator.hasEnrolledTemplates()) { if (authenticator.hasEnrolledTemplates(callingUid)) { hasTemplatesEnrolled = true; if (isEnabledForApp(modality)) { // TODO(b/110907543): When face settings (and other settings) have both a // user toggle as well as a work profile settings page, this needs to be // updated to reflect the correct setting. enabledForApps = true; break; } Loading