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.IBiometricSensorReceiver; 20 import android.hardware.biometrics.IBiometricServiceLockoutResetCallback; 21 import android.hardware.biometrics.IInvalidationCallback; 22 import android.hardware.biometrics.ITestSession; 23 import android.hardware.biometrics.ITestSessionCallback; 24 import android.hardware.biometrics.SensorPropertiesInternal; 25 import android.hardware.face.IFaceServiceReceiver; 26 import android.hardware.face.Face; 27 28 /** 29 * This interface encapsulates fingerprint, face, iris, etc. authenticators. 30 * Implementations of this interface are meant to be registered with BiometricService. 31 * @hide 32 */ 33 interface IBiometricAuthenticator { 34 35 // Creates a test session createTestSession(ITestSessionCallback callback, String opPackageName)36 ITestSession createTestSession(ITestSessionCallback callback, String opPackageName); 37 38 // Retrieve static sensor properties getSensorProperties(String opPackageName)39 SensorPropertiesInternal getSensorProperties(String opPackageName); 40 41 // Requests a proto dump of the sensor. See biometrics.proto dumpSensorServiceStateProto(boolean clearSchedulerBuffer)42 byte[] dumpSensorServiceStateProto(boolean clearSchedulerBuffer); 43 44 // This method prepares the service to start authenticating, but doesn't start authentication. 45 // This is protected by the MANAGE_BIOMETRIC signature permission. This method should only be 46 // called from BiometricService. The additional uid, pid, userId arguments should be determined 47 // by BiometricService. To start authentication after the clients are ready, use 48 // startPreparedClient(). prepareForAuthentication(boolean requireConfirmation, IBinder token, long operationId, int userId, IBiometricSensorReceiver sensorReceiver, String opPackageName, long requestId, int cookie, boolean allowBackgroundAuthentication, boolean isForLegacyFingerprintManager)49 void prepareForAuthentication(boolean requireConfirmation, IBinder token, long operationId, 50 int userId, IBiometricSensorReceiver sensorReceiver, String opPackageName, 51 long requestId, int cookie, boolean allowBackgroundAuthentication, 52 boolean isForLegacyFingerprintManager); 53 54 // Starts authentication with the previously prepared client. startPreparedClient(int cookie)55 void startPreparedClient(int cookie); 56 57 // Cancels authentication for the given requestId. cancelAuthenticationFromService(IBinder token, String opPackageName, long requestId)58 void cancelAuthenticationFromService(IBinder token, String opPackageName, long requestId); 59 60 // Determine if HAL is loaded and ready isHardwareDetected(String opPackageName)61 boolean isHardwareDetected(String opPackageName); 62 63 // Determine if a user has at least one enrolled face hasEnrolledTemplates(int userId, String opPackageName)64 boolean hasEnrolledTemplates(int userId, String opPackageName); 65 66 // Return the LockoutTracker status for the specified user getLockoutModeForUser(int userId)67 int getLockoutModeForUser(int userId); 68 69 // Request the authenticatorId to be invalidated for the specified user invalidateAuthenticatorId(int userId, IInvalidationCallback callback)70 void invalidateAuthenticatorId(int userId, IInvalidationCallback callback); 71 72 // Gets the authenticator ID representing the current set of enrolled templates getAuthenticatorId(int callingUserId)73 long getAuthenticatorId(int callingUserId); 74 75 // Requests the sensor to reset its lockout state resetLockout(IBinder token, String opPackageName, int userId, in byte[] hardwareAuthToken)76 void resetLockout(IBinder token, String opPackageName, int userId, 77 in byte[] hardwareAuthToken); 78 } 79