blob: c814b7c67817c37e18c4a9cf71bedd4025c499a4 [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
Mathew Inwood98e9ad12018-08-30 13:11:50 +010019import android.annotation.UnsupportedAppUsage;
20
Vishwath Mohancf87df12018-03-20 22:57:17 -070021
22/**
23 * Interface containing all of the biometric modality agnostic constants.
Kevin Chyn91e7a3d2018-04-12 12:42:24 -070024 *
25 * NOTE: The error messages must be consistent between BiometricConstants, Biometric*Constants,
26 * and the frameworks/support/biometric/.../BiometricConstants files.
27 *
Vishwath Mohancf87df12018-03-20 22:57:17 -070028 * @hide
29 */
30public interface BiometricConstants {
31 //
32 // Error messages from biometric hardware during initilization, enrollment, authentication or
33 // removal.
34 //
35
36 /**
Kevin Chyne7411422018-09-27 17:28:20 -070037 * This was not added here since it would update BiometricPrompt API. But, is used in
38 * BiometricManager.
39 * @hide
40 */
Kevin Chyna8b57ef2018-10-25 11:09:23 -070041 int BIOMETRIC_SUCCESS = 0;
Kevin Chyne7411422018-09-27 17:28:20 -070042
43 /**
Vishwath Mohancf87df12018-03-20 22:57:17 -070044 * The hardware is unavailable. Try again later.
45 */
46 int BIOMETRIC_ERROR_HW_UNAVAILABLE = 1;
47
48 /**
49 * Error state returned when the sensor was unable to process the current image.
50 */
51 int BIOMETRIC_ERROR_UNABLE_TO_PROCESS = 2;
52
53 /**
54 * Error state returned when the current request has been running too long. This is intended to
55 * prevent programs from waiting for the biometric sensor indefinitely. The timeout is platform
56 * and sensor-specific, but is generally on the order of 30 seconds.
57 */
58 int BIOMETRIC_ERROR_TIMEOUT = 3;
59
60 /**
61 * Error state returned for operations like enrollment; the operation cannot be completed
62 * because there's not enough storage remaining to complete the operation.
63 */
64 int BIOMETRIC_ERROR_NO_SPACE = 4;
65
66 /**
67 * The operation was canceled because the biometric sensor is unavailable. For example, this may
68 * happen when the user is switched, the device is locked or another pending operation prevents
69 * or disables it.
70 */
71 int BIOMETRIC_ERROR_CANCELED = 5;
72
73 /**
74 * The {@link BiometricManager#remove} call failed. Typically this will happen when the provided
75 * biometric id was incorrect.
76 *
77 * @hide
78 */
79 int BIOMETRIC_ERROR_UNABLE_TO_REMOVE = 6;
80
81 /**
82 * The operation was canceled because the API is locked out due to too many attempts.
83 * This occurs after 5 failed attempts, and lasts for 30 seconds.
84 */
85 int BIOMETRIC_ERROR_LOCKOUT = 7;
86
87 /**
88 * Hardware vendors may extend this list if there are conditions that do not fall under one of
89 * the above categories. Vendors are responsible for providing error strings for these errors.
90 * These messages are typically reserved for internal operations such as enrollment, but may be
91 * used to express vendor errors not otherwise covered. Applications are expected to show the
92 * error message string if they happen, but are advised not to rely on the message id since they
93 * will be device and vendor-specific
94 */
95 int BIOMETRIC_ERROR_VENDOR = 8;
96
97 /**
98 * The operation was canceled because BIOMETRIC_ERROR_LOCKOUT occurred too many times.
99 * Biometric authentication is disabled until the user unlocks with strong authentication
100 * (PIN/Pattern/Password)
101 */
102 int BIOMETRIC_ERROR_LOCKOUT_PERMANENT = 9;
103
104 /**
105 * The user canceled the operation. Upon receiving this, applications should use alternate
106 * authentication (e.g. a password). The application should also provide the means to return to
107 * biometric authentication, such as a "use <biometric>" button.
108 */
109 int BIOMETRIC_ERROR_USER_CANCELED = 10;
110
111 /**
112 * The user does not have any biometrics enrolled.
113 */
114 int BIOMETRIC_ERROR_NO_BIOMETRICS = 11;
115
116 /**
117 * The device does not have a biometric sensor.
118 */
119 int BIOMETRIC_ERROR_HW_NOT_PRESENT = 12;
120
121 /**
Kevin Chyn91e7a3d2018-04-12 12:42:24 -0700122 * The user pressed the negative button. This is a placeholder that is currently only used
123 * by the support library.
124 * @hide
125 */
126 int BIOMETRIC_ERROR_NEGATIVE_BUTTON = 13;
127
128 /**
Vishwath Mohancf87df12018-03-20 22:57:17 -0700129 * @hide
130 */
Mathew Inwood98e9ad12018-08-30 13:11:50 +0100131 @UnsupportedAppUsage
Vishwath Mohancf87df12018-03-20 22:57:17 -0700132 int BIOMETRIC_ERROR_VENDOR_BASE = 1000;
133
134 //
135 // Image acquisition messages.
136 //
137
138 /**
139 * The image acquired was good.
140 */
141 int BIOMETRIC_ACQUIRED_GOOD = 0;
142
143 /**
144 * Only a partial biometric image was detected. During enrollment, the user should be informed
145 * on what needs to happen to resolve this problem, e.g. "press firmly on sensor." (for
146 * fingerprint)
147 */
148 int BIOMETRIC_ACQUIRED_PARTIAL = 1;
149
150 /**
151 * The biometric image was too noisy to process due to a detected condition or a possibly dirty
152 * sensor (See {@link #BIOMETRIC_ACQUIRED_IMAGER_DIRTY}).
153 */
154 int BIOMETRIC_ACQUIRED_INSUFFICIENT = 2;
155
156 /**
157 * The biometric image was too noisy due to suspected or detected dirt on the sensor. For
158 * example, it's reasonable return this after multiple {@link #BIOMETRIC_ACQUIRED_INSUFFICIENT}
159 * or actual detection of dirt on the sensor (stuck pixels, swaths, etc.). The user is expected
160 * to take action to clean the sensor when this is returned.
161 */
162 int BIOMETRIC_ACQUIRED_IMAGER_DIRTY = 3;
163
164 /**
165 * The biometric image was unreadable due to lack of motion.
166 */
167 int BIOMETRIC_ACQUIRED_TOO_SLOW = 4;
168
169 /**
170 * The biometric image was incomplete due to quick motion. For example, this could also happen
171 * if the user moved during acquisition. The user should be asked to repeat the operation more
172 * slowly.
173 */
174 int BIOMETRIC_ACQUIRED_TOO_FAST = 5;
175
176 /**
177 * Hardware vendors may extend this list if there are conditions that do not fall under one of
178 * the above categories. Vendors are responsible for providing error strings for these errors.
179 * @hide
180 */
181 int BIOMETRIC_ACQUIRED_VENDOR = 6;
182 /**
183 * @hide
184 */
Kevin Chyna24e9fd2018-08-27 12:39:17 -0700185 int BIOMETRIC_ACQUIRED_VENDOR_BASE = 1000;
Vishwath Mohancf87df12018-03-20 22:57:17 -0700186}