1 /* 2 * Copyright (C) 2019 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.hardware.biometrics.BiometricAuthenticator.Modality; 20 import android.view.WindowManager; 21 22 import com.android.systemui.Dumpable; 23 import com.android.systemui.biometrics.ui.viewmodel.PromptViewModel; 24 25 /** 26 * Interface for the biometric dialog UI. 27 * 28 * TODO(b/287311775): remove along with legacy controller once flag is removed 29 */ 30 @Deprecated 31 public interface AuthDialog extends Dumpable { 32 33 /** 34 * Parameters used when laying out {@link AuthBiometricView}, its subclasses, and 35 * {@link AuthPanelController}. 36 */ 37 class LayoutParams { 38 public final int mMediumHeight; 39 public final int mMediumWidth; 40 LayoutParams(int mediumWidth, int mediumHeight)41 public LayoutParams(int mediumWidth, int mediumHeight) { 42 mMediumWidth = mediumWidth; 43 mMediumHeight = mediumHeight; 44 } 45 } 46 47 /** 48 * Show the dialog. 49 * @param wm 50 */ show(WindowManager wm)51 void show(WindowManager wm); 52 53 /** 54 * Dismiss the dialog without sending a callback. 55 */ dismissWithoutCallback(boolean animate)56 void dismissWithoutCallback(boolean animate); 57 58 /** 59 * Dismiss the dialog. Animate away. 60 */ dismissFromSystemServer()61 void dismissFromSystemServer(); 62 63 /** 64 * Biometric authenticated. May be pending user confirmation, or completed. 65 */ onAuthenticationSucceeded(@odality int modality)66 void onAuthenticationSucceeded(@Modality int modality); 67 68 /** 69 * Authentication failed (reject, timeout). Dialog stays showing. 70 * @param modality sensor modality that triggered the error 71 * @param failureReason message 72 */ onAuthenticationFailed(@odality int modality, String failureReason)73 void onAuthenticationFailed(@Modality int modality, String failureReason); 74 75 /** 76 * Authentication rejected, or help message received. 77 * @param modality sensor modality that triggered the help message 78 * @param help message 79 */ onHelp(@odality int modality, String help)80 void onHelp(@Modality int modality, String help); 81 82 /** 83 * Authentication failed. Dialog going away. 84 * @param modality sensor modality that triggered the error 85 * @param error message 86 */ onError(@odality int modality, String error)87 void onError(@Modality int modality, String error); 88 89 /** UDFPS pointer down event. */ onPointerDown()90 void onPointerDown(); 91 92 /** 93 * Get the client's package name 94 */ getOpPackageName()95 String getOpPackageName(); 96 97 /** The requestId of the underlying operation within the framework. */ getRequestId()98 long getRequestId(); 99 100 /** 101 * Animate to credential UI. Typically called after biometric is locked out. 102 */ animateToCredentialUI(boolean isError)103 void animateToCredentialUI(boolean isError); 104 105 /** 106 * @return true if device credential is allowed. 107 */ isAllowDeviceCredentials()108 boolean isAllowDeviceCredentials(); 109 110 /** 111 * Called when the device's orientation changed and the dialog may need to do another 112 * layout. This is most relevant to UDFPS since configuration changes are not sent by 113 * the framework in equivalent cases (landscape to reverse landscape) but the dialog 114 * must remain fixed on the physical sensor location. 115 */ onOrientationChanged()116 void onOrientationChanged(); 117 getViewModel()118 PromptViewModel getViewModel(); 119 } 120