1 /*
2  * Copyright (C) 2023 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.hardware.biometrics;
18 
19 import android.annotation.IntDef;
20 import android.annotation.NonNull;
21 import android.annotation.Nullable;
22 
23 import java.lang.annotation.Retention;
24 import java.lang.annotation.RetentionPolicy;
25 
26 /**
27  * Common authentication options that are exposed across all modalities.
28  *
29  * @hide
30  */
31 public interface AuthenticateOptions  {
32 
33     /** The user id for this operation. */
getUserId()34     int getUserId();
35 
36     /** The sensor id for this operation. */
getSensorId()37     int getSensorId();
38 
39     /** The state is unknown. */
40     int DISPLAY_STATE_UNKNOWN = 0;
41 
42     /** The display is on and showing the lockscreen (or an occluding app). */
43     int DISPLAY_STATE_LOCKSCREEN = 1;
44 
45     /** The display is off or dozing. */
46     int DISPLAY_STATE_NO_UI = 2;
47 
48     /** The display is showing a screensaver (dreaming). */
49     int DISPLAY_STATE_SCREENSAVER = 3;
50 
51     /** The display is dreaming with always on display. */
52     int DISPLAY_STATE_AOD = 4;
53 
54     /** The doze state of the device. */
55     @IntDef(prefix = "DISPLAY_STATE_", value = {
56             DISPLAY_STATE_UNKNOWN,
57             DISPLAY_STATE_LOCKSCREEN,
58             DISPLAY_STATE_NO_UI,
59             DISPLAY_STATE_SCREENSAVER,
60             DISPLAY_STATE_AOD
61     })
62     @Retention(RetentionPolicy.SOURCE)
63     @interface DisplayState {}
64 
65     /** The current doze state of the device. */
66     @DisplayState
getDisplayState()67     int getDisplayState();
68 
69     /**
70      * The package name for that operation that should be used for
71      * {@link android.app.AppOpsManager} verification.
72      */
getOpPackageName()73     @NonNull String getOpPackageName();
74 
75     /** The attribution tag, if any. */
getAttributionTag()76     @Nullable String getAttributionTag();
77 }
78