blob: 6cbab471ce234946cfe77bef972353ebec3532c9 [file] [log] [blame]
Kevin Chyn66682562018-01-25 18:26:46 -08001/*
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;
Kevin Chyn66682562018-01-25 18:26:46 -080021import android.hardware.fingerprint.FingerprintManager;
22
23/**
24 * Interface containing all of the fingerprint-specific 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 *
Kevin Chyn66682562018-01-25 18:26:46 -080029 * @hide
30 */
31public interface BiometricFingerprintConstants {
32 //
33 // Error messages from fingerprint hardware during initilization, enrollment, authentication or
34 // removal. Must agree with the list in fingerprint.h
35 //
36
37 /**
38 * The hardware is unavailable. Try again later.
39 */
40 public static final int FINGERPRINT_ERROR_HW_UNAVAILABLE = 1;
41
42 /**
43 * Error state returned when the sensor was unable to process the current image.
44 */
45 public static final int FINGERPRINT_ERROR_UNABLE_TO_PROCESS = 2;
46
47 /**
48 * Error state returned when the current request has been running too long. This is intended to
49 * prevent programs from waiting for the fingerprint sensor indefinitely. The timeout is
50 * platform and sensor-specific, but is generally on the order of 30 seconds.
51 */
52 public static final int FINGERPRINT_ERROR_TIMEOUT = 3;
53
54 /**
55 * Error state returned for operations like enrollment; the operation cannot be completed
56 * because there's not enough storage remaining to complete the operation.
57 */
58 public static final int FINGERPRINT_ERROR_NO_SPACE = 4;
59
60 /**
61 * The operation was canceled because the fingerprint sensor is unavailable. For example,
62 * this may happen when the user is switched, the device is locked or another pending operation
63 * prevents or disables it.
64 */
65 public static final int FINGERPRINT_ERROR_CANCELED = 5;
66
67 /**
68 * The {@link FingerprintManager#remove} call failed. Typically this will happen when the
69 * provided fingerprint id was incorrect.
70 *
71 * @hide
72 */
73 public static final int FINGERPRINT_ERROR_UNABLE_TO_REMOVE = 6;
74
75 /**
76 * The operation was canceled because the API is locked out due to too many attempts.
77 * This occurs after 5 failed attempts, and lasts for 30 seconds.
78 */
79 public static final int FINGERPRINT_ERROR_LOCKOUT = 7;
80
81 /**
82 * Hardware vendors may extend this list if there are conditions that do not fall under one of
83 * the above categories. Vendors are responsible for providing error strings for these errors.
84 * These messages are typically reserved for internal operations such as enrollment, but may be
85 * used to express vendor errors not covered by the ones in fingerprint.h. Applications are
86 * expected to show the error message string if they happen, but are advised not to rely on the
87 * message id since they will be device and vendor-specific
88 */
89 public static final int FINGERPRINT_ERROR_VENDOR = 8;
90
91 /**
92 * The operation was canceled because FINGERPRINT_ERROR_LOCKOUT occurred too many times.
93 * Fingerprint authentication is disabled until the user unlocks with strong authentication
94 * (PIN/Pattern/Password)
95 */
96 public static final int FINGERPRINT_ERROR_LOCKOUT_PERMANENT = 9;
97
98 /**
99 * The user canceled the operation. Upon receiving this, applications should use alternate
100 * authentication (e.g. a password). The application should also provide the means to return
101 * to fingerprint authentication, such as a "use fingerprint" button.
102 */
103 public static final int FINGERPRINT_ERROR_USER_CANCELED = 10;
104
105 /**
106 * The user does not have any fingerprints enrolled.
107 */
108 public static final int FINGERPRINT_ERROR_NO_FINGERPRINTS = 11;
109
110 /**
111 * The device does not have a fingerprint sensor.
112 */
113 public static final int FINGERPRINT_ERROR_HW_NOT_PRESENT = 12;
114
115 /**
Kevin Chyn91e7a3d2018-04-12 12:42:24 -0700116 * The user pressed the negative button. This is a placeholder that is currently only used
117 * by the support library.
118 * @hide
119 */
120 public static final int FINGERPRINT_ERROR_NEGATIVE_BUTTON = 13;
121
122 /**
Kevin Chyn45d1f9d2019-02-07 13:38:04 -0800123 * The device does not have pin, pattern, or password set up. See
124 * {@link BiometricPrompt.Builder#setAllowDeviceCredential(boolean)} and
125 * {@link KeyguardManager#isDeviceSecure()}
126 * @hide
127 */
128 public static final int BIOMETRIC_ERROR_NO_DEVICE_CREDENTIAL = 14;
129
130 /**
Kevin Chyn66682562018-01-25 18:26:46 -0800131 * @hide
132 */
Mathew Inwood98e9ad12018-08-30 13:11:50 +0100133 @UnsupportedAppUsage
Kevin Chyn66682562018-01-25 18:26:46 -0800134 public static final int FINGERPRINT_ERROR_VENDOR_BASE = 1000;
135
136 //
137 // Image acquisition messages. Must agree with those in fingerprint.h
138 //
139
140 /**
141 * The image acquired was good.
142 */
143 public static final int FINGERPRINT_ACQUIRED_GOOD = 0;
144
145 /**
146 * Only a partial fingerprint image was detected. During enrollment, the user should be
147 * informed on what needs to happen to resolve this problem, e.g. "press firmly on sensor."
148 */
149 public static final int FINGERPRINT_ACQUIRED_PARTIAL = 1;
150
151 /**
152 * The fingerprint image was too noisy to process due to a detected condition (i.e. dry skin) or
153 * a possibly dirty sensor (See {@link #FINGERPRINT_ACQUIRED_IMAGER_DIRTY}).
154 */
155 public static final int FINGERPRINT_ACQUIRED_INSUFFICIENT = 2;
156
157 /**
158 * The fingerprint image was too noisy due to suspected or detected dirt on the sensor.
159 * For example, it's reasonable return this after multiple
160 * {@link #FINGERPRINT_ACQUIRED_INSUFFICIENT} or actual detection of dirt on the sensor
161 * (stuck pixels, swaths, etc.). The user is expected to take action to clean the sensor
162 * when this is returned.
163 */
164 public static final int FINGERPRINT_ACQUIRED_IMAGER_DIRTY = 3;
165
166 /**
167 * The fingerprint image was unreadable due to lack of motion. This is most appropriate for
168 * linear array sensors that require a swipe motion.
169 */
170 public static final int FINGERPRINT_ACQUIRED_TOO_SLOW = 4;
171
172 /**
173 * The fingerprint image was incomplete due to quick motion. While mostly appropriate for
174 * linear array sensors, this could also happen if the finger was moved during acquisition.
175 * The user should be asked to move the finger slower (linear) or leave the finger on the sensor
176 * longer.
177 */
178 public static final int FINGERPRINT_ACQUIRED_TOO_FAST = 5;
179
180 /**
181 * Hardware vendors may extend this list if there are conditions that do not fall under one of
182 * the above categories. Vendors are responsible for providing error strings for these errors.
183 * @hide
184 */
185 public static final int FINGERPRINT_ACQUIRED_VENDOR = 6;
186 /**
187 * @hide
188 */
189 public static final int FINGERPRINT_ACQUIRED_VENDOR_BASE = 1000;
190}