2 * Copyright (C) 2018 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package android.hardware.biometrics;
19 import android.os.Bundle;
20 import android.hardware.biometrics.IBiometricConfirmDeviceCredentialCallback;
21 import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback;
22 import android.hardware.biometrics.IBiometricServiceReceiver;
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
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.
35 void authenticate(IBinder token, long sessionId, int userId,
36 IBiometricServiceReceiver receiver, String opPackageName, in Bundle bundle,
37 IBiometricConfirmDeviceCredentialCallback callback);
39 // Cancel authentication for the given sessionId
40 void cancelAuthentication(IBinder token, String opPackageName);
42 // Checks if biometrics can be used.
43 int canAuthenticate(String opPackageName);
45 // Register callback for when keyguard biometric eligibility changes.
46 void registerEnabledOnKeyguardCallback(IBiometricEnabledOnKeyguardCallback callback);
48 // Explicitly set the active user.
49 void setActiveUser(int userId);
51 // Notify BiometricService when <Biometric>Service is ready to start the prepared client.
52 // Client lifecycle is still managed in <Biometric>Service.
53 void onReadyForAuthentication(int cookie, boolean requireConfirmation, int userId);
55 // Reset the lockout when user authenticates with strong auth (e.g. PIN, pattern or password)
56 void resetLockout(in byte [] token);
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.
62 void onConfirmDeviceCredentialSuccess();
63 // TODO(b/123378871): Remove when moved.
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.
68 void registerCancellationCallback(IBiometricConfirmDeviceCredentialCallback callback);