Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 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.face; |
| 17 | |
Kevin Chyn | 23289ef | 2018-11-28 16:32:36 -0800 | [diff] [blame] | 18 | import android.hardware.biometrics.IBiometricServiceReceiverInternal; |
Kevin Chyn | a56dff7 | 2018-06-19 18:41:12 -0700 | [diff] [blame] | 19 | import android.hardware.biometrics.IBiometricServiceLockoutResetCallback; |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 20 | import android.hardware.face.IFaceServiceReceiver; |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 21 | import android.hardware.face.Face; |
| 22 | |
| 23 | /** |
Kevin Chyn | a24e9fd | 2018-08-27 12:39:17 -0700 | [diff] [blame] | 24 | * Communication channel from client to the face service. These methods are all require the |
| 25 | * MANAGE_BIOMETRIC signature permission. |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 26 | * @hide |
| 27 | */ |
| 28 | interface IFaceService { |
| 29 | // Authenticate the given sessionId with a face |
Kevin Chyn | 747e29b | 2019-01-11 17:01:53 -0800 | [diff] [blame] | 30 | void authenticate(IBinder token, long sessionId, int userid, |
Kevin Chyn | a24e9fd | 2018-08-27 12:39:17 -0700 | [diff] [blame] | 31 | IFaceServiceReceiver receiver, int flags, String opPackageName); |
| 32 | |
Kevin Chyn | 87f257a | 2018-11-27 16:26:07 -0800 | [diff] [blame] | 33 | // This method prepares the service to start authenticating, but doesn't start authentication. |
| 34 | // This is protected by the MANAGE_BIOMETRIC signatuer permission. This method should only be |
| 35 | // called from BiometricService. The additional uid, pid, userId arguments should be determined |
| 36 | // by BiometricService. To start authentication after the clients are ready, use |
| 37 | // startPreparedClient(). |
| 38 | void prepareForAuthentication(boolean requireConfirmation, IBinder token, long sessionId, |
Kevin Chyn | 23289ef | 2018-11-28 16:32:36 -0800 | [diff] [blame] | 39 | int userId, IBiometricServiceReceiverInternal wrapperReceiver, String opPackageName, |
Kevin Chyn | 87f257a | 2018-11-27 16:26:07 -0800 | [diff] [blame] | 40 | int cookie, int callingUid, int callingPid, int callingUserId); |
| 41 | |
| 42 | // Starts authentication with the previously prepared client. |
| 43 | void startPreparedClient(int cookie); |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 44 | |
| 45 | // Cancel authentication for the given sessionId |
| 46 | void cancelAuthentication(IBinder token, String opPackageName); |
| 47 | |
Kevin Chyn | a24e9fd | 2018-08-27 12:39:17 -0700 | [diff] [blame] | 48 | // Same as above, with extra arguments. |
| 49 | void cancelAuthenticationFromService(IBinder token, String opPackageName, |
Kevin Chyn | e92cdae | 2018-11-21 16:35:04 -0800 | [diff] [blame] | 50 | int callingUid, int callingPid, int callingUserId, boolean fromClient); |
Kevin Chyn | a24e9fd | 2018-08-27 12:39:17 -0700 | [diff] [blame] | 51 | |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 52 | // Start face enrollment |
Kevin Chyn | 1f16c2d | 2018-12-07 13:06:08 -0800 | [diff] [blame] | 53 | void enroll(IBinder token, in byte [] cryptoToken, IFaceServiceReceiver receiver, |
| 54 | String opPackageName, in int [] disabledFeatures); |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 55 | |
| 56 | // Cancel enrollment in progress |
| 57 | void cancelEnrollment(IBinder token); |
| 58 | |
| 59 | // Any errors resulting from this call will be returned to the listener |
Kevin Chyn | a56dff7 | 2018-06-19 18:41:12 -0700 | [diff] [blame] | 60 | void remove(IBinder token, int faceId, int userId, IFaceServiceReceiver receiver); |
| 61 | |
| 62 | // Rename the face specified by faceId to the given name |
| 63 | void rename(int faceId, String name); |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 64 | |
| 65 | // Get the enrolled face for user. |
Kevin Chyn | a56dff7 | 2018-06-19 18:41:12 -0700 | [diff] [blame] | 66 | List<Face> getEnrolledFaces(int userId, String opPackageName); |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 67 | |
| 68 | // Determine if HAL is loaded and ready |
| 69 | boolean isHardwareDetected(long deviceId, String opPackageName); |
| 70 | |
| 71 | // Get a pre-enrollment authentication token |
Kevin Chyn | d79e24e | 2018-09-25 12:06:59 -0700 | [diff] [blame] | 72 | long generateChallenge(IBinder token); |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 73 | |
| 74 | // Finish an enrollment sequence and invalidate the authentication token |
Kevin Chyn | d79e24e | 2018-09-25 12:06:59 -0700 | [diff] [blame] | 75 | int revokeChallenge(IBinder token); |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 76 | |
Kevin Chyn | a56dff7 | 2018-06-19 18:41:12 -0700 | [diff] [blame] | 77 | // Determine if a user has at least one enrolled face |
| 78 | boolean hasEnrolledFaces(int userId, String opPackageName); |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 79 | |
| 80 | // Gets the number of hardware devices |
| 81 | // int getHardwareDeviceCount(); |
| 82 | |
| 83 | // Gets the unique device id for hardware enumerated at i |
| 84 | // long getHardwareDevice(int i); |
| 85 | |
| 86 | // Gets the authenticator ID for face |
| 87 | long getAuthenticatorId(String opPackageName); |
| 88 | |
Kevin Chyn | a38653c | 2019-02-11 17:46:21 -0800 | [diff] [blame] | 89 | // Reset the lockout when user authenticates with strong auth (e.g. PIN, pattern or password) |
| 90 | void resetLockout(in byte [] token); |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 91 | |
| 92 | // Add a callback which gets notified when the face lockout period expired. |
Kevin Chyn | a56dff7 | 2018-06-19 18:41:12 -0700 | [diff] [blame] | 93 | void addLockoutResetCallback(IBiometricServiceLockoutResetCallback callback); |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 94 | |
| 95 | // Explicitly set the active user (for enrolling work profile) |
| 96 | void setActiveUser(int uid); |
Kevin Chyn | a56dff7 | 2018-06-19 18:41:12 -0700 | [diff] [blame] | 97 | |
| 98 | // Enumerate all faces |
| 99 | void enumerate(IBinder token, int userId, IFaceServiceReceiver receiver); |
Kevin Chyn | d79e24e | 2018-09-25 12:06:59 -0700 | [diff] [blame] | 100 | |
Kevin Chyn | b95f152 | 2019-03-04 16:45:15 -0800 | [diff] [blame] | 101 | boolean setFeature(int feature, boolean enabled, in byte [] token); |
Kevin Chyn | d79e24e | 2018-09-25 12:06:59 -0700 | [diff] [blame] | 102 | |
Kevin Chyn | 1f16c2d | 2018-12-07 13:06:08 -0800 | [diff] [blame] | 103 | boolean getFeature(int feature); |
Kevin Chyn | 57f119b | 2018-10-25 12:03:41 -0700 | [diff] [blame] | 104 | |
| 105 | void userActivity(); |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 106 | } |