Loading core/java/android/hardware/biometrics/BiometricPrompt.java +18 −3 Original line number Diff line number Diff line Loading @@ -122,6 +122,15 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan */ public static final int DISMISSED_REASON_CREDENTIAL_CONFIRMED = 7; /** * Dialog is done animating away after user clicked on the button set via * {@link PromptContentViewWithMoreOptionsButton.Builder#setMoreOptionsButtonListener(Executor, * DialogInterface.OnClickListener)} )}. * * @hide */ public static final int DISMISSED_REASON_CONTENT_VIEW_MORE_OPTIONS = 8; /** * @hide */ Loading @@ -131,7 +140,8 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan DISMISSED_REASON_BIOMETRIC_CONFIRM_NOT_REQUIRED, DISMISSED_REASON_ERROR, DISMISSED_REASON_SERVER_REQUESTED, DISMISSED_REASON_CREDENTIAL_CONFIRMED}) DISMISSED_REASON_CREDENTIAL_CONFIRMED, DISMISSED_REASON_CONTENT_VIEW_MORE_OPTIONS}) @Retention(RetentionPolicy.SOURCE) public @interface DismissedReason {} Loading Loading @@ -654,8 +664,6 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan private final IAuthService mService; private final PromptInfo mPromptInfo; private final ButtonInfo mNegativeButtonInfo; // TODO(b/328843028): add callback onContentViewMoreOptionsButtonClicked() in // IBiometricServiceReceiver. private final ButtonInfo mContentViewMoreOptionsButtonInfo; private CryptoObject mCryptoObject; Loading Loading @@ -745,6 +753,13 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan mNegativeButtonInfo.listener.onClick(null, DialogInterface.BUTTON_NEGATIVE); mIsPromptShowing = false; }); } else if (reason == DISMISSED_REASON_CONTENT_VIEW_MORE_OPTIONS) { if (mContentViewMoreOptionsButtonInfo != null) { mContentViewMoreOptionsButtonInfo.executor.execute(() -> { mContentViewMoreOptionsButtonInfo.listener.onClick(null, DialogInterface.BUTTON_NEGATIVE); }); } } else { mIsPromptShowing = false; Log.e(TAG, "Unknown reason: " + reason); Loading packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/AuthControllerTest.java +11 −0 Original line number Diff line number Diff line Loading @@ -444,6 +444,17 @@ public class AuthControllerTest extends SysuiTestCase { AdditionalMatchers.aryEq(credentialAttestation)); } @Test public void testSendsReasonContentViewMoreOptions_whenButtonPressed() throws Exception { showDialog(new int[]{1} /* sensorIds */, false /* credentialAllowed */); mAuthController.onDismissed(AuthDialogCallback.DISMISSED_BUTTON_CONTENT_VIEW_MORE_OPTIONS, null, /* credentialAttestation */ mAuthController.mCurrentDialog.getRequestId()); verify(mReceiver).onDialogDismissed( eq(BiometricPrompt.DISMISSED_REASON_CONTENT_VIEW_MORE_OPTIONS), eq(null) /* credentialAttestation */); } // Statusbar tests @Test Loading packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java +5 −0 Original line number Diff line number Diff line Loading @@ -217,6 +217,11 @@ public class AuthContainerView extends LinearLayout mConfig.mCallback.onTryAgainPressed(getRequestId()); } @Override public void onContentViewMoreOptionsButtonPressed() { animateAway(AuthDialogCallback.DISMISSED_BUTTON_CONTENT_VIEW_MORE_OPTIONS); } @Override public void onError() { animateAway(AuthDialogCallback.DISMISSED_ERROR); Loading packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java +8 −3 Original line number Diff line number Diff line Loading @@ -205,12 +205,12 @@ public class AuthController implements if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(intent.getAction())) { String reason = intent.getStringExtra("reason"); reason = (reason != null) ? reason : "unknown"; closeDioalog(reason); closeDialog(reason); } } }; private void closeDioalog(String reason) { private void closeDialog(String reason) { if (isShowing()) { Log.i(TAG, "Close BP, reason :" + reason); mCurrentDialog.dismissWithoutCallback(true /* animate */); Loading Loading @@ -571,6 +571,11 @@ public class AuthController implements credentialAttestation); break; case AuthDialogCallback.DISMISSED_BUTTON_CONTENT_VIEW_MORE_OPTIONS: sendResultAndCleanUp( BiometricPrompt.DISMISSED_REASON_CONTENT_VIEW_MORE_OPTIONS, credentialAttestation); break; default: Log.e(TAG, "Unhandled reason: " + reason); break; Loading @@ -579,7 +584,7 @@ public class AuthController implements @Override public void handleShowGlobalActionsMenu() { closeDioalog("PowerMenu shown"); closeDialog("PowerMenu shown"); } /** Loading packages/SystemUI/src/com/android/systemui/biometrics/AuthDialogCallback.java +3 −1 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ public interface AuthDialogCallback { int DISMISSED_ERROR = 5; int DISMISSED_BY_SYSTEM_SERVER = 6; int DISMISSED_CREDENTIAL_AUTHENTICATED = 7; int DISMISSED_BUTTON_CONTENT_VIEW_MORE_OPTIONS = 8; @IntDef({DISMISSED_USER_CANCELED, DISMISSED_BUTTON_NEGATIVE, Loading @@ -39,7 +40,8 @@ public interface AuthDialogCallback { DISMISSED_BIOMETRIC_AUTHENTICATED, DISMISSED_ERROR, DISMISSED_BY_SYSTEM_SERVER, DISMISSED_CREDENTIAL_AUTHENTICATED}) DISMISSED_CREDENTIAL_AUTHENTICATED, DISMISSED_BUTTON_CONTENT_VIEW_MORE_OPTIONS}) @interface DismissedReason {} /** Loading Loading
core/java/android/hardware/biometrics/BiometricPrompt.java +18 −3 Original line number Diff line number Diff line Loading @@ -122,6 +122,15 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan */ public static final int DISMISSED_REASON_CREDENTIAL_CONFIRMED = 7; /** * Dialog is done animating away after user clicked on the button set via * {@link PromptContentViewWithMoreOptionsButton.Builder#setMoreOptionsButtonListener(Executor, * DialogInterface.OnClickListener)} )}. * * @hide */ public static final int DISMISSED_REASON_CONTENT_VIEW_MORE_OPTIONS = 8; /** * @hide */ Loading @@ -131,7 +140,8 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan DISMISSED_REASON_BIOMETRIC_CONFIRM_NOT_REQUIRED, DISMISSED_REASON_ERROR, DISMISSED_REASON_SERVER_REQUESTED, DISMISSED_REASON_CREDENTIAL_CONFIRMED}) DISMISSED_REASON_CREDENTIAL_CONFIRMED, DISMISSED_REASON_CONTENT_VIEW_MORE_OPTIONS}) @Retention(RetentionPolicy.SOURCE) public @interface DismissedReason {} Loading Loading @@ -654,8 +664,6 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan private final IAuthService mService; private final PromptInfo mPromptInfo; private final ButtonInfo mNegativeButtonInfo; // TODO(b/328843028): add callback onContentViewMoreOptionsButtonClicked() in // IBiometricServiceReceiver. private final ButtonInfo mContentViewMoreOptionsButtonInfo; private CryptoObject mCryptoObject; Loading Loading @@ -745,6 +753,13 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan mNegativeButtonInfo.listener.onClick(null, DialogInterface.BUTTON_NEGATIVE); mIsPromptShowing = false; }); } else if (reason == DISMISSED_REASON_CONTENT_VIEW_MORE_OPTIONS) { if (mContentViewMoreOptionsButtonInfo != null) { mContentViewMoreOptionsButtonInfo.executor.execute(() -> { mContentViewMoreOptionsButtonInfo.listener.onClick(null, DialogInterface.BUTTON_NEGATIVE); }); } } else { mIsPromptShowing = false; Log.e(TAG, "Unknown reason: " + reason); Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/AuthControllerTest.java +11 −0 Original line number Diff line number Diff line Loading @@ -444,6 +444,17 @@ public class AuthControllerTest extends SysuiTestCase { AdditionalMatchers.aryEq(credentialAttestation)); } @Test public void testSendsReasonContentViewMoreOptions_whenButtonPressed() throws Exception { showDialog(new int[]{1} /* sensorIds */, false /* credentialAllowed */); mAuthController.onDismissed(AuthDialogCallback.DISMISSED_BUTTON_CONTENT_VIEW_MORE_OPTIONS, null, /* credentialAttestation */ mAuthController.mCurrentDialog.getRequestId()); verify(mReceiver).onDialogDismissed( eq(BiometricPrompt.DISMISSED_REASON_CONTENT_VIEW_MORE_OPTIONS), eq(null) /* credentialAttestation */); } // Statusbar tests @Test Loading
packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java +5 −0 Original line number Diff line number Diff line Loading @@ -217,6 +217,11 @@ public class AuthContainerView extends LinearLayout mConfig.mCallback.onTryAgainPressed(getRequestId()); } @Override public void onContentViewMoreOptionsButtonPressed() { animateAway(AuthDialogCallback.DISMISSED_BUTTON_CONTENT_VIEW_MORE_OPTIONS); } @Override public void onError() { animateAway(AuthDialogCallback.DISMISSED_ERROR); Loading
packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java +8 −3 Original line number Diff line number Diff line Loading @@ -205,12 +205,12 @@ public class AuthController implements if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(intent.getAction())) { String reason = intent.getStringExtra("reason"); reason = (reason != null) ? reason : "unknown"; closeDioalog(reason); closeDialog(reason); } } }; private void closeDioalog(String reason) { private void closeDialog(String reason) { if (isShowing()) { Log.i(TAG, "Close BP, reason :" + reason); mCurrentDialog.dismissWithoutCallback(true /* animate */); Loading Loading @@ -571,6 +571,11 @@ public class AuthController implements credentialAttestation); break; case AuthDialogCallback.DISMISSED_BUTTON_CONTENT_VIEW_MORE_OPTIONS: sendResultAndCleanUp( BiometricPrompt.DISMISSED_REASON_CONTENT_VIEW_MORE_OPTIONS, credentialAttestation); break; default: Log.e(TAG, "Unhandled reason: " + reason); break; Loading @@ -579,7 +584,7 @@ public class AuthController implements @Override public void handleShowGlobalActionsMenu() { closeDioalog("PowerMenu shown"); closeDialog("PowerMenu shown"); } /** Loading
packages/SystemUI/src/com/android/systemui/biometrics/AuthDialogCallback.java +3 −1 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ public interface AuthDialogCallback { int DISMISSED_ERROR = 5; int DISMISSED_BY_SYSTEM_SERVER = 6; int DISMISSED_CREDENTIAL_AUTHENTICATED = 7; int DISMISSED_BUTTON_CONTENT_VIEW_MORE_OPTIONS = 8; @IntDef({DISMISSED_USER_CANCELED, DISMISSED_BUTTON_NEGATIVE, Loading @@ -39,7 +40,8 @@ public interface AuthDialogCallback { DISMISSED_BIOMETRIC_AUTHENTICATED, DISMISSED_ERROR, DISMISSED_BY_SYSTEM_SERVER, DISMISSED_CREDENTIAL_AUTHENTICATED}) DISMISSED_CREDENTIAL_AUTHENTICATED, DISMISSED_BUTTON_CONTENT_VIEW_MORE_OPTIONS}) @interface DismissedReason {} /** Loading