blob: 4aa1e760c635d1557b3fa6b8aab91243e709abb7 [file] [log] [blame]
Kevin Chyna56dff72018-06-19 18:41:12 -07001/*
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
17package android.hardware.biometrics;
18
19import android.hardware.face.FaceManager;
20
21/**
22 * Interface containing all of the face-specific constants.
Kevin Chyn91e7a3d2018-04-12 12:42:24 -070023 *
24 * NOTE: The error messages must be consistent between BiometricConstants, Biometric*Constants,
25 * and the frameworks/support/biometric/.../BiometricConstants files.
26 *
Kevin Chyna56dff72018-06-19 18:41:12 -070027 * @hide
28 */
29public interface BiometricFaceConstants {
30 //
31 // Error messages from face authentication hardware during initialization, enrollment,
32 // authentication or removal. Must agree with the list in HAL h file
33 //
34 /**
35 * The hardware is unavailable. Try again later.
36 */
37 public static final int FACE_ERROR_HW_UNAVAILABLE = 1;
Kevin Chyn91e7a3d2018-04-12 12:42:24 -070038
Kevin Chyna56dff72018-06-19 18:41:12 -070039 /**
40 * Error state returned when the sensor was unable to process the current image.
41 */
42 public static final int FACE_ERROR_UNABLE_TO_PROCESS = 2;
Kevin Chyn91e7a3d2018-04-12 12:42:24 -070043
Kevin Chyna56dff72018-06-19 18:41:12 -070044 /**
45 * Error state returned when the current request has been running too long. This is intended to
46 * prevent programs from waiting for the face authentication sensor indefinitely. The timeout is
47 * platform and sensor-specific, but is generally on the order of 30 seconds.
48 */
49 public static final int FACE_ERROR_TIMEOUT = 3;
Kevin Chyn91e7a3d2018-04-12 12:42:24 -070050
Kevin Chyna56dff72018-06-19 18:41:12 -070051 /**
52 * Error state returned for operations like enrollment; the operation cannot be completed
53 * because there's not enough storage remaining to complete the operation.
54 */
55 public static final int FACE_ERROR_NO_SPACE = 4;
Kevin Chyn91e7a3d2018-04-12 12:42:24 -070056
Kevin Chyna56dff72018-06-19 18:41:12 -070057 /**
58 * The operation was canceled because the face authentication sensor is unavailable. For
59 * example, this may happen when the user is switched, the device is locked or another pending
60 * operation prevents or disables it.
61 */
62 public static final int FACE_ERROR_CANCELED = 5;
Kevin Chyn91e7a3d2018-04-12 12:42:24 -070063
Kevin Chyna56dff72018-06-19 18:41:12 -070064 /**
65 * The {@link FaceManager#remove} call failed. Typically this will happen when the
66 * provided face id was incorrect.
67 *
68 * @hide
69 */
70 public static final int FACE_ERROR_UNABLE_TO_REMOVE = 6;
Kevin Chyn91e7a3d2018-04-12 12:42:24 -070071
Kevin Chyna56dff72018-06-19 18:41:12 -070072 /**
73 * The operation was canceled because the API is locked out due to too many attempts.
74 * This occurs after 5 failed attempts, and lasts for 30 seconds.
75 */
76 public static final int FACE_ERROR_LOCKOUT = 7;
Kevin Chyn91e7a3d2018-04-12 12:42:24 -070077
Kevin Chyna56dff72018-06-19 18:41:12 -070078 /**
79 * Hardware vendors may extend this list if there are conditions that do not fall under one of
80 * the above categories. Vendors are responsible for providing error strings for these errors.
81 * These messages are typically reserved for internal operations such as enrollment, but may be
82 * used to express vendor errors not covered by the ones in HAL h file. Applications are
83 * expected to show the error message string if they happen, but are advised not to rely on the
84 * message id since they will be device and vendor-specific
85 */
86 public static final int FACE_ERROR_VENDOR = 8;
87
88 /**
89 * The operation was canceled because FACE_ERROR_LOCKOUT occurred too many times.
90 * Face authentication is disabled until the user unlocks with strong authentication
91 * (PIN/Pattern/Password)
92 */
93 public static final int FACE_ERROR_LOCKOUT_PERMANENT = 9;
Kevin Chyn91e7a3d2018-04-12 12:42:24 -070094
Kevin Chyna56dff72018-06-19 18:41:12 -070095 /**
96 * The user canceled the operation. Upon receiving this, applications should use alternate
97 * authentication (e.g. a password). The application should also provide the means to return
98 * to face authentication, such as a "use face authentication" button.
99 */
100 public static final int FACE_ERROR_USER_CANCELED = 10;
Kevin Chyn91e7a3d2018-04-12 12:42:24 -0700101
Kevin Chyna56dff72018-06-19 18:41:12 -0700102 /**
103 * The user does not have a face enrolled.
104 */
105 public static final int FACE_ERROR_NOT_ENROLLED = 11;
Kevin Chyn91e7a3d2018-04-12 12:42:24 -0700106
Kevin Chyna56dff72018-06-19 18:41:12 -0700107 /**
108 * The device does not have a face sensor. This message will propagate if the calling app
109 * ignores the result from PackageManager.hasFeature(FEATURE_FACE) and calls
110 * this API anyway. Apps should always check for the feature before calling this API.
111 */
112 public static final int FACE_ERROR_HW_NOT_PRESENT = 12;
Kevin Chyn91e7a3d2018-04-12 12:42:24 -0700113
114 /**
115 * The user pressed the negative button. This is a placeholder that is currently only used
116 * by the support library.
117 * @hide
118 */
119 public static final int FACE_ERROR_NEGATIVE_BUTTON = 13;
120
Kevin Chyna56dff72018-06-19 18:41:12 -0700121 /**
122 * @hide
123 */
124 public static final int FACE_ERROR_VENDOR_BASE = 1000;
125
126 //
127 // Image acquisition messages. These will not be sent to the user, since they conflict with
128 // existing constants. These must agree with face@1.0/types.hal.
129 //
130
131 /**
132 * The image acquired was good.
133 */
134 public static final int FACE_ACQUIRED_GOOD = 0;
135
136 /**
137 * The face image was not good enough to process due to a detected condition.
138 * (See {@link #FACE_ACQUIRED_TOO_BRIGHT or @link #FACE_ACQUIRED_TOO_DARK}).
139 */
140 public static final int FACE_ACQUIRED_INSUFFICIENT = 1;
141
142 /**
143 * The face image was too bright due to too much ambient light.
144 * For example, it's reasonable to return this after multiple
145 * {@link #FACE_ACQUIRED_INSUFFICIENT}
146 * The user is expected to take action to retry in better lighting conditions
147 * when this is returned.
148 */
149 public static final int FACE_ACQUIRED_TOO_BRIGHT = 2;
150
151 /**
152 * The face image was too dark due to illumination light obscured.
153 * For example, it's reasonable to return this after multiple
154 * {@link #FACE_ACQUIRED_INSUFFICIENT}
155 * The user is expected to take action to retry in better lighting conditions
156 * when this is returned.
157 */
158 public static final int FACE_ACQUIRED_TOO_DARK = 3;
159
160 /**
161 * The detected face is too close to the sensor, and the image can't be processed.
162 * The user should be informed to move farther from the sensor when this is returned.
163 */
164 public static final int FACE_ACQUIRED_TOO_CLOSE = 4;
165
166 /**
167 * The detected face is too small, as the user might be too far from the sensor.
168 * The user should be informed to move closer to the sensor when this is returned.
169 */
170 public static final int FACE_ACQUIRED_TOO_FAR = 5;
171
172 /**
173 * Only the upper part of the face was detected. The sensor field of view is too high.
174 * The user should be informed to move up with respect to the sensor when this is returned.
175 */
176 public static final int FACE_ACQUIRED_TOO_HIGH = 6;
177
178 /**
179 * Only the lower part of the face was detected. The sensor field of view is too low.
180 * The user should be informed to move down with respect to the sensor when this is returned.
181 */
182 public static final int FACE_ACQUIRED_TOO_LOW = 7;
183
184 /**
185 * Only the right part of the face was detected. The sensor field of view is too far right.
186 * The user should be informed to move to the right with respect to the sensor
187 * when this is returned.
188 */
189 public static final int FACE_ACQUIRED_TOO_RIGHT = 8;
190
191 /**
192 * Only the left part of the face was detected. The sensor field of view is too far left.
193 * The user should be informed to move to the left with respect to the sensor
194 * when this is returned.
195 */
196 public static final int FACE_ACQUIRED_TOO_LEFT = 9;
197
198 /**
199 * The user's eyes have strayed away from the sensor. If this message is sent, the user should
200 * be informed to look at the device. If the user can't be found in the frame, one of the other
201 * acquisition messages should be sent, e.g. FACE_ACQUIRED_NOT_DETECTED.
202 */
203 public static final int FACE_ACQUIRED_POOR_GAZE = 10;
204
205 /**
206 * No face was detected in front of the sensor.
207 * The user should be informed to point the sensor to a face when this is returned.
208 */
209 public static final int FACE_ACQUIRED_NOT_DETECTED = 11;
210
211 /**
212 * Too much motion was detected.
213 * The user should be informed to keep their face steady relative to the
214 * sensor.
215 */
216 public static final int FACE_ACQUIRED_TOO_MUCH_MOTION = 12;
217
218 /**
219 * The sensor needs to be re-calibrated. This is an unexpected condition, and should only be
220 * sent if a serious, uncorrectable, and unrecoverable calibration issue is detected which
221 * requires user intervention, e.g. re-enrolling. The expected response to this message is to
222 * direct the user to re-enroll.
223 */
224 public static final int FACE_ACQUIRED_RECALIBRATE = 13;
225
226 /**
227 * Hardware vendors may extend this list if there are conditions that do not fall under one of
228 * the above categories. Vendors are responsible for providing error strings for these errors.
229 *
230 * @hide
231 */
232 public static final int FACE_ACQUIRED_VENDOR = 13;
233 /**
234 * @hide
235 */
236 public static final int FACE_ACQUIRED_VENDOR_BASE = 1000;
237}