1 /* 2 * Copyright (C) 2014 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 package android.hardware.fingerprint; 17 18 import android.hardware.biometrics.IBiometricSensorReceiver; 19 import android.hardware.biometrics.IBiometricServiceLockoutResetCallback; 20 import android.hardware.biometrics.IBiometricStateListener; 21 import android.hardware.biometrics.IInvalidationCallback; 22 import android.hardware.biometrics.ITestSession; 23 import android.hardware.biometrics.ITestSessionCallback; 24 import android.hardware.fingerprint.IFingerprintClientActiveCallback; 25 import android.hardware.fingerprint.IFingerprintAuthenticatorsRegisteredCallback; 26 import android.hardware.fingerprint.IFingerprintServiceReceiver; 27 import android.hardware.fingerprint.IUdfpsOverlayController; 28 import android.hardware.fingerprint.ISidefpsController; 29 import android.hardware.fingerprint.Fingerprint; 30 import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; 31 import java.util.List; 32 33 /** 34 * Communication channel from client to the fingerprint service. 35 * @hide 36 */ 37 interface IFingerprintService { 38 39 // Creates a test session with the specified sensorId createTestSession(int sensorId, ITestSessionCallback callback, String opPackageName)40 ITestSession createTestSession(int sensorId, ITestSessionCallback callback, String opPackageName); 41 42 // Requests a proto dump of the specified sensor dumpSensorServiceStateProto(int sensorId, boolean clearSchedulerBuffer)43 byte[] dumpSensorServiceStateProto(int sensorId, boolean clearSchedulerBuffer); 44 45 // Retrieve static sensor properties for all fingerprint sensors getSensorPropertiesInternal(String opPackageName)46 List<FingerprintSensorPropertiesInternal> getSensorPropertiesInternal(String opPackageName); 47 48 // Retrieve static sensor properties for the specified sensor getSensorProperties(int sensorId, String opPackageName)49 FingerprintSensorPropertiesInternal getSensorProperties(int sensorId, String opPackageName); 50 51 // Authenticate with a fingerprint. This is protected by USE_FINGERPRINT/USE_BIOMETRIC 52 // permission. This is effectively deprecated, since it only comes through FingerprintManager 53 // now. A requestId is returned that can be used to cancel this operation. authenticate(IBinder token, long operationId, int sensorId, int userId, IFingerprintServiceReceiver receiver, String opPackageName, String attributionTag, boolean shouldIgnoreEnrollmentState)54 long authenticate(IBinder token, long operationId, int sensorId, int userId, 55 IFingerprintServiceReceiver receiver, String opPackageName, String attributionTag, 56 boolean shouldIgnoreEnrollmentState); 57 58 // Uses the fingerprint hardware to detect for the presence of a finger, without giving details 59 // about accept/reject/lockout. A requestId is returned that can be used to cancel this 60 // operation. detectFingerprint(IBinder token, int userId, IFingerprintServiceReceiver receiver, String opPackageName)61 long detectFingerprint(IBinder token, int userId, IFingerprintServiceReceiver receiver, 62 String opPackageName); 63 64 // This method prepares the service to start authenticating, but doesn't start authentication. 65 // This is protected by the MANAGE_BIOMETRIC signatuer permission. This method should only be 66 // called from BiometricService. The additional uid, pid, userId arguments should be determined 67 // by BiometricService. To start authentication after the clients are ready, use 68 // startPreparedClient(). prepareForAuthentication(int sensorId, IBinder token, long operationId, int userId, IBiometricSensorReceiver sensorReceiver, String opPackageName, long requestId, int cookie, boolean allowBackgroundAuthentication)69 void prepareForAuthentication(int sensorId, IBinder token, long operationId, int userId, 70 IBiometricSensorReceiver sensorReceiver, String opPackageName, long requestId, 71 int cookie, boolean allowBackgroundAuthentication); 72 73 // Starts authentication with the previously prepared client. startPreparedClient(int sensorId, int cookie)74 void startPreparedClient(int sensorId, int cookie); 75 76 // Cancel authentication for the given requestId. cancelAuthentication(IBinder token, String opPackageName, String attributionTag, long requestId)77 void cancelAuthentication(IBinder token, String opPackageName, String attributionTag, long requestId); 78 79 // Cancel finger detection for the given requestId. cancelFingerprintDetect(IBinder token, String opPackageName, long requestId)80 void cancelFingerprintDetect(IBinder token, String opPackageName, long requestId); 81 82 // Same as above, except this is protected by the MANAGE_BIOMETRIC signature permission. Takes 83 // an additional uid, pid, userid. cancelAuthenticationFromService(int sensorId, IBinder token, String opPackageName, long requestId)84 void cancelAuthenticationFromService(int sensorId, IBinder token, String opPackageName, long requestId); 85 86 // Start fingerprint enrollment enroll(IBinder token, in byte [] hardwareAuthToken, int userId, IFingerprintServiceReceiver receiver, String opPackageName, int enrollReason)87 long enroll(IBinder token, in byte [] hardwareAuthToken, int userId, IFingerprintServiceReceiver receiver, 88 String opPackageName, int enrollReason); 89 90 // Cancel enrollment in progress cancelEnrollment(IBinder token, long requestId)91 void cancelEnrollment(IBinder token, long requestId); 92 93 // Any errors resulting from this call will be returned to the listener remove(IBinder token, int fingerId, int userId, IFingerprintServiceReceiver receiver, String opPackageName)94 void remove(IBinder token, int fingerId, int userId, IFingerprintServiceReceiver receiver, 95 String opPackageName); 96 97 // Removes all face enrollments for the specified userId. removeAll(IBinder token, int userId, IFingerprintServiceReceiver receiver, String opPackageName)98 void removeAll(IBinder token, int userId, IFingerprintServiceReceiver receiver, String opPackageName); 99 100 // Rename the fingerprint specified by fingerId and userId to the given name rename(int fingerId, int userId, String name)101 void rename(int fingerId, int userId, String name); 102 103 // Get a list of enrolled fingerprints in the given userId. getEnrolledFingerprints(int userId, String opPackageName, String attributionTag)104 List<Fingerprint> getEnrolledFingerprints(int userId, String opPackageName, String attributionTag); 105 106 // Determine if the HAL is loaded and ready. Meant to support the deprecated FingerprintManager APIs isHardwareDetectedDeprecated(String opPackageName, String attributionTag)107 boolean isHardwareDetectedDeprecated(String opPackageName, String attributionTag); 108 109 // Determine if the specified HAL is loaded and ready isHardwareDetected(int sensorId, String opPackageName)110 boolean isHardwareDetected(int sensorId, String opPackageName); 111 112 // Get a pre-enrollment authentication token generateChallenge(IBinder token, int sensorId, int userId, IFingerprintServiceReceiver receiver, String opPackageName)113 void generateChallenge(IBinder token, int sensorId, int userId, IFingerprintServiceReceiver receiver, String opPackageName); 114 115 // Finish an enrollment sequence and invalidate the authentication token revokeChallenge(IBinder token, int sensorId, int userId, String opPackageName, long challenge)116 void revokeChallenge(IBinder token, int sensorId, int userId, String opPackageName, long challenge); 117 118 // Determine if a user has at least one enrolled fingerprint. Meant to support the deprecated FingerprintManager APIs hasEnrolledFingerprintsDeprecated(int userId, String opPackageName, String attributionTag)119 boolean hasEnrolledFingerprintsDeprecated(int userId, String opPackageName, String attributionTag); 120 121 // Determine if a user has at least one enrolled fingerprint. hasEnrolledFingerprints(int sensorId, int userId, String opPackageName)122 boolean hasEnrolledFingerprints(int sensorId, int userId, String opPackageName); 123 124 // Return the LockoutTracker status for the specified user getLockoutModeForUser(int sensorId, int userId)125 int getLockoutModeForUser(int sensorId, int userId); 126 127 // Requests for the specified sensor+userId's authenticatorId to be invalidated invalidateAuthenticatorId(int sensorId, int userId, IInvalidationCallback callback)128 void invalidateAuthenticatorId(int sensorId, int userId, IInvalidationCallback callback); 129 130 // Gets the authenticator ID for fingerprint getAuthenticatorId(int sensorId, int callingUserId)131 long getAuthenticatorId(int sensorId, int callingUserId); 132 133 // Reset the timeout when user authenticates with strong auth (e.g. PIN, pattern or password) resetLockout(IBinder token, int sensorId, int userId, in byte[] hardwareAuthToken, String opPackageNAame)134 void resetLockout(IBinder token, int sensorId, int userId, in byte[] hardwareAuthToken, String opPackageNAame); 135 136 // Add a callback which gets notified when the fingerprint lockout period expired. addLockoutResetCallback(IBiometricServiceLockoutResetCallback callback, String opPackageName)137 void addLockoutResetCallback(IBiometricServiceLockoutResetCallback callback, String opPackageName); 138 139 // Check if a client request is currently being handled isClientActive()140 boolean isClientActive(); 141 142 // Add a callback which gets notified when the service starts and stops handling client requests addClientActiveCallback(IFingerprintClientActiveCallback callback)143 void addClientActiveCallback(IFingerprintClientActiveCallback callback); 144 145 // Removes a callback set by addClientActiveCallback removeClientActiveCallback(IFingerprintClientActiveCallback callback)146 void removeClientActiveCallback(IFingerprintClientActiveCallback callback); 147 148 // Registers all HIDL and AIDL sensors. Only HIDL sensor properties need to be provided, because 149 // AIDL sensor properties are retrieved directly from the available HALs. If no HIDL HALs exist, 150 // hidlSensors must be non-null and empty. See AuthService.java registerAuthenticators(in List<FingerprintSensorPropertiesInternal> hidlSensors)151 void registerAuthenticators(in List<FingerprintSensorPropertiesInternal> hidlSensors); 152 153 // Adds a callback which gets called when the service registers all of the fingerprint 154 // authenticators. The callback is automatically removed after it's invoked. addAuthenticatorsRegisteredCallback(IFingerprintAuthenticatorsRegisteredCallback callback)155 void addAuthenticatorsRegisteredCallback(IFingerprintAuthenticatorsRegisteredCallback callback); 156 157 // Notifies about a finger touching the sensor area. onPointerDown(long requestId, int sensorId, int x, int y, float minor, float major)158 void onPointerDown(long requestId, int sensorId, int x, int y, float minor, float major); 159 160 // Notifies about a finger leaving the sensor area. onPointerUp(long requestId, int sensorId)161 void onPointerUp(long requestId, int sensorId); 162 163 // Notifies about the fingerprint UI being ready (e.g. HBM illumination is enabled). onUiReady(long requestId, int sensorId)164 void onUiReady(long requestId, int sensorId); 165 166 // Sets the controller for managing the UDFPS overlay. setUdfpsOverlayController(in IUdfpsOverlayController controller)167 void setUdfpsOverlayController(in IUdfpsOverlayController controller); 168 169 // Sets the controller for managing the SideFPS overlay. setSidefpsController(in ISidefpsController controller)170 void setSidefpsController(in ISidefpsController controller); 171 172 // Registers BiometricStateListener. registerBiometricStateListener(IBiometricStateListener listener)173 void registerBiometricStateListener(IBiometricStateListener listener); 174 175 // Sends a power button pressed event to all listeners. onPowerPressed()176 oneway void onPowerPressed(); 177 } 178