1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
/*
* Copyright (C) 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.systemui.biometrics;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.hardware.biometrics.BiometricAuthenticator.Modality;
import android.os.Bundle;
import android.view.WindowManager;
import com.android.systemui.Dumpable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Interface for the biometric dialog UI.
*/
public interface AuthDialog extends Dumpable {
String KEY_CONTAINER_GOING_AWAY = "container_going_away";
String KEY_BIOMETRIC_SHOWING = "biometric_showing";
String KEY_CREDENTIAL_SHOWING = "credential_showing";
String KEY_BIOMETRIC_CONFIRM_VISIBILITY = "confirm_visibility";
String KEY_BIOMETRIC_TRY_AGAIN_VISIBILITY = "try_agian_visibility";
String KEY_BIOMETRIC_STATE = "state";
String KEY_BIOMETRIC_INDICATOR_STRING = "indicator_string"; // error / help / hint
String KEY_BIOMETRIC_INDICATOR_ERROR_SHOWING = "error_is_temporary";
String KEY_BIOMETRIC_INDICATOR_HELP_SHOWING = "hint_is_temporary";
String KEY_BIOMETRIC_DIALOG_SIZE = "size";
String KEY_BIOMETRIC_SENSOR_TYPE = "sensor_type";
String KEY_BIOMETRIC_SENSOR_PROPS = "sensor_props";
String KEY_BIOMETRIC_ORIENTATION_CHANGED = "orientation_changed";
int SIZE_UNKNOWN = 0;
/**
* Minimal UI, showing only biometric icon.
*/
int SIZE_SMALL = 1;
/**
* Normal-sized biometric UI, showing title, icon, buttons, etc.
*/
int SIZE_MEDIUM = 2;
/**
* Full-screen credential UI.
*/
int SIZE_LARGE = 3;
@Retention(RetentionPolicy.SOURCE)
@IntDef({SIZE_UNKNOWN, SIZE_SMALL, SIZE_MEDIUM, SIZE_LARGE})
@interface DialogSize {}
/**
* Parameters used when laying out {@link AuthBiometricView}, its subclasses, and
* {@link AuthPanelController}.
*/
class LayoutParams {
final int mMediumHeight;
final int mMediumWidth;
LayoutParams(int mediumWidth, int mediumHeight) {
mMediumWidth = mediumWidth;
mMediumHeight = mediumHeight;
}
}
/**
* Animation duration, from small to medium dialog, including back panel, icon translation, etc
*/
int ANIMATE_SMALL_TO_MEDIUM_DURATION_MS = 150;
/**
* Animation duration from medium to large dialog, including biometric fade out, back panel, etc
*/
int ANIMATE_MEDIUM_TO_LARGE_DURATION_MS = 450;
/**
* Delay before notifying {@link AuthCredentialView} to start animating in.
*/
int ANIMATE_CREDENTIAL_START_DELAY_MS = ANIMATE_MEDIUM_TO_LARGE_DURATION_MS * 2 / 3;
/**
* Animation duration when sliding in credential UI
*/
int ANIMATE_CREDENTIAL_INITIAL_DURATION_MS = 150;
/**
* Show the dialog.
* @param wm
*/
void show(WindowManager wm, @Nullable Bundle savedState);
/**
* Dismiss the dialog without sending a callback.
*/
void dismissWithoutCallback(boolean animate);
/**
* Dismiss the dialog. Animate away.
*/
void dismissFromSystemServer();
/**
* Biometric authenticated. May be pending user confirmation, or completed.
*/
void onAuthenticationSucceeded(@Modality int modality);
/**
* Authentication failed (reject, timeout). Dialog stays showing.
* @param modality sensor modality that triggered the error
* @param failureReason message
*/
void onAuthenticationFailed(@Modality int modality, String failureReason);
/**
* Authentication rejected, or help message received.
* @param modality sensor modality that triggered the help message
* @param help message
*/
void onHelp(@Modality int modality, String help);
/**
* Authentication failed. Dialog going away.
* @param modality sensor modality that triggered the error
* @param error message
*/
void onError(@Modality int modality, String error);
/** UDFPS pointer down event. */
void onPointerDown();
/**
* Save the current state.
* @param outState
*/
void onSaveState(@NonNull Bundle outState);
/**
* Get the client's package name
*/
String getOpPackageName();
/** The requestId of the underlying operation within the framework. */
long getRequestId();
/**
* Get the class name of ConfirmDeviceCredentialActivity. Returns null if the direct caller is
* not ConfirmDeviceCredentialActivity.
*/
String getClassNameIfItIsConfirmDeviceCredentialActivity();
/**
* Animate to credential UI. Typically called after biometric is locked out.
*/
void animateToCredentialUI();
/**
* @return true if device credential is allowed.
*/
boolean isAllowDeviceCredentials();
/**
* Called when the device's orientation changed and the dialog may need to do another
* layout. This is most relevant to UDFPS since configuration changes are not sent by
* the framework in equivalent cases (landscape to reverse landscape) but the dialog
* must remain fixed on the physical sensor location.
*/
void onOrientationChanged();
}
|