blob: 5a1365169eee6326fa1853c3b5cab4ab955c8928 [file] [log] [blame]
Vishwath Mohancf87df12018-03-20 22:57:17 -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
Ilya Matyukhin30f1dd82019-11-18 18:08:56 -080019import static android.hardware.biometrics.BiometricManager.Authenticators;
20
Artur Satayev26958002019-12-10 17:47:52 +000021import android.compat.annotation.UnsupportedAppUsage;
Vishwath Mohancf87df12018-03-20 22:57:17 -070022
23/**
24 * Interface containing all of the biometric modality agnostic constants.
Kevin Chyn91e7a3d2018-04-12 12:42:24 -070025 *
26 * NOTE: The error messages must be consistent between BiometricConstants, Biometric*Constants,
27 * and the frameworks/support/biometric/.../BiometricConstants files.
28 *
Vishwath Mohancf87df12018-03-20 22:57:17 -070029 * @hide
30 */
31public interface BiometricConstants {
32 //
33 // Error messages from biometric hardware during initilization, enrollment, authentication or
34 // removal.
35 //
36
37 /**
Kevin Chyne7411422018-09-27 17:28:20 -070038 * This was not added here since it would update BiometricPrompt API. But, is used in
39 * BiometricManager.
40 * @hide
41 */
Kevin Chyna8b57ef2018-10-25 11:09:23 -070042 int BIOMETRIC_SUCCESS = 0;
Kevin Chyne7411422018-09-27 17:28:20 -070043
44 /**
Vishwath Mohancf87df12018-03-20 22:57:17 -070045 * The hardware is unavailable. Try again later.
46 */
47 int BIOMETRIC_ERROR_HW_UNAVAILABLE = 1;
48
49 /**
50 * Error state returned when the sensor was unable to process the current image.
51 */
52 int BIOMETRIC_ERROR_UNABLE_TO_PROCESS = 2;
53
54 /**
55 * Error state returned when the current request has been running too long. This is intended to
56 * prevent programs from waiting for the biometric sensor indefinitely. The timeout is platform
57 * and sensor-specific, but is generally on the order of 30 seconds.
58 */
59 int BIOMETRIC_ERROR_TIMEOUT = 3;
60
61 /**
62 * Error state returned for operations like enrollment; the operation cannot be completed
63 * because there's not enough storage remaining to complete the operation.
64 */
65 int BIOMETRIC_ERROR_NO_SPACE = 4;
66
67 /**
68 * The operation was canceled because the biometric sensor is unavailable. For example, this may
69 * happen when the user is switched, the device is locked or another pending operation prevents
70 * or disables it.
71 */
72 int BIOMETRIC_ERROR_CANCELED = 5;
73
74 /**
75 * The {@link BiometricManager#remove} call failed. Typically this will happen when the provided
76 * biometric id was incorrect.
77 *
78 * @hide
79 */
80 int BIOMETRIC_ERROR_UNABLE_TO_REMOVE = 6;
81
82 /**
83 * The operation was canceled because the API is locked out due to too many attempts.
84 * This occurs after 5 failed attempts, and lasts for 30 seconds.
85 */
86 int BIOMETRIC_ERROR_LOCKOUT = 7;
87
88 /**
Kevin Chyna73bfa22019-12-06 12:02:00 -080089 * OEMs should use this constant if there are conditions that do not fit under any of the other
90 * publicly defined constants, and must provide appropriate strings for these
91 * errors to the {@link BiometricPrompt.AuthenticationCallback#onAuthenticationError(int,
92 * CharSequence)} callback. OEMs should expect that the error message will be shown to users.
Vishwath Mohancf87df12018-03-20 22:57:17 -070093 */
94 int BIOMETRIC_ERROR_VENDOR = 8;
95
96 /**
97 * The operation was canceled because BIOMETRIC_ERROR_LOCKOUT occurred too many times.
98 * Biometric authentication is disabled until the user unlocks with strong authentication
99 * (PIN/Pattern/Password)
100 */
101 int BIOMETRIC_ERROR_LOCKOUT_PERMANENT = 9;
102
103 /**
104 * The user canceled the operation. Upon receiving this, applications should use alternate
105 * authentication (e.g. a password). The application should also provide the means to return to
106 * biometric authentication, such as a "use <biometric>" button.
107 */
108 int BIOMETRIC_ERROR_USER_CANCELED = 10;
109
110 /**
111 * The user does not have any biometrics enrolled.
112 */
113 int BIOMETRIC_ERROR_NO_BIOMETRICS = 11;
114
115 /**
116 * The device does not have a biometric sensor.
117 */
118 int BIOMETRIC_ERROR_HW_NOT_PRESENT = 12;
119
120 /**
Kevin Chyn91e7a3d2018-04-12 12:42:24 -0700121 * The user pressed the negative button. This is a placeholder that is currently only used
122 * by the support library.
123 * @hide
124 */
125 int BIOMETRIC_ERROR_NEGATIVE_BUTTON = 13;
126
127 /**
Kevin Chyn45d1f9d2019-02-07 13:38:04 -0800128 * The device does not have pin, pattern, or password set up. See
Ilya Matyukhin30f1dd82019-11-18 18:08:56 -0800129 * {@link BiometricPrompt.Builder#setAllowedAuthenticators(int)},
130 * {@link Authenticators#DEVICE_CREDENTIAL}, and {@link BiometricManager#canAuthenticate(int)}.
Kevin Chyn45d1f9d2019-02-07 13:38:04 -0800131 */
132 int BIOMETRIC_ERROR_NO_DEVICE_CREDENTIAL = 14;
133
134 /**
Ilya Matyukhin0f9da352019-10-03 14:10:01 -0700135 * This constant is only used by SystemUI. It notifies SystemUI that authentication was paused
136 * because the authentication attempt was unsuccessful.
137 * @hide
138 */
139 int BIOMETRIC_PAUSED_REJECTED = 100;
140
141 /**
Vishwath Mohancf87df12018-03-20 22:57:17 -0700142 * @hide
143 */
Mathew Inwood98e9ad12018-08-30 13:11:50 +0100144 @UnsupportedAppUsage
Vishwath Mohancf87df12018-03-20 22:57:17 -0700145 int BIOMETRIC_ERROR_VENDOR_BASE = 1000;
146
147 //
148 // Image acquisition messages.
149 //
150
151 /**
152 * The image acquired was good.
153 */
154 int BIOMETRIC_ACQUIRED_GOOD = 0;
155
156 /**
157 * Only a partial biometric image was detected. During enrollment, the user should be informed
158 * on what needs to happen to resolve this problem, e.g. "press firmly on sensor." (for
159 * fingerprint)
160 */
161 int BIOMETRIC_ACQUIRED_PARTIAL = 1;
162
163 /**
164 * The biometric image was too noisy to process due to a detected condition or a possibly dirty
165 * sensor (See {@link #BIOMETRIC_ACQUIRED_IMAGER_DIRTY}).
166 */
167 int BIOMETRIC_ACQUIRED_INSUFFICIENT = 2;
168
169 /**
170 * The biometric image was too noisy due to suspected or detected dirt on the sensor. For
171 * example, it's reasonable return this after multiple {@link #BIOMETRIC_ACQUIRED_INSUFFICIENT}
172 * or actual detection of dirt on the sensor (stuck pixels, swaths, etc.). The user is expected
173 * to take action to clean the sensor when this is returned.
174 */
175 int BIOMETRIC_ACQUIRED_IMAGER_DIRTY = 3;
176
177 /**
178 * The biometric image was unreadable due to lack of motion.
179 */
180 int BIOMETRIC_ACQUIRED_TOO_SLOW = 4;
181
182 /**
183 * The biometric image was incomplete due to quick motion. For example, this could also happen
184 * if the user moved during acquisition. The user should be asked to repeat the operation more
185 * slowly.
186 */
187 int BIOMETRIC_ACQUIRED_TOO_FAST = 5;
188
189 /**
190 * Hardware vendors may extend this list if there are conditions that do not fall under one of
191 * the above categories. Vendors are responsible for providing error strings for these errors.
192 * @hide
193 */
194 int BIOMETRIC_ACQUIRED_VENDOR = 6;
195 /**
196 * @hide
197 */
Kevin Chyna24e9fd2018-08-27 12:39:17 -0700198 int BIOMETRIC_ACQUIRED_VENDOR_BASE = 1000;
Vishwath Mohancf87df12018-03-20 22:57:17 -0700199}