blob: 27c04b4073156a919031955d51b7a117371a9876 [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;
Kevin Chyn45d1f9d2019-02-07 13:38:04 -080020import android.app.KeyguardManager;
Mathew Inwood98e9ad12018-08-30 13:11:50 +010021
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 /**
89 * Hardware vendors may extend this list if there are conditions that do not fall under one of
90 * the above categories. Vendors are responsible for providing error strings for these errors.
91 * These messages are typically reserved for internal operations such as enrollment, but may be
92 * used to express vendor errors not otherwise covered. Applications are expected to show the
93 * error message string if they happen, but are advised not to rely on the message id since they
94 * will be device and vendor-specific
95 */
96 int BIOMETRIC_ERROR_VENDOR = 8;
97
98 /**
99 * The operation was canceled because BIOMETRIC_ERROR_LOCKOUT occurred too many times.
100 * Biometric authentication is disabled until the user unlocks with strong authentication
101 * (PIN/Pattern/Password)
102 */
103 int BIOMETRIC_ERROR_LOCKOUT_PERMANENT = 9;
104
105 /**
106 * The user canceled the operation. Upon receiving this, applications should use alternate
107 * authentication (e.g. a password). The application should also provide the means to return to
108 * biometric authentication, such as a "use <biometric>" button.
109 */
110 int BIOMETRIC_ERROR_USER_CANCELED = 10;
111
112 /**
113 * The user does not have any biometrics enrolled.
114 */
115 int BIOMETRIC_ERROR_NO_BIOMETRICS = 11;
116
117 /**
118 * The device does not have a biometric sensor.
119 */
120 int BIOMETRIC_ERROR_HW_NOT_PRESENT = 12;
121
122 /**
Kevin Chyn91e7a3d2018-04-12 12:42:24 -0700123 * The user pressed the negative button. This is a placeholder that is currently only used
124 * by the support library.
125 * @hide
126 */
127 int BIOMETRIC_ERROR_NEGATIVE_BUTTON = 13;
128
129 /**
Kevin Chyn45d1f9d2019-02-07 13:38:04 -0800130 * The device does not have pin, pattern, or password set up. See
Kevin Chyne64d74e2019-03-04 10:41:03 -0800131 * {@link BiometricPrompt.Builder#setDeviceCredentialAllowed(boolean)} and
Kevin Chyn45d1f9d2019-02-07 13:38:04 -0800132 * {@link KeyguardManager#isDeviceSecure()}
133 */
134 int BIOMETRIC_ERROR_NO_DEVICE_CREDENTIAL = 14;
135
136 /**
Vishwath Mohancf87df12018-03-20 22:57:17 -0700137 * @hide
138 */
Mathew Inwood98e9ad12018-08-30 13:11:50 +0100139 @UnsupportedAppUsage
Vishwath Mohancf87df12018-03-20 22:57:17 -0700140 int BIOMETRIC_ERROR_VENDOR_BASE = 1000;
141
142 //
143 // Image acquisition messages.
144 //
145
146 /**
147 * The image acquired was good.
148 */
149 int BIOMETRIC_ACQUIRED_GOOD = 0;
150
151 /**
152 * Only a partial biometric image was detected. During enrollment, the user should be informed
153 * on what needs to happen to resolve this problem, e.g. "press firmly on sensor." (for
154 * fingerprint)
155 */
156 int BIOMETRIC_ACQUIRED_PARTIAL = 1;
157
158 /**
159 * The biometric image was too noisy to process due to a detected condition or a possibly dirty
160 * sensor (See {@link #BIOMETRIC_ACQUIRED_IMAGER_DIRTY}).
161 */
162 int BIOMETRIC_ACQUIRED_INSUFFICIENT = 2;
163
164 /**
165 * The biometric image was too noisy due to suspected or detected dirt on the sensor. For
166 * example, it's reasonable return this after multiple {@link #BIOMETRIC_ACQUIRED_INSUFFICIENT}
167 * or actual detection of dirt on the sensor (stuck pixels, swaths, etc.). The user is expected
168 * to take action to clean the sensor when this is returned.
169 */
170 int BIOMETRIC_ACQUIRED_IMAGER_DIRTY = 3;
171
172 /**
173 * The biometric image was unreadable due to lack of motion.
174 */
175 int BIOMETRIC_ACQUIRED_TOO_SLOW = 4;
176
177 /**
178 * The biometric image was incomplete due to quick motion. For example, this could also happen
179 * if the user moved during acquisition. The user should be asked to repeat the operation more
180 * slowly.
181 */
182 int BIOMETRIC_ACQUIRED_TOO_FAST = 5;
183
184 /**
185 * Hardware vendors may extend this list if there are conditions that do not fall under one of
186 * the above categories. Vendors are responsible for providing error strings for these errors.
187 * @hide
188 */
189 int BIOMETRIC_ACQUIRED_VENDOR = 6;
190 /**
191 * @hide
192 */
Kevin Chyna24e9fd2018-08-27 12:39:17 -0700193 int BIOMETRIC_ACQUIRED_VENDOR_BASE = 1000;
Vishwath Mohancf87df12018-03-20 22:57:17 -0700194}