Loading packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java +14 −3 Original line number Diff line number Diff line Loading @@ -93,10 +93,13 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks, Log.w(TAG, "Evicting client due to: " + topPackage); mCurrentDialog.dismissWithoutCallback(true /* animate */); mCurrentDialog = null; mReceiver.onDialogDismissed(BiometricPrompt.DISMISSED_REASON_USER_CANCEL); if (mReceiver != null) { mReceiver.onDialogDismissed( BiometricPrompt.DISMISSED_REASON_USER_CANCEL); mReceiver = null; } } } } catch (RemoteException e) { Log.e(TAG, "Remote exception", e); } Loading @@ -105,6 +108,10 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks, @Override public void onTryAgainPressed() { if (mReceiver == null) { Log.e(TAG, "onTryAgainPressed: Receiver is null"); return; } try { mReceiver.onTryAgainPressed(); } catch (RemoteException e) { Loading @@ -114,6 +121,10 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks, @Override public void onDeviceCredentialPressed() { if (mReceiver == null) { Log.e(TAG, "onDeviceCredentialPressed: Receiver is null"); return; } try { mReceiver.onDeviceCredentialPressed(); } catch (RemoteException e) { Loading Loading @@ -161,7 +172,7 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks, private void sendResultAndCleanUp(@DismissedReason int reason) { if (mReceiver == null) { Log.e(TAG, "Receiver is null"); Log.e(TAG, "sendResultAndCleanUp: Receiver is null"); return; } try { Loading packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -389,6 +389,20 @@ public class AuthControllerTest extends SysuiTestCase { verify(mReceiver).onDialogDismissed(eq(BiometricPrompt.DISMISSED_REASON_USER_CANCEL)); } @Test public void testDoesNotCrash_whenTryAgainPressedAfterDismissal() { showDialog(Authenticator.TYPE_BIOMETRIC, BiometricPrompt.TYPE_FACE); mAuthController.onDismissed(AuthDialogCallback.DISMISSED_USER_CANCELED); mAuthController.onTryAgainPressed(); } @Test public void testDoesNotCrash_whenDeviceCredentialPressedAfterDismissal() { showDialog(Authenticator.TYPE_BIOMETRIC, BiometricPrompt.TYPE_FACE); mAuthController.onDismissed(AuthDialogCallback.DISMISSED_USER_CANCELED); mAuthController.onDeviceCredentialPressed(); } // Helpers private void showDialog(int authenticators, int biometricModality) { Loading Loading
packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java +14 −3 Original line number Diff line number Diff line Loading @@ -93,10 +93,13 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks, Log.w(TAG, "Evicting client due to: " + topPackage); mCurrentDialog.dismissWithoutCallback(true /* animate */); mCurrentDialog = null; mReceiver.onDialogDismissed(BiometricPrompt.DISMISSED_REASON_USER_CANCEL); if (mReceiver != null) { mReceiver.onDialogDismissed( BiometricPrompt.DISMISSED_REASON_USER_CANCEL); mReceiver = null; } } } } catch (RemoteException e) { Log.e(TAG, "Remote exception", e); } Loading @@ -105,6 +108,10 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks, @Override public void onTryAgainPressed() { if (mReceiver == null) { Log.e(TAG, "onTryAgainPressed: Receiver is null"); return; } try { mReceiver.onTryAgainPressed(); } catch (RemoteException e) { Loading @@ -114,6 +121,10 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks, @Override public void onDeviceCredentialPressed() { if (mReceiver == null) { Log.e(TAG, "onDeviceCredentialPressed: Receiver is null"); return; } try { mReceiver.onDeviceCredentialPressed(); } catch (RemoteException e) { Loading Loading @@ -161,7 +172,7 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks, private void sendResultAndCleanUp(@DismissedReason int reason) { if (mReceiver == null) { Log.e(TAG, "Receiver is null"); Log.e(TAG, "sendResultAndCleanUp: Receiver is null"); return; } try { Loading
packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -389,6 +389,20 @@ public class AuthControllerTest extends SysuiTestCase { verify(mReceiver).onDialogDismissed(eq(BiometricPrompt.DISMISSED_REASON_USER_CANCEL)); } @Test public void testDoesNotCrash_whenTryAgainPressedAfterDismissal() { showDialog(Authenticator.TYPE_BIOMETRIC, BiometricPrompt.TYPE_FACE); mAuthController.onDismissed(AuthDialogCallback.DISMISSED_USER_CANCELED); mAuthController.onTryAgainPressed(); } @Test public void testDoesNotCrash_whenDeviceCredentialPressedAfterDismissal() { showDialog(Authenticator.TYPE_BIOMETRIC, BiometricPrompt.TYPE_FACE); mAuthController.onDismissed(AuthDialogCallback.DISMISSED_USER_CANCELED); mAuthController.onDeviceCredentialPressed(); } // Helpers private void showDialog(int authenticators, int biometricModality) { Loading