Update strings for summary in device unlock page
Bug: 370940762 Test: atest FaceStatusUtilsTest FingerprintStatusUtilsTest ScreenLockPreferenceDetailsUtilsTest FaceSafetySourceTest FingerprintSafetySourceTest FaceStatusPreferenceControllerTest FingerprintStatusPreferenceControllerTest Flag: com.android.settings.flags.biometrics_onboarding_education Change-Id: I0927529e939a8e16ddf6692adc8ad427bdbe1bca
This commit is contained in:
@@ -830,6 +830,8 @@
|
||||
<string name="security_settings_face_preference_summary">Face added</string>
|
||||
<!-- Message shown in summary field when Face Unlock is not set up. [CHAR LIMIT=54] -->
|
||||
<string name="security_settings_face_preference_summary_none">Setup needed</string>
|
||||
<!-- Message shown in summary field when Face Unlock is not set up. [CHAR LIMIT=54] -->
|
||||
<string name="security_settings_face_preference_summary_none_new">Add face</string>
|
||||
<!-- Title shown for menu item that launches face settings or enrollment. [CHAR LIMIT=32] -->
|
||||
<string name="security_settings_face_preference_title_new">Face</string>
|
||||
<!-- Title shown for menu item that launches face settings or enrollment, for work profile. [CHAR LIMIT=50] -->
|
||||
@@ -1003,6 +1005,8 @@
|
||||
}</string>
|
||||
<!-- message shown in summary field when no fingerprints are registered -->
|
||||
<string name="security_settings_fingerprint_preference_summary_none">Setup needed</string>
|
||||
<!-- message shown in summary field when no fingerprints are registered -->
|
||||
<string name="security_settings_fingerprint_preference_summary_none_new">Add fingerprint</string>
|
||||
<!-- Introduction title shown in fingerprint enrollment to introduce the fingerprint feature [CHAR LIMIT=29] -->
|
||||
<string name="security_settings_fingerprint_enroll_introduction_title">Set up your fingerprint</string>
|
||||
<!-- Introduction title shown in fingerprint enrollment when asking for parental consent for fingerprint unlock [CHAR LIMIT=29] -->
|
||||
@@ -1767,6 +1771,8 @@
|
||||
|
||||
<!-- Summary for "Configure lockscreen" when lock screen is off [CHAR LIMIT=45] -->
|
||||
<string name="unlock_set_unlock_mode_off">None</string>
|
||||
<!-- Summary for "Configure lockscreen" when lock screen is off [CHAR LIMIT=45] -->
|
||||
<string name="unlock_set_unlock_mode_off_new">Add PIN, pattern, password, or swipe</string>
|
||||
<!-- Summary for "Configure lockscreen" when security is disabled [CHAR LIMIT=45] -->
|
||||
<string name="unlock_set_unlock_mode_none">Swipe</string>
|
||||
<!-- Summary for "Configure lockscreen" when security pattern is enabled [CHAR LIMIT=45] -->
|
||||
|
@@ -98,11 +98,14 @@ public class FaceStatusUtils {
|
||||
return mContext.getString(
|
||||
com.android.settingslib.widget.restricted.R.string.disabled_by_admin);
|
||||
} else {
|
||||
int summaryNoneResId = Flags.biometricsOnboardingEducation()
|
||||
? R.string.security_settings_face_preference_summary_none_new
|
||||
: R.string.security_settings_face_preference_summary_none;
|
||||
return mContext.getResources()
|
||||
.getString(
|
||||
hasEnrolled()
|
||||
? R.string.security_settings_face_preference_summary
|
||||
: R.string.security_settings_face_preference_summary_none);
|
||||
: summaryNoneResId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -108,7 +108,9 @@ public class FingerprintStatusUtils {
|
||||
R.string.security_settings_fingerprint_preference_summary);
|
||||
} else {
|
||||
return mContext.getString(
|
||||
R.string.security_settings_fingerprint_preference_summary_none);
|
||||
Flags.biometricsOnboardingEducation()
|
||||
? R.string.security_settings_fingerprint_preference_summary_none_new
|
||||
: R.string.security_settings_fingerprint_preference_summary_none);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -178,7 +178,9 @@ public class ScreenLockPreferenceDetailsUtils {
|
||||
if (!mLockPatternUtils.isSecure(userId)) {
|
||||
if (userId == mProfileChallengeUserId
|
||||
|| mLockPatternUtils.isLockScreenDisabled(userId)) {
|
||||
return R.string.unlock_set_unlock_mode_off;
|
||||
return com.android.settings.flags.Flags.biometricsOnboardingEducation()
|
||||
? R.string.unlock_set_unlock_mode_off_new
|
||||
: R.string.unlock_set_unlock_mode_off;
|
||||
} else {
|
||||
return R.string.unlock_set_unlock_mode_none;
|
||||
}
|
||||
|
@@ -36,6 +36,9 @@ import android.content.pm.PackageManager;
|
||||
import android.hardware.face.Face;
|
||||
import android.hardware.face.FaceManager;
|
||||
import android.os.UserManager;
|
||||
import android.platform.test.annotations.DisableFlags;
|
||||
import android.platform.test.annotations.EnableFlags;
|
||||
import android.platform.test.flag.junit.SetFlagsRule;
|
||||
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.preference.Preference;
|
||||
@@ -50,6 +53,7 @@ import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
@@ -67,6 +71,8 @@ public class FaceStatusPreferenceControllerTest {
|
||||
|
||||
private static final String TEST_PREF_KEY = "baz";
|
||||
|
||||
@Rule
|
||||
public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
|
||||
@Mock
|
||||
private LockPatternUtils mLockPatternUtils;
|
||||
@Mock
|
||||
@@ -125,7 +131,8 @@ public class FaceStatusPreferenceControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_noFace_shouldShowDefaultSummary() {
|
||||
@DisableFlags(com.android.settings.flags.Flags.FLAG_BIOMETRICS_ONBOARDING_EDUCATION)
|
||||
public void updateState_noFace_flagOff_shouldShowDefaultSummary() {
|
||||
when(mFaceManager.isHardwareDetected()).thenReturn(true);
|
||||
|
||||
mController.updateState(mPreference);
|
||||
@@ -135,6 +142,18 @@ public class FaceStatusPreferenceControllerTest {
|
||||
assertThat(mPreference.isVisible()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnableFlags(com.android.settings.flags.Flags.FLAG_BIOMETRICS_ONBOARDING_EDUCATION)
|
||||
public void updateState_noFace_flagOn_shouldShowDefaultSummary() {
|
||||
when(mFaceManager.isHardwareDetected()).thenReturn(true);
|
||||
|
||||
mController.updateState(mPreference);
|
||||
|
||||
assertThat(mPreference.getSummary()).isEqualTo(
|
||||
mContext.getString(R.string.security_settings_face_preference_summary_none_new));
|
||||
assertThat(mPreference.isVisible()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_hasFace_shouldShowSummary() {
|
||||
when(mFaceManager.isHardwareDetected()).thenReturn(true);
|
||||
|
@@ -36,6 +36,9 @@ import android.content.pm.PackageManager;
|
||||
import android.hardware.fingerprint.Fingerprint;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.os.UserManager;
|
||||
import android.platform.test.annotations.DisableFlags;
|
||||
import android.platform.test.annotations.EnableFlags;
|
||||
import android.platform.test.flag.junit.SetFlagsRule;
|
||||
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.preference.Preference;
|
||||
@@ -51,6 +54,7 @@ import com.android.settingslib.utils.StringUtil;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
@@ -66,6 +70,8 @@ import java.util.Collections;
|
||||
@Config(shadows = {ShadowRestrictedLockUtilsInternal.class})
|
||||
public class FingerprintStatusPreferenceControllerTest {
|
||||
|
||||
@Rule
|
||||
public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
|
||||
@Mock
|
||||
private LockPatternUtils mLockPatternUtils;
|
||||
@Mock
|
||||
@@ -125,7 +131,8 @@ public class FingerprintStatusPreferenceControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_noFingerprint_shouldShowDefaultSummary() {
|
||||
@DisableFlags(com.android.settings.flags.Flags.FLAG_BIOMETRICS_ONBOARDING_EDUCATION)
|
||||
public void updateState_noFingerprint_flagOff_shouldShowDefaultSummary() {
|
||||
when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
|
||||
|
||||
mController.updateState(mPreference);
|
||||
@@ -135,6 +142,19 @@ public class FingerprintStatusPreferenceControllerTest {
|
||||
assertThat(mPreference.isVisible()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnableFlags(com.android.settings.flags.Flags.FLAG_BIOMETRICS_ONBOARDING_EDUCATION)
|
||||
public void updateState_noFingerprint_flagOn_shouldShowDefaultSummary() {
|
||||
when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
|
||||
|
||||
mController.updateState(mPreference);
|
||||
|
||||
assertThat(mPreference.getSummary()).isEqualTo(
|
||||
mContext.getString(
|
||||
R.string.security_settings_fingerprint_preference_summary_none_new));
|
||||
assertThat(mPreference.isVisible()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_hasFingerprint_shouldShowSummary() {
|
||||
when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
|
||||
|
@@ -172,7 +172,8 @@ public class FaceStatusUtilsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_whenNotEnrolled_returnsSummaryNone() {
|
||||
@DisableFlags(com.android.settings.flags.Flags.FLAG_BIOMETRICS_ONBOARDING_EDUCATION)
|
||||
public void getSummary_whenNotEnrolled_flagOff_returnsSummaryNone() {
|
||||
when(mFaceManager.hasEnrolledTemplates(anyInt())).thenReturn(false);
|
||||
|
||||
assertThat(mFaceStatusUtils.getSummary())
|
||||
@@ -181,6 +182,17 @@ public class FaceStatusUtilsTest {
|
||||
"security_settings_face_preference_summary_none"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnableFlags(com.android.settings.flags.Flags.FLAG_BIOMETRICS_ONBOARDING_EDUCATION)
|
||||
public void getSummary_whenNotEnrolled_flagOn_returnsSummaryNone() {
|
||||
when(mFaceManager.hasEnrolledTemplates(anyInt())).thenReturn(false);
|
||||
|
||||
assertThat(mFaceStatusUtils.getSummary())
|
||||
.isEqualTo(ResourcesUtils.getResourcesString(
|
||||
mApplicationContext,
|
||||
"security_settings_face_preference_summary_none_new"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_whenEnrolled_returnsSummary() {
|
||||
when(mFaceManager.hasEnrolledTemplates(anyInt())).thenReturn(true);
|
||||
|
@@ -179,7 +179,8 @@ public class FingerprintStatusUtilsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_whenNotEnrolled_returnsSummaryNone() {
|
||||
@DisableFlags(com.android.settings.flags.Flags.FLAG_BIOMETRICS_ONBOARDING_EDUCATION)
|
||||
public void getSummary_whenNotEnrolled_flagOff_returnsSummaryNone() {
|
||||
when(mFingerprintManager.hasEnrolledTemplates(anyInt())).thenReturn(false);
|
||||
|
||||
assertThat(mFingerprintStatusUtils.getSummary())
|
||||
@@ -188,6 +189,17 @@ public class FingerprintStatusUtilsTest {
|
||||
"security_settings_fingerprint_preference_summary_none"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnableFlags(com.android.settings.flags.Flags.FLAG_BIOMETRICS_ONBOARDING_EDUCATION)
|
||||
public void getSummary_whenNotEnrolled_flagOn_returnsSummaryNone() {
|
||||
when(mFingerprintManager.hasEnrolledTemplates(anyInt())).thenReturn(false);
|
||||
|
||||
assertThat(mFingerprintStatusUtils.getSummary())
|
||||
.isEqualTo(ResourcesUtils.getResourcesString(
|
||||
mApplicationContext,
|
||||
"security_settings_fingerprint_preference_summary_none_new"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_whenEnrolled_returnsSummary() {
|
||||
final int enrolledFingerprintsCount = 2;
|
||||
|
@@ -171,7 +171,7 @@ public class FaceSafetySourceTest {
|
||||
|
||||
assertSafetySourceDisabledDataSetWithSingularSummary(
|
||||
"security_settings_face_preference_title_new",
|
||||
"security_settings_face_preference_summary_none");
|
||||
"security_settings_face_preference_summary_none_new");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -188,7 +188,7 @@ public class FaceSafetySourceTest {
|
||||
|
||||
assertSafetySourceDisabledDataSetWithSingularSummary(
|
||||
"security_settings_face_preference_title_new",
|
||||
"security_settings_face_preference_summary_none");
|
||||
"security_settings_face_preference_summary_none_new");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -202,7 +202,7 @@ public class FaceSafetySourceTest {
|
||||
|
||||
assertSafetySourceEnabledDataSetWithSingularSummary(
|
||||
"security_settings_face_preference_title_new",
|
||||
"security_settings_face_preference_summary_none",
|
||||
"security_settings_face_preference_summary_none_new",
|
||||
FaceEnrollIntroductionInternal.class.getName());
|
||||
}
|
||||
|
||||
|
@@ -185,7 +185,7 @@ public class FingerprintSafetySourceTest {
|
||||
|
||||
assertSafetySourceDisabledDataSetWithSingularSummary(
|
||||
"security_settings_fingerprint",
|
||||
"security_settings_fingerprint_preference_summary_none");
|
||||
"security_settings_fingerprint_preference_summary_none_new");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -203,7 +203,7 @@ public class FingerprintSafetySourceTest {
|
||||
|
||||
assertSafetySourceDisabledDataSetWithSingularSummary(
|
||||
"security_settings_fingerprint",
|
||||
"security_settings_fingerprint_preference_summary_none");
|
||||
"security_settings_fingerprint_preference_summary_none_new");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -218,7 +218,7 @@ public class FingerprintSafetySourceTest {
|
||||
|
||||
assertSafetySourceEnabledDataSetWithSingularSummary(
|
||||
"security_settings_fingerprint",
|
||||
"security_settings_fingerprint_preference_summary_none",
|
||||
"security_settings_fingerprint_preference_summary_none_new",
|
||||
FingerprintSettings.class.getName());
|
||||
}
|
||||
|
||||
|
@@ -32,10 +32,13 @@ import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.os.UserManager;
|
||||
import android.os.storage.StorageManager;
|
||||
import android.platform.test.annotations.DisableFlags;
|
||||
import android.platform.test.annotations.EnableFlags;
|
||||
import android.platform.test.annotations.RequiresFlagsDisabled;
|
||||
import android.platform.test.annotations.RequiresFlagsEnabled;
|
||||
import android.platform.test.flag.junit.CheckFlagsRule;
|
||||
import android.platform.test.flag.junit.DeviceFlagsValueProvider;
|
||||
import android.platform.test.flag.junit.SetFlagsRule;
|
||||
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
@@ -64,6 +67,8 @@ public class ScreenLockPreferenceDetailsUtilsTest {
|
||||
private static final int SOURCE_METRICS_CATEGORY = 10;
|
||||
private static final int USER_ID = 11;
|
||||
|
||||
@Rule
|
||||
public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
|
||||
@Rule
|
||||
public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
|
||||
@Mock
|
||||
@@ -118,7 +123,8 @@ public class ScreenLockPreferenceDetailsUtilsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_unsecureAndDisabledPattern_shouldReturnUnlockModeOff() {
|
||||
@DisableFlags(com.android.settings.flags.Flags.FLAG_BIOMETRICS_ONBOARDING_EDUCATION)
|
||||
public void getSummary_unsecureAndDisabledPattern_flagOff_shouldReturnUnlockModeOff() {
|
||||
final String summary = prepareString("unlock_set_unlock_mode_off", "unlockModeOff");
|
||||
|
||||
when(mLockPatternUtils.isSecure(USER_ID)).thenReturn(false);
|
||||
@@ -127,6 +133,17 @@ public class ScreenLockPreferenceDetailsUtilsTest {
|
||||
assertThat(mScreenLockPreferenceDetailsUtils.getSummary(USER_ID)).isEqualTo(summary);
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnableFlags(com.android.settings.flags.Flags.FLAG_BIOMETRICS_ONBOARDING_EDUCATION)
|
||||
public void getSummary_unsecureAndDisabledPattern_flagOn_shouldReturnUnlockModeOff() {
|
||||
final String summary = prepareString("unlock_set_unlock_mode_off_new", "unlockModeOff");
|
||||
|
||||
when(mLockPatternUtils.isSecure(USER_ID)).thenReturn(false);
|
||||
when(mLockPatternUtils.isLockScreenDisabled(anyInt())).thenReturn(true);
|
||||
|
||||
assertThat(mScreenLockPreferenceDetailsUtils.getSummary(USER_ID)).isEqualTo(summary);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_unsecurePattern_shouldReturnUnlockModeNone() {
|
||||
final String summary =
|
||||
|
Reference in New Issue
Block a user