1 /*
2  * Copyright (C) 2019 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.hardware.biometrics.IBiometricServiceReceiverInternal;
20 import android.hardware.biometrics.IBiometricServiceLockoutResetCallback;
21 import android.hardware.face.IFaceServiceReceiver;
22 import android.hardware.face.Face;
23 
24 /**
25  * This interface encapsulates fingerprint, face, iris, etc. authenticators.
26  * Implementations of this interface are meant to be registered with BiometricService.
27  * @hide
28  */
29 interface IBiometricAuthenticator {
30 
31     // This method prepares the service to start authenticating, but doesn't start authentication.
32     // This is protected by the MANAGE_BIOMETRIC signature permission. This method should only be
33     // called from BiometricService. The additional uid, pid, userId arguments should be determined
34     // by BiometricService. To start authentication after the clients are ready, use
35     // startPreparedClient().
prepareForAuthentication(boolean requireConfirmation, IBinder token, long sessionId, int userId, IBiometricServiceReceiverInternal wrapperReceiver, String opPackageName, int cookie, int callingUid, int callingPid, int callingUserId)36     void prepareForAuthentication(boolean requireConfirmation, IBinder token, long sessionId,
37             int userId, IBiometricServiceReceiverInternal wrapperReceiver, String opPackageName,
38             int cookie, int callingUid, int callingPid, int callingUserId);
39 
40     // Starts authentication with the previously prepared client.
startPreparedClient(int cookie)41     void startPreparedClient(int cookie);
42 
43     // Same as above, with extra arguments.
cancelAuthenticationFromService(IBinder token, String opPackageName, int callingUid, int callingPid, int callingUserId, boolean fromClient)44     void cancelAuthenticationFromService(IBinder token, String opPackageName,
45             int callingUid, int callingPid, int callingUserId, boolean fromClient);
46 
47     // Determine if HAL is loaded and ready
isHardwareDetected(String opPackageName)48     boolean isHardwareDetected(String opPackageName);
49 
50     // Determine if a user has at least one enrolled face
hasEnrolledTemplates(int userId, String opPackageName)51     boolean hasEnrolledTemplates(int userId, String opPackageName);
52 
53     // Reset the lockout when user authenticates with strong auth (e.g. PIN, pattern or password)
resetLockout(in byte [] token)54     void resetLockout(in byte [] token);
55 
56     // Explicitly set the active user (for enrolling work profile)
setActiveUser(int uid)57     void setActiveUser(int uid);
58 
59     // Gets the authenticator ID representing the current set of enrolled templates
getAuthenticatorId(int callingUserId)60     long getAuthenticatorId(int callingUserId);
61 }
62