diff --git a/core/java/android/hardware/biometrics/BiometricPrompt.java b/core/java/android/hardware/biometrics/BiometricPrompt.java index c686624fb33b0..196242e667698 100644 --- a/core/java/android/hardware/biometrics/BiometricPrompt.java +++ b/core/java/android/hardware/biometrics/BiometricPrompt.java @@ -388,7 +388,7 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan private final IBinder mToken = new Binder(); private final Context mContext; - private final IBiometricService mService; + private final IAuthService mService; private final Bundle mBundle; private final ButtonInfo mPositiveButtonInfo; private final ButtonInfo mNegativeButtonInfo; @@ -466,8 +466,8 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan mBundle = bundle; mPositiveButtonInfo = positiveButtonInfo; mNegativeButtonInfo = negativeButtonInfo; - mService = IBiometricService.Stub.asInterface( - ServiceManager.getService(Context.BIOMETRIC_SERVICE)); + mService = IAuthService.Stub.asInterface( + ServiceManager.getService(Context.AUTH_SERVICE)); } /** diff --git a/core/java/android/hardware/biometrics/IAuthService.aidl b/core/java/android/hardware/biometrics/IAuthService.aidl index d482198b82b31..2bf681f51410c 100644 --- a/core/java/android/hardware/biometrics/IAuthService.aidl +++ b/core/java/android/hardware/biometrics/IAuthService.aidl @@ -33,6 +33,9 @@ interface IAuthService { void authenticate(IBinder token, long sessionId, int userId, IBiometricServiceReceiver receiver, String opPackageName, in Bundle bundle); + // Cancel authentication for the given sessionId + void cancelAuthentication(IBinder token, String opPackageName); + // TODO(b/141025588): Make userId the first arg to be consistent with hasEnrolledBiometrics. // Checks if biometrics can be used. int canAuthenticate(String opPackageName, int userId, int authenticators); diff --git a/services/core/java/com/android/server/biometrics/AuthService.java b/services/core/java/com/android/server/biometrics/AuthService.java index 0f549842a7638..9c61be88d33e7 100644 --- a/services/core/java/com/android/server/biometrics/AuthService.java +++ b/services/core/java/com/android/server/biometrics/AuthService.java @@ -150,11 +150,20 @@ public class AuthService extends SystemService { Slog.e(TAG, "Unable to authenticate, one or more null arguments"); return; } - mBiometricService.authenticate(token, sessionId, userId, receiver, opPackageName, bundle); } + public void cancelAuthentication(IBinder token, String opPackageName) + throws RemoteException { + checkPermission(); + if (token == null || opPackageName == null) { + Slog.e(TAG, "Unable to authenticate, one or more null arguments"); + return; + } + mBiometricService.cancelAuthentication(token, opPackageName); + } + @Override public int canAuthenticate(String opPackageName, int userId, @Authenticators.Types int authenticators) throws RemoteException {