• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.hardware.biometrics;
18 
19 import android.os.Bundle;
20 import android.hardware.biometrics.IBiometricConfirmDeviceCredentialCallback;
21 import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback;
22 import android.hardware.biometrics.IBiometricServiceReceiver;
23 
24 /**
25  * Communication channel from BiometricPrompt and BiometricManager to BiometricService. The
26  * interface does not expose specific biometric modalities. The system will use the default
27  * biometric for apps. On devices with more than one, the choice is dictated by user preference in
28  * Settings.
29  * @hide
30  */
31 interface IBiometricService {
32     // Requests authentication. The service choose the appropriate biometric to use, and show
33     // the corresponding BiometricDialog.
34     // TODO(b/123378871): Remove callback when moved.
authenticate(IBinder token, long sessionId, int userId, IBiometricServiceReceiver receiver, String opPackageName, in Bundle bundle, IBiometricConfirmDeviceCredentialCallback callback)35     void authenticate(IBinder token, long sessionId, int userId,
36             IBiometricServiceReceiver receiver, String opPackageName, in Bundle bundle,
37             IBiometricConfirmDeviceCredentialCallback callback);
38 
39     // Cancel authentication for the given sessionId
cancelAuthentication(IBinder token, String opPackageName)40     void cancelAuthentication(IBinder token, String opPackageName);
41 
42     // Checks if biometrics can be used.
canAuthenticate(String opPackageName)43     int canAuthenticate(String opPackageName);
44 
45     // Register callback for when keyguard biometric eligibility changes.
registerEnabledOnKeyguardCallback(IBiometricEnabledOnKeyguardCallback callback)46     void registerEnabledOnKeyguardCallback(IBiometricEnabledOnKeyguardCallback callback);
47 
48     // Explicitly set the active user.
setActiveUser(int userId)49     void setActiveUser(int userId);
50 
51     // Notify BiometricService when <Biometric>Service is ready to start the prepared client.
52     // Client lifecycle is still managed in <Biometric>Service.
onReadyForAuthentication(int cookie, boolean requireConfirmation, int userId)53     void onReadyForAuthentication(int cookie, boolean requireConfirmation, int userId);
54 
55     // Reset the lockout when user authenticates with strong auth (e.g. PIN, pattern or password)
resetLockout(in byte [] token)56     void resetLockout(in byte [] token);
57 
58     // TODO(b/123378871): Remove when moved.
59     // CDCA needs to send results to BiometricService if it was invoked using BiometricPrompt's
60     // setAllowDeviceCredential method, since there's no way for us to intercept onActivityResult.
61     // CDCA is launched from BiometricService (startActivityAsUser) instead of *ForResult.
onConfirmDeviceCredentialSuccess()62     void onConfirmDeviceCredentialSuccess();
63     // TODO(b/123378871): Remove when moved.
onConfirmDeviceCredentialError(int error, String message)64     void onConfirmDeviceCredentialError(int error, String message);
65     // TODO(b/123378871): Remove when moved.
66     // When ConfirmLock* is invoked from BiometricPrompt, it needs to register a callback so that
67     // it can receive the cancellation signal.
registerCancellationCallback(IBiometricConfirmDeviceCredentialCallback callback)68     void registerCancellationCallback(IBiometricConfirmDeviceCredentialCallback callback);
69 }
70