1cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan/*
2cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan * Copyright (C) 2018 The Android Open Source Project
3cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan *
4cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan * Licensed under the Apache License, Version 2.0 (the "License");
5cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan * you may not use this file except in compliance with the License.
6cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan * You may obtain a copy of the License at
7cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan *
8cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan *      http://www.apache.org/licenses/LICENSE-2.0
9cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan *
10cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan * Unless required by applicable law or agreed to in writing, software
11cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan * distributed under the License is distributed on an "AS IS" BASIS,
12cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan * See the License for the specific language governing permissions and
14cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan * limitations under the License.
15cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan */
16cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
17cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohanpackage android.hardware.biometrics;
18cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
19cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
20cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan/**
21cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan * Interface containing all of the biometric modality agnostic constants.
22cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan * @hide
23cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan */
24cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohanpublic interface BiometricConstants {
25cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    //
26cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    // Error messages from biometric hardware during initilization, enrollment, authentication or
27cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    // removal.
28cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    //
29cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
30cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    /**
31cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * The hardware is unavailable. Try again later.
32cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     */
33cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    int BIOMETRIC_ERROR_HW_UNAVAILABLE = 1;
34cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
35cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    /**
36cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * Error state returned when the sensor was unable to process the current image.
37cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     */
38cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    int BIOMETRIC_ERROR_UNABLE_TO_PROCESS = 2;
39cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
40cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    /**
41cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * Error state returned when the current request has been running too long. This is intended to
42cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * prevent programs from waiting for the biometric sensor indefinitely. The timeout is platform
43cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * and sensor-specific, but is generally on the order of 30 seconds.
44cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     */
45cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    int BIOMETRIC_ERROR_TIMEOUT = 3;
46cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
47cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    /**
48cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * Error state returned for operations like enrollment; the operation cannot be completed
49cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * because there's not enough storage remaining to complete the operation.
50cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     */
51cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    int BIOMETRIC_ERROR_NO_SPACE = 4;
52cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
53cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    /**
54cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * The operation was canceled because the biometric sensor is unavailable. For example, this may
55cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * happen when the user is switched, the device is locked or another pending operation prevents
56cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * or disables it.
57cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     */
58cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    int BIOMETRIC_ERROR_CANCELED = 5;
59cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
60cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    /**
61cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * The {@link BiometricManager#remove} call failed. Typically this will happen when the provided
62cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * biometric id was incorrect.
63cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     *
64cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * @hide
65cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     */
66cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    int BIOMETRIC_ERROR_UNABLE_TO_REMOVE = 6;
67cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
68cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    /**
69cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * The operation was canceled because the API is locked out due to too many attempts.
70cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * This occurs after 5 failed attempts, and lasts for 30 seconds.
71cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     */
72cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    int BIOMETRIC_ERROR_LOCKOUT = 7;
73cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
74cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    /**
75cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * Hardware vendors may extend this list if there are conditions that do not fall under one of
76cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * the above categories. Vendors are responsible for providing error strings for these errors.
77cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * These messages are typically reserved for internal operations such as enrollment, but may be
78cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * used to express vendor errors not otherwise covered. Applications are expected to show the
79cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * error message string if they happen, but are advised not to rely on the message id since they
80cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * will be device and vendor-specific
81cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     */
82cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    int BIOMETRIC_ERROR_VENDOR = 8;
83cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
84cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    /**
85cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * The operation was canceled because BIOMETRIC_ERROR_LOCKOUT occurred too many times.
86cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * Biometric authentication is disabled until the user unlocks with strong authentication
87cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * (PIN/Pattern/Password)
88cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     */
89cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    int BIOMETRIC_ERROR_LOCKOUT_PERMANENT = 9;
90cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
91cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    /**
92cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * The user canceled the operation. Upon receiving this, applications should use alternate
93cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * authentication (e.g. a password). The application should also provide the means to return to
94cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * biometric authentication, such as a "use <biometric>" button.
95cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     */
96cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    int BIOMETRIC_ERROR_USER_CANCELED = 10;
97cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
98cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    /**
99cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * The user does not have any biometrics enrolled.
100cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     */
101cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    int BIOMETRIC_ERROR_NO_BIOMETRICS = 11;
102cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
103cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    /**
104cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * The device does not have a biometric sensor.
105cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     */
106cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    int BIOMETRIC_ERROR_HW_NOT_PRESENT = 12;
107cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
108cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    /**
109cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * @hide
110cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     */
111cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    int BIOMETRIC_ERROR_VENDOR_BASE = 1000;
112cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
113cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    //
114cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    // Image acquisition messages.
115cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    //
116cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
117cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    /**
118cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * The image acquired was good.
119cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     */
120cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    int BIOMETRIC_ACQUIRED_GOOD = 0;
121cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
122cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    /**
123cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * Only a partial biometric image was detected. During enrollment, the user should be informed
124cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * on what needs to happen to resolve this problem, e.g. "press firmly on sensor." (for
125cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * fingerprint)
126cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     */
127cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    int BIOMETRIC_ACQUIRED_PARTIAL = 1;
128cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
129cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    /**
130cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * The biometric image was too noisy to process due to a detected condition or a possibly dirty
131cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * sensor (See {@link #BIOMETRIC_ACQUIRED_IMAGER_DIRTY}).
132cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     */
133cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    int BIOMETRIC_ACQUIRED_INSUFFICIENT = 2;
134cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
135cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    /**
136cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * The biometric image was too noisy due to suspected or detected dirt on the sensor.  For
137cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * example, it's reasonable return this after multiple {@link #BIOMETRIC_ACQUIRED_INSUFFICIENT}
138cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * or actual detection of dirt on the sensor (stuck pixels, swaths, etc.). The user is expected
139cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * to take action to clean the sensor when this is returned.
140cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     */
141cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    int BIOMETRIC_ACQUIRED_IMAGER_DIRTY = 3;
142cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
143cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    /**
144cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * The biometric image was unreadable due to lack of motion.
145cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     */
146cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    int BIOMETRIC_ACQUIRED_TOO_SLOW = 4;
147cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
148cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    /**
149cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * The biometric image was incomplete due to quick motion. For example, this could also happen
150cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * if the user moved during acquisition. The user should be asked to repeat the operation more
151cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * slowly.
152cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     */
153cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    int BIOMETRIC_ACQUIRED_TOO_FAST = 5;
154cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan
155cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    /**
156cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * Hardware vendors may extend this list if there are conditions that do not fall under one of
157cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * the above categories. Vendors are responsible for providing error strings for these errors.
158cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * @hide
159cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     */
160cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    int BIOMETRIC_ACQUIRED_VENDOR = 6;
161cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    /**
162cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     * @hide
163cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan     */
164cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan    int BIOMETRICT_ACQUIRED_VENDOR_BASE = 1000;
165cf87df15310611ae4e5229b19c5a4942e54185b5Vishwath Mohan}
166