summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author joshmccloskey <joshmccloskey@google.com> 2020-02-04 13:27:03 -0800
committer Curtis Belmonte <curtislb@google.com> 2020-02-10 10:32:49 -0800
commita8f15a5d2e8913e595d6db59dbff378c257673d2 (patch)
tree85c97c3370cf2176de677f08f54159cc2de26d24
parentf873dd267e9cc4167465811a6a6f976e53104c8d (diff)
Configure BiometricPrompt to use AuthService.
BioetricPrompt was incorrectly using BiometricService directly. After adding a few minor modifications, BiometricPrompt correctly goes through AuthService. Test: Verified that BiometricPromptDemo apk is able to authenticate. Test: Verified that BiometricPromptDemo apk is able to cancel authenticatoins. Bug: 141025588 Change-Id: I29646c33a1904c6ad71f3ed2a4b02b6fe159517b
-rw-r--r--core/java/android/hardware/biometrics/BiometricPrompt.java6
-rw-r--r--core/java/android/hardware/biometrics/IAuthService.aidl3
-rw-r--r--services/core/java/com/android/server/biometrics/AuthService.java11
3 files changed, 16 insertions, 4 deletions
diff --git a/core/java/android/hardware/biometrics/BiometricPrompt.java b/core/java/android/hardware/biometrics/BiometricPrompt.java
index c686624fb33b..196242e66769 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 d482198b82b3..2bf681f51410 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 0f549842a763..9c61be88d33e 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 {