diff --git a/res/values/strings.xml b/res/values/strings.xml index 8dca8d0e2af..e795535b826 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -881,11 +881,11 @@ Watch Unlock - When you set up Face Unlock and Fingerprint Unlock, your phone will ask for your fingerprint when you wear a mask or are in a dark area.\n\nYou can unlock with your watch when your face or fingerprint isn\u2019t recognized. + When you set up Face Unlock and Fingerprint Unlock, your phone will ask for your fingerprint when you wear a mask or are in a dark area.\n\nWatch Unlock is another convenient way to unlock your phone, for example, when your fingers are wet or face isn\u2019t recognized. - You can unlock with your watch when your fingerprint isn\u2019t recognized. + Watch Unlock is another convenient way to unlock your phone, for example, when your fingerprint isn\u2019t recognized. - You can unlock with your watch when your face isn\u2019t recognized. + Watch Unlock is another convenient way to unlock your phone, for example, when your face isn\u2019t recognized. Use fingerprint or watch to Use face or watch to Use face, fingerprint, or watch to diff --git a/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtils.java b/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtils.java index 4d925986081..2eee9df64f4 100644 --- a/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtils.java +++ b/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtils.java @@ -191,13 +191,10 @@ public class ActiveUnlockStatusUtils { public String getIntroForActiveUnlock() { final boolean faceAllowed = Utils.hasFaceHardware(mContext); final boolean fingerprintAllowed = Utils.hasFingerprintHardware(mContext); - if (useBiometricFailureLayout()) { + if (isAvailable()) { int introRes = getIntroRes(faceAllowed, fingerprintAllowed); return introRes == 0 ? "" : mContext.getString(introRes); } - if (useUnlockIntentLayout() && (!faceAllowed || !fingerprintAllowed)) { - return ""; - } return mContext.getString(R.string.biometric_settings_intro); } diff --git a/tests/robotests/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtilsTest.java b/tests/robotests/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtilsTest.java index df83eae63df..563974d5287 100644 --- a/tests/robotests/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtilsTest.java +++ b/tests/robotests/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtilsTest.java @@ -149,17 +149,31 @@ public class ActiveUnlockStatusUtilsTest { } @Test - public void getIntro_unlockOnIntentAndFaceEnabled_returnsEmpty() { + public void getIntro_faceEnabled_returnsFace() { + ActiveUnlockTestUtils.enable( + mApplicationContext, ActiveUnlockStatusUtils.UNLOCK_INTENT_LAYOUT); + when(mFingerprintManager.isHardwareDetected()).thenReturn(false); + when(mFaceManager.isHardwareDetected()).thenReturn(true); + + assertThat(mActiveUnlockStatusUtils.getIntroForActiveUnlock()) + .isEqualTo(mApplicationContext.getString( + R.string.biometric_settings_intro_with_face)); + } + + @Test + public void getIntro_fingerprintEnabled_returnsFingerprint() { ActiveUnlockTestUtils.enable( mApplicationContext, ActiveUnlockStatusUtils.UNLOCK_INTENT_LAYOUT); when(mFingerprintManager.isHardwareDetected()).thenReturn(true); when(mFaceManager.isHardwareDetected()).thenReturn(false); - assertThat(mActiveUnlockStatusUtils.getIntroForActiveUnlock()).isEqualTo(""); + assertThat(mActiveUnlockStatusUtils.getIntroForActiveUnlock()) + .isEqualTo(mApplicationContext.getString( + R.string.biometric_settings_intro_with_fingerprint)); } @Test - public void getIntro_unlockOnIntentAndFaceAndFingerprintEnabled_returnsDefault() { + public void getIntro_faceAndFingerprintEnabled_returnsFaceAndFingerprint() { ActiveUnlockTestUtils.enable( mApplicationContext, ActiveUnlockStatusUtils.UNLOCK_INTENT_LAYOUT); when(mFingerprintManager.isHardwareDetected()).thenReturn(true); @@ -167,7 +181,7 @@ public class ActiveUnlockStatusUtilsTest { assertThat(mActiveUnlockStatusUtils.getIntroForActiveUnlock()) .isEqualTo(mApplicationContext.getString( - R.string.biometric_settings_intro)); + R.string.biometric_settings_intro_with_activeunlock)); } @Test