Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 10cf921f authored by Shawn Lin's avatar Shawn Lin
Browse files

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
parent 11b78c6f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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] -->
+4 −1
Original line number Diff line number Diff line
@@ -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);
        }
    }

+3 −1
Original line number Diff line number Diff line
@@ -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);
        }
    }

+3 −1
Original line number Diff line number Diff line
@@ -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;
            }
+20 −1
Original line number Diff line number Diff line
@@ -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);
Loading