diff --git a/res/values/strings.xml b/res/values/strings.xml
index f72ddabb2bc..2dfd64345c3 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -818,6 +818,10 @@
You can unlock with your watch when your fingerprint isn\u2019t recognized.
You can unlock with your watch when your face isn\u2019t recognized.
+ Use fingerprint or watch to
+ Use face or watch to
+ Use face, fingerprint, or watch to
+ Use watch to
Using face or watch
diff --git a/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtils.java b/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtils.java
index 4ff2b87dd33..8f9da54b610 100644
--- a/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtils.java
+++ b/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtils.java
@@ -268,6 +268,30 @@ public class ActiveUnlockStatusUtils {
}
}
+ /**
+ * Returns the preference title of how to use biometrics when active unlock is enabled.
+ */
+ public String getUseBiometricTitleForActiveUnlock() {
+ final boolean faceAllowed = Utils.hasFaceHardware(mContext);
+ final boolean fingerprintAllowed = Utils.hasFingerprintHardware(mContext);
+
+ return mContext.getString(getUseBiometricTitleRes(faceAllowed, fingerprintAllowed));
+ }
+
+ @StringRes
+ private static int getUseBiometricTitleRes(
+ boolean isFaceAllowed, boolean isFingerprintAllowed) {
+ if (isFaceAllowed && isFingerprintAllowed) {
+ return R.string.biometric_settings_use_face_fingerprint_or_watch_for;
+ } else if (isFaceAllowed) {
+ return R.string.biometric_settings_use_face_or_watch_for;
+ } else if (isFingerprintAllowed) {
+ return R.string.biometric_settings_use_fingerprint_or_watch_for;
+ } else {
+ return R.string.biometric_settings_use_watch_for;
+ }
+ }
+
private static String getFlagState() {
return DeviceConfig.getProperty(DeviceConfig.NAMESPACE_REMOTE_AUTH, CONFIG_FLAG_NAME);
}
diff --git a/src/com/android/settings/biometrics/combination/CombinedBiometricSettings.java b/src/com/android/settings/biometrics/combination/CombinedBiometricSettings.java
index d0e986f175a..671a5b659fc 100644
--- a/src/com/android/settings/biometrics/combination/CombinedBiometricSettings.java
+++ b/src/com/android/settings/biometrics/combination/CombinedBiometricSettings.java
@@ -46,6 +46,7 @@ public class CombinedBiometricSettings extends BiometricsSettingsBase {
private static final String KEY_UNLOCK_PHONE = "biometric_settings_biometric_keyguard";
private static final String KEY_USE_IN_APPS = "biometric_settings_biometric_app";
private static final String KEY_INTRO_PREFERENCE = "biometric_intro";
+ private static final String KEY_USE_BIOMETRIC_PREFERENCE = "biometric_ways_to_use";
private ActiveUnlockStatusUtils mActiveUnlockStatusUtils;
private CombinedBiometricStatusUtils mCombinedBiometricStatusUtils;
@@ -83,6 +84,11 @@ public class CombinedBiometricSettings extends BiometricsSettingsBase {
if (introPreference != null) {
introPreference.setTitle(mActiveUnlockStatusUtils.getIntroForActiveUnlock());
}
+ final Preference useBiometricPreference = findPreference(KEY_USE_BIOMETRIC_PREFERENCE);
+ if (useBiometricPreference != null) {
+ useBiometricPreference.setTitle(
+ mActiveUnlockStatusUtils.getUseBiometricTitleForActiveUnlock());
+ }
getActivity().setTitle(mActiveUnlockStatusUtils.getTitleForActiveUnlock());
}
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 d420f78ac0e..e5eac12c626 100644
--- a/tests/robotests/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtilsTest.java
+++ b/tests/robotests/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtilsTest.java
@@ -222,4 +222,44 @@ public class ActiveUnlockStatusUtilsTest {
.isEqualTo(mApplicationContext.getString(
R.string.biometric_settings_use_face_or_watch_preference_summary));
}
+
+ @Test
+ public void getUseBiometricTitle_faceAndFingerprintEnabled_returnsFaceFingerprintOrWatch() {
+ when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
+ when(mFaceManager.isHardwareDetected()).thenReturn(true);
+
+ assertThat(mActiveUnlockStatusUtils.getUseBiometricTitleForActiveUnlock())
+ .isEqualTo(mApplicationContext.getString(
+ R.string.biometric_settings_use_face_fingerprint_or_watch_for));
+ }
+
+ @Test
+ public void getUseBiometricTitle_fingerprintEnabled_returnsFingerprintOrWatch() {
+ when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
+ when(mFaceManager.isHardwareDetected()).thenReturn(false);
+
+ assertThat(mActiveUnlockStatusUtils.getUseBiometricTitleForActiveUnlock())
+ .isEqualTo(mApplicationContext.getString(
+ R.string.biometric_settings_use_fingerprint_or_watch_for));
+ }
+
+ @Test
+ public void getUseBiometricTitle_faceEnabled_returnsFaceOrWatch() {
+ when(mFingerprintManager.isHardwareDetected()).thenReturn(false);
+ when(mFaceManager.isHardwareDetected()).thenReturn(true);
+
+ assertThat(mActiveUnlockStatusUtils.getUseBiometricTitleForActiveUnlock())
+ .isEqualTo(mApplicationContext.getString(
+ R.string.biometric_settings_use_face_or_watch_for));
+ }
+
+ @Test
+ public void getUseBiometricTitle_withoutFaceOrFingerprint_returnsWatch() {
+ when(mFingerprintManager.isHardwareDetected()).thenReturn(false);
+ when(mFaceManager.isHardwareDetected()).thenReturn(false);
+
+ assertThat(mActiveUnlockStatusUtils.getUseBiometricTitleForActiveUnlock())
+ .isEqualTo(mApplicationContext.getString(
+ R.string.biometric_settings_use_watch_for));
+ }
}