Merge "Only show "use fingerprint instead" if fp is ALLOWED" into udc-dev
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
@@ -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();
|
||||
@@ -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);
|
||||
@@ -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";
|
||||
@@ -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";
|
||||
@@ -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<>();
|
||||
@@ -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";
|
||||
@@ -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";
|
||||
@@ -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,
|
||||
@@ -1559,7 +1580,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
|
||||
@Test
|
||||
public void onBiometricError_faceLockedOutAgainAndFpAllowed_showsTheFpFollowupMessage() {
|
||||
createController();
|
||||
fingerprintUnlockIsPossible();
|
||||
fingerprintUnlockIsPossibleAndAllowed();
|
||||
onFaceLockoutError("first lockout");
|
||||
clearInvocations(mRotateTextViewController);
|
||||
|
||||
@@ -1668,7 +1689,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
|
||||
public void onBiometricError_screenIsTurningOn_faceLockedOutFpIsAvailable_showsMessage() {
|
||||
createController();
|
||||
screenIsTurningOn();
|
||||
fingerprintUnlockIsPossible();
|
||||
fingerprintUnlockIsPossibleAndAllowed();
|
||||
|
||||
onFaceLockoutError("lockout error");
|
||||
verifyNoMoreInteractions(mRotateTextViewController);
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user