blob: 5043d4ce86df2c9664b23c58810917cb30ed3417 [file] [log] [blame]
Gilad Brettercb51b8b2018-03-22 17:04:51 +02001/*
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 */
16package android.hardware.face;
17
Kevin Chyn23289ef2018-11-28 16:32:36 -080018import android.hardware.biometrics.IBiometricServiceReceiverInternal;
Kevin Chyna56dff72018-06-19 18:41:12 -070019import android.hardware.biometrics.IBiometricServiceLockoutResetCallback;
Gilad Brettercb51b8b2018-03-22 17:04:51 +020020import android.hardware.face.IFaceServiceReceiver;
Gilad Brettercb51b8b2018-03-22 17:04:51 +020021import android.hardware.face.Face;
22
23/**
Kevin Chyna24e9fd2018-08-27 12:39:17 -070024 * Communication channel from client to the face service. These methods are all require the
25 * MANAGE_BIOMETRIC signature permission.
Gilad Brettercb51b8b2018-03-22 17:04:51 +020026 * @hide
27 */
28interface IFaceService {
29 // Authenticate the given sessionId with a face
Kevin Chyn747e29b2019-01-11 17:01:53 -080030 void authenticate(IBinder token, long sessionId, int userid,
Kevin Chyna24e9fd2018-08-27 12:39:17 -070031 IFaceServiceReceiver receiver, int flags, String opPackageName);
32
Kevin Chyn87f257a2018-11-27 16:26:07 -080033 // 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 Chyn23289ef2018-11-28 16:32:36 -080039 int userId, IBiometricServiceReceiverInternal wrapperReceiver, String opPackageName,
Kevin Chyn87f257a2018-11-27 16:26:07 -080040 int cookie, int callingUid, int callingPid, int callingUserId);
41
42 // Starts authentication with the previously prepared client.
43 void startPreparedClient(int cookie);
Gilad Brettercb51b8b2018-03-22 17:04:51 +020044
45 // Cancel authentication for the given sessionId
46 void cancelAuthentication(IBinder token, String opPackageName);
47
Kevin Chyna24e9fd2018-08-27 12:39:17 -070048 // Same as above, with extra arguments.
49 void cancelAuthenticationFromService(IBinder token, String opPackageName,
Kevin Chyne92cdae2018-11-21 16:35:04 -080050 int callingUid, int callingPid, int callingUserId, boolean fromClient);
Kevin Chyna24e9fd2018-08-27 12:39:17 -070051
Gilad Brettercb51b8b2018-03-22 17:04:51 +020052 // Start face enrollment
Kevin Chyn1f16c2d2018-12-07 13:06:08 -080053 void enroll(IBinder token, in byte [] cryptoToken, IFaceServiceReceiver receiver,
54 String opPackageName, in int [] disabledFeatures);
Gilad Brettercb51b8b2018-03-22 17:04:51 +020055
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 Chyna56dff72018-06-19 18:41:12 -070060 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 Brettercb51b8b2018-03-22 17:04:51 +020064
65 // Get the enrolled face for user.
Kevin Chyna56dff72018-06-19 18:41:12 -070066 List<Face> getEnrolledFaces(int userId, String opPackageName);
Gilad Brettercb51b8b2018-03-22 17:04:51 +020067
68 // Determine if HAL is loaded and ready
69 boolean isHardwareDetected(long deviceId, String opPackageName);
70
71 // Get a pre-enrollment authentication token
Kevin Chynd79e24e2018-09-25 12:06:59 -070072 long generateChallenge(IBinder token);
Gilad Brettercb51b8b2018-03-22 17:04:51 +020073
74 // Finish an enrollment sequence and invalidate the authentication token
Kevin Chynd79e24e2018-09-25 12:06:59 -070075 int revokeChallenge(IBinder token);
Gilad Brettercb51b8b2018-03-22 17:04:51 +020076
Kevin Chyna56dff72018-06-19 18:41:12 -070077 // Determine if a user has at least one enrolled face
78 boolean hasEnrolledFaces(int userId, String opPackageName);
Gilad Brettercb51b8b2018-03-22 17:04:51 +020079
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 Chyna38653c2019-02-11 17:46:21 -080089 // Reset the lockout when user authenticates with strong auth (e.g. PIN, pattern or password)
90 void resetLockout(in byte [] token);
Gilad Brettercb51b8b2018-03-22 17:04:51 +020091
92 // Add a callback which gets notified when the face lockout period expired.
Kevin Chyna56dff72018-06-19 18:41:12 -070093 void addLockoutResetCallback(IBiometricServiceLockoutResetCallback callback);
Gilad Brettercb51b8b2018-03-22 17:04:51 +020094
95 // Explicitly set the active user (for enrolling work profile)
96 void setActiveUser(int uid);
Kevin Chyna56dff72018-06-19 18:41:12 -070097
98 // Enumerate all faces
99 void enumerate(IBinder token, int userId, IFaceServiceReceiver receiver);
Kevin Chynd79e24e2018-09-25 12:06:59 -0700100
Kevin Chynb95f1522019-03-04 16:45:15 -0800101 boolean setFeature(int feature, boolean enabled, in byte [] token);
Kevin Chynd79e24e2018-09-25 12:06:59 -0700102
Kevin Chyn1f16c2d2018-12-07 13:06:08 -0800103 boolean getFeature(int feature);
Kevin Chyn57f119b2018-10-25 12:03:41 -0700104
105 void userActivity();
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200106}