Jim Miller | 08fa40c | 2014-04-29 18:18:47 -0700 | [diff] [blame] | 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 | */ |
Jim Miller | ebbf205 | 2015-03-31 17:24:34 -0700 | [diff] [blame] | 16 | package android.hardware.fingerprint; |
Jim Miller | 08fa40c | 2014-04-29 18:18:47 -0700 | [diff] [blame] | 17 | |
Ilya Matyukhin | ef410e3 | 2020-02-04 13:39:48 -0800 | [diff] [blame] | 18 | import android.hardware.biometrics.IBiometricNativeHandle; |
Kevin Chyn | 23289ef | 2018-11-28 16:32:36 -0800 | [diff] [blame] | 19 | import android.hardware.biometrics.IBiometricServiceReceiverInternal; |
Kevin Chyn | a56dff7 | 2018-06-19 18:41:12 -0700 | [diff] [blame] | 20 | import android.hardware.biometrics.IBiometricServiceLockoutResetCallback; |
Phil Weaver | 27fcd9c | 2017-01-20 15:57:24 -0800 | [diff] [blame] | 21 | import android.hardware.fingerprint.IFingerprintClientActiveCallback; |
Jim Miller | ebbf205 | 2015-03-31 17:24:34 -0700 | [diff] [blame] | 22 | import android.hardware.fingerprint.IFingerprintServiceReceiver; |
| 23 | import android.hardware.fingerprint.Fingerprint; |
Jim Miller | 9f0753f | 2015-03-23 23:59:22 -0700 | [diff] [blame] | 24 | import java.util.List; |
Jim Miller | 08fa40c | 2014-04-29 18:18:47 -0700 | [diff] [blame] | 25 | |
| 26 | /** |
| 27 | * Communication channel from client to the fingerprint service. |
| 28 | * @hide |
| 29 | */ |
Jim Miller | ba67aee | 2015-02-20 16:21:26 -0800 | [diff] [blame] | 30 | interface IFingerprintService { |
Kevin Chyn | a24e9fd | 2018-08-27 12:39:17 -0700 | [diff] [blame] | 31 | // 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 Miller | dca15d2 | 2015-06-16 20:55:13 -0700 | [diff] [blame] | 34 | void authenticate(IBinder token, long sessionId, int userId, |
Ilya Matyukhin | ef410e3 | 2020-02-04 13:39:48 -0800 | [diff] [blame] | 35 | IFingerprintServiceReceiver receiver, int flags, String opPackageName, |
| 36 | in IBiometricNativeHandle windowId); |
Kevin Chyn | a24e9fd | 2018-08-27 12:39:17 -0700 | [diff] [blame] | 37 | |
Kevin Chyn | 87f257a | 2018-11-27 16:26:07 -0800 | [diff] [blame] | 38 | // 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 Chyn | 23289ef | 2018-11-28 16:32:36 -0800 | [diff] [blame] | 44 | IBiometricServiceReceiverInternal wrapperReceiver, String opPackageName, int cookie, |
Ilya Matyukhin | ef410e3 | 2020-02-04 13:39:48 -0800 | [diff] [blame] | 45 | int callingUid, int callingPid, int callingUserId, in IBiometricNativeHandle windowId); |
Kevin Chyn | 87f257a | 2018-11-27 16:26:07 -0800 | [diff] [blame] | 46 | |
| 47 | // Starts authentication with the previously prepared client. |
| 48 | void startPreparedClient(int cookie); |
Jim Miller | ce7eb6d | 2015-04-03 19:29:13 -0700 | [diff] [blame] | 49 | |
| 50 | // Cancel authentication for the given sessionId |
Svetoslav | 4af76a5 | 2015-04-29 15:29:46 -0700 | [diff] [blame] | 51 | void cancelAuthentication(IBinder token, String opPackageName); |
Jim Miller | 9f0753f | 2015-03-23 23:59:22 -0700 | [diff] [blame] | 52 | |
Kevin Chyn | a24e9fd | 2018-08-27 12:39:17 -0700 | [diff] [blame] | 53 | // 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 Chyn | e92cdae | 2018-11-21 16:35:04 -0800 | [diff] [blame] | 56 | int callingUid, int callingPid, int callingUserId, boolean fromClient); |
Kevin Chyn | a24e9fd | 2018-08-27 12:39:17 -0700 | [diff] [blame] | 57 | |
Jim Miller | 9f0753f | 2015-03-23 23:59:22 -0700 | [diff] [blame] | 58 | // Start fingerprint enrollment |
Jim Miller | fe6439f | 2015-04-11 18:07:57 -0700 | [diff] [blame] | 59 | void enroll(IBinder token, in byte [] cryptoToken, int groupId, IFingerprintServiceReceiver receiver, |
Ilya Matyukhin | ef410e3 | 2020-02-04 13:39:48 -0800 | [diff] [blame] | 60 | int flags, String opPackageName, in IBiometricNativeHandle windowId); |
Jim Miller | ce7eb6d | 2015-04-03 19:29:13 -0700 | [diff] [blame] | 61 | |
| 62 | // Cancel enrollment in progress |
| 63 | void cancelEnrollment(IBinder token); |
Jim Miller | ba67aee | 2015-02-20 16:21:26 -0800 | [diff] [blame] | 64 | |
Jim Miller | a7596147 | 2014-06-06 15:00:49 -0700 | [diff] [blame] | 65 | // Any errors resulting from this call will be returned to the listener |
Jim Miller | 8f2aca0 | 2016-04-20 13:34:11 -0700 | [diff] [blame] | 66 | void remove(IBinder token, int fingerId, int groupId, int userId, |
| 67 | IFingerprintServiceReceiver receiver); |
Jim Miller | 08fa40c | 2014-04-29 18:18:47 -0700 | [diff] [blame] | 68 | |
Jim Miller | 9f0753f | 2015-03-23 23:59:22 -0700 | [diff] [blame] | 69 | // Rename the fingerprint specified by fingerId and groupId to the given name |
| 70 | void rename(int fingerId, int groupId, String name); |
Jim Miller | 08fa40c | 2014-04-29 18:18:47 -0700 | [diff] [blame] | 71 | |
Jim Miller | 9f0753f | 2015-03-23 23:59:22 -0700 | [diff] [blame] | 72 | // Get a list of enrolled fingerprints in the given group. |
Svetoslav | 4af76a5 | 2015-04-29 15:29:46 -0700 | [diff] [blame] | 73 | List<Fingerprint> getEnrolledFingerprints(int groupId, String opPackageName); |
Jim Miller | 08fa40c | 2014-04-29 18:18:47 -0700 | [diff] [blame] | 74 | |
Jim Miller | ba67aee | 2015-02-20 16:21:26 -0800 | [diff] [blame] | 75 | // Determine if HAL is loaded and ready |
Ilya Matyukhin | f2da1a1 | 2019-09-25 15:31:03 -0700 | [diff] [blame] | 76 | boolean isHardwareDetected(String opPackageName); |
Jim Miller | 99d6019 | 2015-03-11 17:41:58 -0700 | [diff] [blame] | 77 | |
Jim Miller | ce7eb6d | 2015-04-03 19:29:13 -0700 | [diff] [blame] | 78 | // Get a pre-enrollment authentication token |
| 79 | long preEnroll(IBinder token); |
| 80 | |
Sasha Levitskiy | e0943cf | 2015-07-08 13:22:20 -0700 | [diff] [blame] | 81 | // Finish an enrollment sequence and invalidate the authentication token |
| 82 | int postEnroll(IBinder token); |
| 83 | |
Jorim Jaggi | 2aad7ee | 2015-04-14 15:25:06 -0700 | [diff] [blame] | 84 | // Determine if a user has at least one enrolled fingerprint |
Svetoslav | 4af76a5 | 2015-04-29 15:29:46 -0700 | [diff] [blame] | 85 | boolean hasEnrolledFingerprints(int groupId, String opPackageName); |
Jorim Jaggi | 2aad7ee | 2015-04-14 15:25:06 -0700 | [diff] [blame] | 86 | |
Jim Miller | 9f0753f | 2015-03-23 23:59:22 -0700 | [diff] [blame] | 87 | // 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 Morales | 4d41a20 | 2015-04-16 14:12:38 -0700 | [diff] [blame] | 93 | // Gets the authenticator ID for fingerprint |
Kevin Chyn | 7d07c89 | 2020-02-18 18:18:17 -0800 | [diff] [blame^] | 94 | long getAuthenticatorId(); |
Jim Miller | e0507bb | 2015-08-12 20:30:34 -0700 | [diff] [blame] | 95 | |
| 96 | // Reset the timeout when user authenticates with strong auth (e.g. PIN, pattern or password) |
| 97 | void resetTimeout(in byte [] cryptoToken); |
Jorim Jaggi | 3a46478 | 2015-08-28 16:59:13 -0700 | [diff] [blame] | 98 | |
| 99 | // Add a callback which gets notified when the fingerprint lockout period expired. |
Kevin Chyn | a56dff7 | 2018-06-19 18:41:12 -0700 | [diff] [blame] | 100 | void addLockoutResetCallback(IBiometricServiceLockoutResetCallback callback); |
Clara Bayarri | d1f722d | 2016-01-07 14:17:39 +0000 | [diff] [blame] | 101 | |
| 102 | // Explicitly set the active user (for enrolling work profile) |
| 103 | void setActiveUser(int uid); |
Jim Miller | 40e4645 | 2016-12-16 18:38:53 -0800 | [diff] [blame] | 104 | |
| 105 | // Enumerate all fingerprints |
| 106 | void enumerate(IBinder token, int userId, IFingerprintServiceReceiver receiver); |
Phil Weaver | 27fcd9c | 2017-01-20 15:57:24 -0800 | [diff] [blame] | 107 | |
| 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 Miller | 08fa40c | 2014-04-29 18:18:47 -0700 | [diff] [blame] | 116 | } |