1 /*
2  * Copyright (C) 2022 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 
17 package android.server.biometrics.cts;
18 
19 import java.util.List;
20 
21 /**
22  * Shared constants for the on-device and host-side test apps.
23  *
24  * TODO(b/253318030): Find a better way to make these visible to the host.
25  */
26 public class FingerprintHostsideConstants {
27 
28     /** Acquired messages sent during the enrollment test. */
29     public static final List<Integer> FINGERPRINT_ENROLL_ACQUIRED_MESSAGES = List.of(
30             8 /* AcquiredInfo.START */,
31             4 /* AcquiredInfo.SENSOR_DIRTY */,
32             2 /* AcquiredInfo.PARTIAL */,
33             5 /* AcquiredInfo.TOO_SLOW */,
34             1 /* AcquiredInfo.GOOD */);
35 
36     /** {@see com.android.server.biometrics.sensors.fingerprint.aidl.AidlConversionUtils#toFrameworkAcquiredInfo}. */
37     public static final List<Integer> FINGERPRINT_ENROLL_ACQUIRED_MESSAGES_AIDL = List.of(
38             7 /* BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_START */,
39             3 /* BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_IMAGER_DIRTY */,
40             1 /* BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_PARTIAL */,
41             4 /* BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_TOO_SLOW */,
42             0 /* BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_GOOD */
43     );
44 
45     /** Acquired messages sent during the enrollment test. */
46     public static final List<Integer> FACE_ENROLL_ACQUIRED_MESSAGES = List.of(
47             21 /* AcquiredInfo.START */,
48             22 /* AcquiredInfo.SENSOR_DIRTY */,
49             20 /* AcquiredInfo.FACE_OBSCURED */,
50             10 /* AcquiredInfo.FACE_TOO_LEFT */,
51             1 /* AcquiredInfo.GOOD */
52     );
53 
54     /** {@see com.android.server.biometrics.sensors.face.aidl.AidlConversionUtils#toFrameworkAcquiredInfo}. */
55     public static final List<Integer> FACE_ENROLL_ACQUIRED_MESSAGES_AIDL = List.of(
56             20 /* BiometricFaceConstants.FACE_ACQUIRED_START */,
57             21 /* BiometricFaceConstants.FACE_ACQUIRED_SENSOR_DIRTY */,
58             19 /* BiometricFaceConstants.FACE_ACQUIRED_FACE_OBSCURED */,
59             9 /* BiometricFaceConstants.FACE_ACQUIRED_TOO_LEFT */,
60             0 /* BiometricFaceConstants.FACE_ACQUIRED_GOOD */
61     );
62 
63     /** Acquired messages sent during the authentication test. */
64     public static final List<Integer> FINGERPRINT_AUTH_ACQUIRED_MESSAGES = List.of(
65             8 /* AcquiredInfo.START */,
66             4 /* AcquiredInfo.SENSOR_DIRTY */,
67             2 /* AcquiredInfo.PARTIAL */,
68             5 /* AcquiredInfo.TOO_SLOW */,
69             1 /* AcquiredInfo.GOOD */);
70 
71     /** {@see com.android.server.biometrics.sensors.fingerprint.aidl.AidlConversionUtils#toFrameworkAcquiredInfo}. */
72     public static final List<Integer> FINGERPRINT_AUTH_ACQUIRED_MESSAGES_AIDL = List.of(
73             7 /* BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_START */,
74             3 /* BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_IMAGER_DIRTY */,
75             1 /* BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_PARTIAL */,
76             4 /* BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_TOO_SLOW */,
77             0 /* BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_GOOD */
78     );
79 
80     /** Acquired messages sent during the authentication test. */
81     public static final List<Integer> FACE_AUTH_ACQUIRED_MESSAGES = List.of(
82             21 /* AcquiredInfo.START */,
83             22 /* AcquiredInfo.SENSOR_DIRTY */,
84             20 /* AcquiredInfo.FACE_OBSCURED */,
85             10 /* AcquiredInfo.FACE_TOO_LEFT */,
86             1 /* AcquiredInfo.GOOD */
87     );
88 
89     /** {@see com.android.server.biometrics.sensors.face.aidl.AidlConversionUtils#toFrameworkAcquiredInfo}. */
90     public static final List<Integer> FACE_AUTH_ACQUIRED_MESSAGES_AIDL = List.of(
91             20 /* BiometricFaceConstants.FACE_ACQUIRED_START */,
92             21 /* BiometricFaceConstants.FACE_ACQUIRED_SENSOR_DIRTY */,
93             19 /* BiometricFaceConstants.FACE_ACQUIRED_FACE_OBSCURED */,
94             9 /* BiometricFaceConstants.FACE_ACQUIRED_TOO_LEFT */,
95             0 /* BiometricFaceConstants.FACE_ACQUIRED_GOOD */
96     );
97 
FingerprintHostsideConstants()98     private FingerprintHostsideConstants() {}
99 }
100