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