Merge changes from topic "biometric-tests"
* changes: 4/n: Make BiometricDialogView testable 3/n: Move task stack listener to SystemUI 2/n: Update BiometricService with cleaner lifecycle 1/n: Update BiometricDialog (SystemUI side) with cleaner lifecycle
This commit is contained in:
@@ -100,9 +100,12 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public static final int DISMISSED_REASON_POSITIVE = 1;
|
||||
public static final int DISMISSED_REASON_CONFIRMED = 1;
|
||||
|
||||
/**
|
||||
* Dialog is done animating away after user clicked on the button set via
|
||||
* {@link BiometricPrompt.Builder#setNegativeButton(CharSequence, Executor,
|
||||
* DialogInterface.OnClickListener)}.
|
||||
* @hide
|
||||
*/
|
||||
public static final int DISMISSED_REASON_NEGATIVE = 2;
|
||||
@@ -112,6 +115,25 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan
|
||||
*/
|
||||
public static final int DISMISSED_REASON_USER_CANCEL = 3;
|
||||
|
||||
/**
|
||||
* Authenticated, confirmation not required. Dialog animated away.
|
||||
* @hide
|
||||
*/
|
||||
public static final int DISMISSED_REASON_CONFIRM_NOT_REQUIRED = 4;
|
||||
|
||||
/**
|
||||
* Error message shown on SystemUI. When BiometricService receives this, the UI is already
|
||||
* gone.
|
||||
* @hide
|
||||
*/
|
||||
public static final int DISMISSED_REASON_ERROR = 5;
|
||||
|
||||
/**
|
||||
* Dialog dismissal requested by BiometricService.
|
||||
* @hide
|
||||
*/
|
||||
public static final int DISMISSED_REASON_SERVER_REQUESTED = 6;
|
||||
|
||||
private static class ButtonInfo {
|
||||
Executor executor;
|
||||
DialogInterface.OnClickListener listener;
|
||||
@@ -362,7 +384,7 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan
|
||||
@Override
|
||||
public void onDialogDismissed(int reason) throws RemoteException {
|
||||
// Check the reason and invoke OnClickListener(s) if necessary
|
||||
if (reason == DISMISSED_REASON_POSITIVE) {
|
||||
if (reason == DISMISSED_REASON_CONFIRMED) {
|
||||
mPositiveButtonInfo.executor.execute(() -> {
|
||||
mPositiveButtonInfo.listener.onClick(null, DialogInterface.BUTTON_POSITIVE);
|
||||
});
|
||||
|
||||
@@ -27,8 +27,8 @@ oneway interface IBiometricServiceReceiverInternal {
|
||||
// Notify BiometricService that authentication was successful. If user confirmation is required,
|
||||
// the auth token must be submitted into KeyStore.
|
||||
void onAuthenticationSucceeded(boolean requireConfirmation, in byte[] token);
|
||||
// Notify BiometricService that an error has occurred.
|
||||
void onAuthenticationFailed(int cookie, boolean requireConfirmation);
|
||||
// Notify BiometricService authentication was rejected.
|
||||
void onAuthenticationFailed();
|
||||
// Notify BiometricService than an error has occured. Forward to the correct receiver depending
|
||||
// on the cookie.
|
||||
void onError(int cookie, int error, String message);
|
||||
|
||||
@@ -153,7 +153,7 @@ oneway interface IStatusBar
|
||||
|
||||
// Used to show the dialog when BiometricService starts authentication
|
||||
void showBiometricDialog(in Bundle bundle, IBiometricServiceReceiverInternal receiver, int type,
|
||||
boolean requireConfirmation, int userId);
|
||||
boolean requireConfirmation, int userId, String opPackageName);
|
||||
// Used to hide the dialog when a biometric is authenticated
|
||||
void onBiometricAuthenticated(boolean authenticated, String failureReason);
|
||||
// Used to set a temporary message, e.g. fingerprint not recognized, finger moved too fast, etc
|
||||
|
||||
@@ -101,7 +101,7 @@ interface IStatusBarService
|
||||
|
||||
// Used to show the dialog when BiometricService starts authentication
|
||||
void showBiometricDialog(in Bundle bundle, IBiometricServiceReceiverInternal receiver, int type,
|
||||
boolean requireConfirmation, int userId);
|
||||
boolean requireConfirmation, int userId, String opPackageName);
|
||||
// Used to hide the dialog when a biometric is authenticated
|
||||
void onBiometricAuthenticated(boolean authenticated, String failureReason);
|
||||
// Used to set a temporary message, e.g. fingerprint not recognized, finger moved too fast, etc
|
||||
|
||||
Reference in New Issue
Block a user