Merge "Update strings for Watch Unlock" into main

This commit is contained in:
Derek Jedral
2023-11-30 05:23:33 +00:00
committed by Android (Google) Code Review
3 changed files with 22 additions and 11 deletions

View File

@@ -881,11 +881,11 @@
<!-- Title shown for menu item that launches watch unlock settings. [CHAR LIMIT=40] -->
<string name ="security_settings_activeunlock_preference_title">Watch Unlock</string>
<!-- Introduction shown in face and fingerprint page to introduce the biometric feature. [CHAR LIMIT=NONE]-->
<string name="biometric_settings_intro_with_activeunlock">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.</string>
<string name="biometric_settings_intro_with_activeunlock">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.</string>
<!-- Introduction shown in fingerprint page to explain that watch unlock can be used if fingerprint isn't recognized. [CHAR LIMIT=NONE]-->
<string name="biometric_settings_intro_with_fingerprint">You can unlock with your watch when your fingerprint isn\u2019t recognized.</string>
<string name="biometric_settings_intro_with_fingerprint">Watch Unlock is another convenient way to unlock your phone, for example, when your fingerprint isn\u2019t recognized.</string>
<!-- Introduction shown in face page to explain that watch unlock can be used if face isn't recognized. [CHAR LIMIT=NONE]-->
<string name="biometric_settings_intro_with_face">You can unlock with your watch when your face isn\u2019t recognized.</string>
<string name="biometric_settings_intro_with_face">Watch Unlock is another convenient way to unlock your phone, for example, when your face isn\u2019t recognized.</string>
<string name="biometric_settings_use_fingerprint_or_watch_for"> Use fingerprint or watch to</string>
<string name="biometric_settings_use_face_or_watch_for"> Use face or watch to</string>
<string name="biometric_settings_use_face_fingerprint_or_watch_for"> Use face, fingerprint, or watch to</string>

View File

@@ -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);
}

View File

@@ -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