1 /*
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 
17 package com.android.systemui.biometrics;
18 
19 import android.annotation.IntDef;
20 import android.annotation.Nullable;
21 
22 /**
23  * Callback interface for dialog views. These should be implemented by the controller (e.g.
24  * FingerprintDialogImpl) and passed into their views (e.g. FingerprintDialogView).
25  */
26 public interface AuthDialogCallback {
27 
28     int DISMISSED_USER_CANCELED = 1;
29     int DISMISSED_BUTTON_NEGATIVE = 2;
30     int DISMISSED_BUTTON_POSITIVE = 3;
31     int DISMISSED_BIOMETRIC_AUTHENTICATED = 4;
32     int DISMISSED_ERROR = 5;
33     int DISMISSED_BY_SYSTEM_SERVER = 6;
34     int DISMISSED_CREDENTIAL_AUTHENTICATED = 7;
35 
36     @IntDef({DISMISSED_USER_CANCELED,
37             DISMISSED_BUTTON_NEGATIVE,
38             DISMISSED_BUTTON_POSITIVE,
39             DISMISSED_BIOMETRIC_AUTHENTICATED,
40             DISMISSED_ERROR,
41             DISMISSED_BY_SYSTEM_SERVER,
42             DISMISSED_CREDENTIAL_AUTHENTICATED})
43     @interface DismissedReason {}
44 
45     /**
46      * Invoked when the dialog is dismissed
47      * @param reason
48      * @param credentialAttestation the HAT received from LockSettingsService upon verification
49      */
onDismissed(@ismissedReason int reason, @Nullable byte[] credentialAttestation)50     void onDismissed(@DismissedReason int reason, @Nullable byte[] credentialAttestation);
51 
52     /**
53      * Invoked when the "try again" button is clicked
54      */
onTryAgainPressed()55     void onTryAgainPressed();
56 
57     /**
58      * Invoked when the "use password" button is clicked
59      */
onDeviceCredentialPressed()60     void onDeviceCredentialPressed();
61 
62     /**
63      * See {@link android.hardware.biometrics.BiometricPrompt.Builder
64      * #setReceiveSystemEvents(boolean)}
65      * @param event
66      */
onSystemEvent(int event)67     void onSystemEvent(int event);
68 }
69