Loading packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +1 −1 Original line number Diff line number Diff line Loading @@ -1423,7 +1423,7 @@ public class KeyguardIndicationController { private boolean canUnlockWithFingerprint() { return mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible( getCurrentUser()); getCurrentUser()) && mKeyguardUpdateMonitor.isUnlockingWithFingerprintAllowed(); } private void showErrorMessageNowOrLater(String errString, @Nullable String followUpMsg) { Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +49 −27 Original line number Diff line number Diff line Loading @@ -614,9 +614,8 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { public void onBiometricHelp_coEx_faceFailure() { createController(); // GIVEN unlocking with fingerprint is possible when(mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible(anyInt())) .thenReturn(true); // GIVEN unlocking with fingerprint is possible and allowed fingerprintUnlockIsPossibleAndAllowed(); String message = "A message"; mController.setVisible(true); Loading @@ -641,9 +640,8 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { public void onBiometricHelp_coEx_faceUnavailable() { createController(); // GIVEN unlocking with fingerprint is possible when(mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible(anyInt())) .thenReturn(true); // GIVEN unlocking with fingerprint is possible and allowed fingerprintUnlockIsPossibleAndAllowed(); String message = "A message"; mController.setVisible(true); Loading @@ -664,6 +662,35 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { mContext.getString(R.string.keyguard_suggest_fingerprint)); } @Test public void onBiometricHelp_coEx_faceUnavailable_fpNotAllowed() { createController(); // GIVEN unlocking with fingerprint is possible but not allowed setupFingerprintUnlockPossible(true); when(mKeyguardUpdateMonitor.isUnlockingWithFingerprintAllowed()) .thenReturn(false); String message = "A message"; mController.setVisible(true); // WHEN there's a face unavailable message mController.getKeyguardCallback().onBiometricHelp( BIOMETRIC_HELP_FACE_NOT_AVAILABLE, message, BiometricSourceType.FACE); // THEN show sequential messages such as: 'face unlock unavailable' and // 'try fingerprint instead' verifyIndicationMessage( INDICATION_TYPE_BIOMETRIC_MESSAGE, message); verifyIndicationMessage( INDICATION_TYPE_BIOMETRIC_MESSAGE_FOLLOW_UP, mContext.getString(R.string.keyguard_unlock)); } @Test public void onBiometricHelp_coEx_fpFailure_faceAlreadyUnlocked() { createController(); Loading Loading @@ -818,8 +845,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { @Test public void faceErrorTimeout_whenFingerprintEnrolled_doesNotShowMessage() { createController(); when(mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible( getCurrentUser())).thenReturn(true); fingerprintUnlockIsPossibleAndAllowed(); String message = "A message"; mController.setVisible(true); Loading @@ -832,9 +858,8 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { public void sendFaceHelpMessages_fingerprintEnrolled() { createController(); // GIVEN fingerprint enrolled when(mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible( getCurrentUser())).thenReturn(true); // GIVEN unlocking with fingerprint is possible and allowed fingerprintUnlockIsPossibleAndAllowed(); // WHEN help messages received that are allowed to show final String helpString = "helpString"; Loading @@ -859,9 +884,8 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { public void doNotSendMostFaceHelpMessages_fingerprintEnrolled() { createController(); // GIVEN fingerprint enrolled when(mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible( getCurrentUser())).thenReturn(true); // GIVEN unlocking with fingerprint is possible and allowed fingerprintUnlockIsPossibleAndAllowed(); // WHEN help messages received that aren't supposed to show final String helpString = "helpString"; Loading @@ -886,9 +910,8 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { public void sendAllFaceHelpMessages_fingerprintNotEnrolled() { createController(); // GIVEN fingerprint NOT enrolled when(mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible( getCurrentUser())).thenReturn(false); // GIVEN fingerprint NOT possible fingerprintUnlockIsNotPossible(); // WHEN help messages received final Set<CharSequence> helpStrings = new HashSet<>(); Loading Loading @@ -917,9 +940,8 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { public void sendTooDarkFaceHelpMessages_onTimeout_noFpEnrolled() { createController(); // GIVEN fingerprint NOT enrolled when(mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible( getCurrentUser())).thenReturn(false); // GIVEN fingerprint not possible fingerprintUnlockIsNotPossible(); // WHEN help message received and deferred message is valid final String helpString = "helpMsg"; Loading Loading @@ -948,9 +970,8 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { public void sendTooDarkFaceHelpMessages_onTimeout_fingerprintEnrolled() { createController(); // GIVEN fingerprint enrolled when(mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible( getCurrentUser())).thenReturn(true); // GIVEN unlocking with fingerprint is possible and allowed fingerprintUnlockIsPossibleAndAllowed(); // WHEN help message received and deferredMessage is valid final String helpString = "helpMsg"; Loading Loading @@ -1500,7 +1521,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { @Test public void onBiometricError_faceLockedOutFirstTimeAndFpAllowed_showsTheFpFollowupMessage() { createController(); fingerprintUnlockIsPossible(); fingerprintUnlockIsPossibleAndAllowed(); onFaceLockoutError("first lockout"); verifyIndicationShown(INDICATION_TYPE_BIOMETRIC_MESSAGE_FOLLOW_UP, Loading Loading @@ -1559,7 +1580,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { @Test public void onBiometricError_faceLockedOutAgainAndFpAllowed_showsTheFpFollowupMessage() { createController(); fingerprintUnlockIsPossible(); fingerprintUnlockIsPossibleAndAllowed(); onFaceLockoutError("first lockout"); clearInvocations(mRotateTextViewController); Loading Loading @@ -1668,7 +1689,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { public void onBiometricError_screenIsTurningOn_faceLockedOutFpIsAvailable_showsMessage() { createController(); screenIsTurningOn(); fingerprintUnlockIsPossible(); fingerprintUnlockIsPossibleAndAllowed(); onFaceLockoutError("lockout error"); verifyNoMoreInteractions(mRotateTextViewController); Loading Loading @@ -1746,8 +1767,9 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { setupFingerprintUnlockPossible(false); } private void fingerprintUnlockIsPossible() { private void fingerprintUnlockIsPossibleAndAllowed() { setupFingerprintUnlockPossible(true); when(mKeyguardUpdateMonitor.isUnlockingWithFingerprintAllowed()).thenReturn(true); } private void setupFingerprintUnlockPossible(boolean possible) { Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +1 −1 Original line number Diff line number Diff line Loading @@ -1423,7 +1423,7 @@ public class KeyguardIndicationController { private boolean canUnlockWithFingerprint() { return mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible( getCurrentUser()); getCurrentUser()) && mKeyguardUpdateMonitor.isUnlockingWithFingerprintAllowed(); } private void showErrorMessageNowOrLater(String errString, @Nullable String followUpMsg) { Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +49 −27 Original line number Diff line number Diff line Loading @@ -614,9 +614,8 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { public void onBiometricHelp_coEx_faceFailure() { createController(); // GIVEN unlocking with fingerprint is possible when(mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible(anyInt())) .thenReturn(true); // GIVEN unlocking with fingerprint is possible and allowed fingerprintUnlockIsPossibleAndAllowed(); String message = "A message"; mController.setVisible(true); Loading @@ -641,9 +640,8 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { public void onBiometricHelp_coEx_faceUnavailable() { createController(); // GIVEN unlocking with fingerprint is possible when(mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible(anyInt())) .thenReturn(true); // GIVEN unlocking with fingerprint is possible and allowed fingerprintUnlockIsPossibleAndAllowed(); String message = "A message"; mController.setVisible(true); Loading @@ -664,6 +662,35 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { mContext.getString(R.string.keyguard_suggest_fingerprint)); } @Test public void onBiometricHelp_coEx_faceUnavailable_fpNotAllowed() { createController(); // GIVEN unlocking with fingerprint is possible but not allowed setupFingerprintUnlockPossible(true); when(mKeyguardUpdateMonitor.isUnlockingWithFingerprintAllowed()) .thenReturn(false); String message = "A message"; mController.setVisible(true); // WHEN there's a face unavailable message mController.getKeyguardCallback().onBiometricHelp( BIOMETRIC_HELP_FACE_NOT_AVAILABLE, message, BiometricSourceType.FACE); // THEN show sequential messages such as: 'face unlock unavailable' and // 'try fingerprint instead' verifyIndicationMessage( INDICATION_TYPE_BIOMETRIC_MESSAGE, message); verifyIndicationMessage( INDICATION_TYPE_BIOMETRIC_MESSAGE_FOLLOW_UP, mContext.getString(R.string.keyguard_unlock)); } @Test public void onBiometricHelp_coEx_fpFailure_faceAlreadyUnlocked() { createController(); Loading Loading @@ -818,8 +845,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { @Test public void faceErrorTimeout_whenFingerprintEnrolled_doesNotShowMessage() { createController(); when(mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible( getCurrentUser())).thenReturn(true); fingerprintUnlockIsPossibleAndAllowed(); String message = "A message"; mController.setVisible(true); Loading @@ -832,9 +858,8 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { public void sendFaceHelpMessages_fingerprintEnrolled() { createController(); // GIVEN fingerprint enrolled when(mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible( getCurrentUser())).thenReturn(true); // GIVEN unlocking with fingerprint is possible and allowed fingerprintUnlockIsPossibleAndAllowed(); // WHEN help messages received that are allowed to show final String helpString = "helpString"; Loading @@ -859,9 +884,8 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { public void doNotSendMostFaceHelpMessages_fingerprintEnrolled() { createController(); // GIVEN fingerprint enrolled when(mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible( getCurrentUser())).thenReturn(true); // GIVEN unlocking with fingerprint is possible and allowed fingerprintUnlockIsPossibleAndAllowed(); // WHEN help messages received that aren't supposed to show final String helpString = "helpString"; Loading @@ -886,9 +910,8 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { public void sendAllFaceHelpMessages_fingerprintNotEnrolled() { createController(); // GIVEN fingerprint NOT enrolled when(mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible( getCurrentUser())).thenReturn(false); // GIVEN fingerprint NOT possible fingerprintUnlockIsNotPossible(); // WHEN help messages received final Set<CharSequence> helpStrings = new HashSet<>(); Loading Loading @@ -917,9 +940,8 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { public void sendTooDarkFaceHelpMessages_onTimeout_noFpEnrolled() { createController(); // GIVEN fingerprint NOT enrolled when(mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible( getCurrentUser())).thenReturn(false); // GIVEN fingerprint not possible fingerprintUnlockIsNotPossible(); // WHEN help message received and deferred message is valid final String helpString = "helpMsg"; Loading Loading @@ -948,9 +970,8 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { public void sendTooDarkFaceHelpMessages_onTimeout_fingerprintEnrolled() { createController(); // GIVEN fingerprint enrolled when(mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible( getCurrentUser())).thenReturn(true); // GIVEN unlocking with fingerprint is possible and allowed fingerprintUnlockIsPossibleAndAllowed(); // WHEN help message received and deferredMessage is valid final String helpString = "helpMsg"; Loading Loading @@ -1500,7 +1521,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { @Test public void onBiometricError_faceLockedOutFirstTimeAndFpAllowed_showsTheFpFollowupMessage() { createController(); fingerprintUnlockIsPossible(); fingerprintUnlockIsPossibleAndAllowed(); onFaceLockoutError("first lockout"); verifyIndicationShown(INDICATION_TYPE_BIOMETRIC_MESSAGE_FOLLOW_UP, Loading Loading @@ -1559,7 +1580,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { @Test public void onBiometricError_faceLockedOutAgainAndFpAllowed_showsTheFpFollowupMessage() { createController(); fingerprintUnlockIsPossible(); fingerprintUnlockIsPossibleAndAllowed(); onFaceLockoutError("first lockout"); clearInvocations(mRotateTextViewController); Loading Loading @@ -1668,7 +1689,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { public void onBiometricError_screenIsTurningOn_faceLockedOutFpIsAvailable_showsMessage() { createController(); screenIsTurningOn(); fingerprintUnlockIsPossible(); fingerprintUnlockIsPossibleAndAllowed(); onFaceLockoutError("lockout error"); verifyNoMoreInteractions(mRotateTextViewController); Loading Loading @@ -1746,8 +1767,9 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { setupFingerprintUnlockPossible(false); } private void fingerprintUnlockIsPossible() { private void fingerprintUnlockIsPossibleAndAllowed() { setupFingerprintUnlockPossible(true); when(mKeyguardUpdateMonitor.isUnlockingWithFingerprintAllowed()).thenReturn(true); } private void setupFingerprintUnlockPossible(boolean possible) { Loading