blob: aff8d6f5f40582af0d3386c63473fcb02ae746d4 [file] [log] [blame]
Jim Miller08fa40c2014-04-29 18:18:47 -07001/*
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 */
Jim Millerebbf2052015-03-31 17:24:34 -070016package android.hardware.fingerprint;
Jim Miller08fa40c2014-04-29 18:18:47 -070017
Ilya Matyukhinef410e32020-02-04 13:39:48 -080018import android.hardware.biometrics.IBiometricNativeHandle;
Kevin Chyn23289ef2018-11-28 16:32:36 -080019import android.hardware.biometrics.IBiometricServiceReceiverInternal;
Kevin Chyna56dff72018-06-19 18:41:12 -070020import android.hardware.biometrics.IBiometricServiceLockoutResetCallback;
Phil Weaver27fcd9c2017-01-20 15:57:24 -080021import android.hardware.fingerprint.IFingerprintClientActiveCallback;
Jim Millerebbf2052015-03-31 17:24:34 -070022import android.hardware.fingerprint.IFingerprintServiceReceiver;
23import android.hardware.fingerprint.Fingerprint;
Jim Miller9f0753f2015-03-23 23:59:22 -070024import java.util.List;
Jim Miller08fa40c2014-04-29 18:18:47 -070025
26/**
27 * Communication channel from client to the fingerprint service.
28 * @hide
29 */
Jim Millerba67aee2015-02-20 16:21:26 -080030interface IFingerprintService {
Kevin Chyna24e9fd2018-08-27 12:39:17 -070031 // Authenticate the given sessionId with a fingerprint. This is protected by
32 // USE_FINGERPRINT/USE_BIOMETRIC permission. This is effectively deprecated, since it only comes
33 // through FingerprintManager now.
Jim Millerdca15d22015-06-16 20:55:13 -070034 void authenticate(IBinder token, long sessionId, int userId,
Ilya Matyukhinef410e32020-02-04 13:39:48 -080035 IFingerprintServiceReceiver receiver, int flags, String opPackageName,
36 in IBiometricNativeHandle windowId);
Kevin Chyna24e9fd2018-08-27 12:39:17 -070037
Kevin Chyn87f257a2018-11-27 16:26:07 -080038 // This method prepares the service to start authenticating, but doesn't start authentication.
39 // This is protected by the MANAGE_BIOMETRIC signatuer permission. This method should only be
40 // called from BiometricService. The additional uid, pid, userId arguments should be determined
41 // by BiometricService. To start authentication after the clients are ready, use
42 // startPreparedClient().
43 void prepareForAuthentication(IBinder token, long sessionId, int userId,
Kevin Chyn23289ef2018-11-28 16:32:36 -080044 IBiometricServiceReceiverInternal wrapperReceiver, String opPackageName, int cookie,
Ilya Matyukhinef410e32020-02-04 13:39:48 -080045 int callingUid, int callingPid, int callingUserId, in IBiometricNativeHandle windowId);
Kevin Chyn87f257a2018-11-27 16:26:07 -080046
47 // Starts authentication with the previously prepared client.
48 void startPreparedClient(int cookie);
Jim Millerce7eb6d2015-04-03 19:29:13 -070049
50 // Cancel authentication for the given sessionId
Svetoslav4af76a52015-04-29 15:29:46 -070051 void cancelAuthentication(IBinder token, String opPackageName);
Jim Miller9f0753f2015-03-23 23:59:22 -070052
Kevin Chyna24e9fd2018-08-27 12:39:17 -070053 // Same as above, except this is protected by the MANAGE_BIOMETRIC signature permission. Takes
54 // an additional uid, pid, userid.
55 void cancelAuthenticationFromService(IBinder token, String opPackageName,
Kevin Chyne92cdae2018-11-21 16:35:04 -080056 int callingUid, int callingPid, int callingUserId, boolean fromClient);
Kevin Chyna24e9fd2018-08-27 12:39:17 -070057
Jim Miller9f0753f2015-03-23 23:59:22 -070058 // Start fingerprint enrollment
Jim Millerfe6439f2015-04-11 18:07:57 -070059 void enroll(IBinder token, in byte [] cryptoToken, int groupId, IFingerprintServiceReceiver receiver,
Ilya Matyukhinef410e32020-02-04 13:39:48 -080060 int flags, String opPackageName, in IBiometricNativeHandle windowId);
Jim Millerce7eb6d2015-04-03 19:29:13 -070061
62 // Cancel enrollment in progress
63 void cancelEnrollment(IBinder token);
Jim Millerba67aee2015-02-20 16:21:26 -080064
Jim Millera75961472014-06-06 15:00:49 -070065 // Any errors resulting from this call will be returned to the listener
Jim Miller8f2aca02016-04-20 13:34:11 -070066 void remove(IBinder token, int fingerId, int groupId, int userId,
67 IFingerprintServiceReceiver receiver);
Jim Miller08fa40c2014-04-29 18:18:47 -070068
Jim Miller9f0753f2015-03-23 23:59:22 -070069 // Rename the fingerprint specified by fingerId and groupId to the given name
70 void rename(int fingerId, int groupId, String name);
Jim Miller08fa40c2014-04-29 18:18:47 -070071
Jim Miller9f0753f2015-03-23 23:59:22 -070072 // Get a list of enrolled fingerprints in the given group.
Svetoslav4af76a52015-04-29 15:29:46 -070073 List<Fingerprint> getEnrolledFingerprints(int groupId, String opPackageName);
Jim Miller08fa40c2014-04-29 18:18:47 -070074
Jim Millerba67aee2015-02-20 16:21:26 -080075 // Determine if HAL is loaded and ready
Ilya Matyukhinf2da1a12019-09-25 15:31:03 -070076 boolean isHardwareDetected(String opPackageName);
Jim Miller99d60192015-03-11 17:41:58 -070077
Jim Millerce7eb6d2015-04-03 19:29:13 -070078 // Get a pre-enrollment authentication token
79 long preEnroll(IBinder token);
80
Sasha Levitskiye0943cf2015-07-08 13:22:20 -070081 // Finish an enrollment sequence and invalidate the authentication token
82 int postEnroll(IBinder token);
83
Jorim Jaggi2aad7ee2015-04-14 15:25:06 -070084 // Determine if a user has at least one enrolled fingerprint
Svetoslav4af76a52015-04-29 15:29:46 -070085 boolean hasEnrolledFingerprints(int groupId, String opPackageName);
Jorim Jaggi2aad7ee2015-04-14 15:25:06 -070086
Jim Miller9f0753f2015-03-23 23:59:22 -070087 // Gets the number of hardware devices
88 // int getHardwareDeviceCount();
89
90 // Gets the unique device id for hardware enumerated at i
91 // long getHardwareDevice(int i);
92
Andres Morales4d41a202015-04-16 14:12:38 -070093 // Gets the authenticator ID for fingerprint
Kevin Chyn7d07c892020-02-18 18:18:17 -080094 long getAuthenticatorId();
Jim Millere0507bb2015-08-12 20:30:34 -070095
96 // Reset the timeout when user authenticates with strong auth (e.g. PIN, pattern or password)
97 void resetTimeout(in byte [] cryptoToken);
Jorim Jaggi3a464782015-08-28 16:59:13 -070098
99 // Add a callback which gets notified when the fingerprint lockout period expired.
Kevin Chyna56dff72018-06-19 18:41:12 -0700100 void addLockoutResetCallback(IBiometricServiceLockoutResetCallback callback);
Clara Bayarrid1f722d2016-01-07 14:17:39 +0000101
102 // Explicitly set the active user (for enrolling work profile)
103 void setActiveUser(int uid);
Jim Miller40e46452016-12-16 18:38:53 -0800104
105 // Enumerate all fingerprints
106 void enumerate(IBinder token, int userId, IFingerprintServiceReceiver receiver);
Phil Weaver27fcd9c2017-01-20 15:57:24 -0800107
108 // Check if a client request is currently being handled
109 boolean isClientActive();
110
111 // Add a callback which gets notified when the service starts and stops handling client requests
112 void addClientActiveCallback(IFingerprintClientActiveCallback callback);
113
114 // Removes a callback set by addClientActiveCallback
115 void removeClientActiveCallback(IFingerprintClientActiveCallback callback);
Jim Miller08fa40c2014-04-29 18:18:47 -0700116}