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

Commit d83b2479 authored by Michael Bestas's avatar Michael Bestas Committed by Roman Birg
Browse files

Forward port pattern visibility settings (2/2)

Change-Id: Ic627953c5df854c442671a98b5da539b994da18b
parent 033a1bf3
Loading
Loading
Loading
Loading
+11 −15
Original line number Diff line number Diff line
@@ -466,21 +466,6 @@
    <string name="notification_light_missed_call_title">Missed call</string>
    <string name="notification_light_voicemail_title">Voicemail</string>

    <!-- Sizes for pattern lockscreen -->
    <string name="lock_pattern_size_3">3x3</string>
    <string name="lock_pattern_size_4">4x4</string>
    <string name="lock_pattern_size_5">5x5</string>
    <string name="lock_pattern_size_6">6x6</string>

    <!-- Whether a visible red line will be drawn after the user has drawn the unlock pattern incorrectly -->
    <string name="lockpattern_settings_enable_error_path_title">Show pattern error</string>
    <!-- Whether the dots will be drawn when using the lockscreen pattern -->
    <string name="lockpattern_settings_enable_dots_title">Show pattern dots</string>

    <!-- Lock screen vibrate settings -->
    <string name="lockscreen_vibrate_enabled_title">Vibrate</string>
    <string name="lockscreen_vibrate_enabled_head">Vibrate when unlocking</string>

    <!-- Sound & notification > Sound section: Title for the option defining the default notification ringtone. [CHAR LIMIT=30] -->
    <string name="notification_ringtone_title_cm">Notification tone</string>

@@ -990,6 +975,17 @@
    <string name="settings_cmlicense_activity_title">CyanogenMod legal</string>
    <string name="settings_cmlicense_activity_unreachable">You don\'t have a data connection. To view this information now, go to %s from any computer connected to the Internet.</string>

    <!-- Sizes for pattern lockscreen -->
    <string name="lock_pattern_size_3" translatable="false">3 \u00d7 3</string>
    <string name="lock_pattern_size_4" translatable="false">4 \u00d7 4</string>
    <string name="lock_pattern_size_5" translatable="false">5 \u00d7 5</string>
    <string name="lock_pattern_size_6" translatable="false">6 \u00d7 6</string>

    <!-- Whether a visible red line will be drawn after the user has drawn the unlock pattern incorrectly -->
    <string name="lockpattern_settings_enable_error_path_title">Show pattern error</string>
    <!-- Whether the dots will be drawn when using the lockscreen pattern -->
    <string name="lockpattern_settings_enable_dots_title">Show pattern dots</string>

    <!-- Screen security -->
    <string name="unlock_quick_unlock_control_title">Quick unlock</string>
    <string name="unlock_quick_unlock_control_summary">Unlock automatically when the correct PIN/password is entered</string>
+11 −0
Original line number Diff line number Diff line
@@ -38,8 +38,19 @@

        <SwitchPreference
            android:key="visiblepattern"
            android:persistent="false"
            android:title="@string/lockpattern_settings_enable_visible_pattern_title"/>

        <SwitchPreference
            android:key="visible_error_pattern"
            android:persistent="false"
            android:title="@string/lockpattern_settings_enable_error_path_title"/>

        <SwitchPreference
            android:key="visibledots"
            android:persistent="false"
            android:title="@string/lockpattern_settings_enable_dots_title"/>

        <ListPreference
            android:key="lock_after_timeout"
            android:title="@string/lock_after_timeout"
+10 −0
Original line number Diff line number Diff line
@@ -34,6 +34,16 @@
            android:persistent="false"
            android:title="@string/lockpattern_settings_enable_visible_pattern_title"/>

        <SwitchPreference
            android:key="visible_error_pattern"
            android:persistent="false"
            android:title="@string/lockpattern_settings_enable_error_path_title"/>

        <SwitchPreference
            android:key="visibledots"
            android:persistent="false"
            android:title="@string/lockpattern_settings_enable_dots_title"/>

        <ListPreference
            android:key="lock_after_timeout"
            android:title="@string/lock_after_timeout"
+29 −4
Original line number Diff line number Diff line
@@ -66,6 +66,8 @@ public class LockScreenSettings extends SettingsPreferenceFragment
    private static final String KEY_BIOMETRIC_WEAK_LIVELINESS = "biometric_weak_liveliness";
    private static final String KEY_LOCK_ENABLED = "lockenabled";
    private static final String KEY_VISIBLE_PATTERN = "visiblepattern";
    private static final String KEY_VISIBLE_ERROR_PATTERN = "visible_error_pattern";
    private static final String KEY_VISIBLE_DOTS = "visibledots";
    private static final String KEY_LOCK_AFTER_TIMEOUT = "lock_after_timeout";
    private static final String KEY_POWER_INSTANTLY_LOCKS = "power_button_instantly_locks";
    private static final String KEY_TRUST_AGENT = "trust_agent";
@@ -90,14 +92,16 @@ public class LockScreenSettings extends SettingsPreferenceFragment

    private SwitchPreference mBiometricWeakLiveliness;
    private SwitchPreference mVisiblePattern;
    private SwitchPreference mVisibleErrorPattern;
    private SwitchPreference mVisibleDots;
    private SwitchPreference mPowerButtonInstantlyLocks;

    private DevicePolicyManager mDPM;

    // These switch preferences need special handling since they're not all stored in Settings.
    private static final String SWITCH_PREFERENCE_KEYS[] = { KEY_LOCK_AFTER_TIMEOUT,
            KEY_LOCK_ENABLED, KEY_VISIBLE_PATTERN, KEY_BIOMETRIC_WEAK_LIVELINESS,
            KEY_POWER_INSTANTLY_LOCKS };
            KEY_LOCK_ENABLED, KEY_VISIBLE_PATTERN, KEY_VISIBLE_ERROR_PATTERN, KEY_VISIBLE_DOTS,
            KEY_BIOMETRIC_WEAK_LIVELINESS, KEY_POWER_INSTANTLY_LOCKS };


    @Override
@@ -126,6 +130,12 @@ public class LockScreenSettings extends SettingsPreferenceFragment
        if (mVisiblePattern != null) {
            mVisiblePattern.setChecked(lockPatternUtils.isVisiblePatternEnabled());
        }
        if (mVisibleErrorPattern != null) {
            mVisibleErrorPattern.setChecked(lockPatternUtils.isShowErrorPath());
        }
        if (mVisibleDots != null) {
            mVisibleDots.setChecked(lockPatternUtils.isVisibleDotsEnabled());
        }
        if (mPowerButtonInstantlyLocks != null) {
            mPowerButtonInstantlyLocks.setChecked(lockPatternUtils.getPowerButtonInstantlyLocks());
        }
@@ -175,6 +185,12 @@ public class LockScreenSettings extends SettingsPreferenceFragment
        // visible pattern
        mVisiblePattern = (SwitchPreference) root.findPreference(KEY_VISIBLE_PATTERN);

        // visible error pattern
        mVisibleErrorPattern = (SwitchPreference) root.findPreference(KEY_VISIBLE_ERROR_PATTERN);

        // visible dots
        mVisibleDots = (SwitchPreference) root.findPreference(KEY_VISIBLE_DOTS);

        // lock instantly on power key press
        mPowerButtonInstantlyLocks = (SwitchPreference) root.findPreference(
                KEY_POWER_INSTANTLY_LOCKS);
@@ -193,8 +209,11 @@ public class LockScreenSettings extends SettingsPreferenceFragment
        if (resid == R.xml.security_settings_biometric_weak &&
                mLockPatternUtils.getKeyguardStoredPasswordQuality() !=
                        DevicePolicyManager.PASSWORD_QUALITY_SOMETHING) {
            if (securityCategory != null && mVisiblePattern != null) {
                securityCategory.removePreference(root.findPreference(KEY_VISIBLE_PATTERN));
            if (securityCategory != null && mVisiblePattern != null &&
                   mVisibleErrorPattern != null && mVisibleDots != null) {
                securityCategory.removePreference(mVisiblePattern);
                securityCategory.removePreference(mVisibleErrorPattern);
                securityCategory.removePreference(mVisibleDots);
            }
        }

@@ -408,6 +427,10 @@ public class LockScreenSettings extends SettingsPreferenceFragment
            lockPatternUtils.setLockPatternEnabled((Boolean) value);
        } else if (KEY_VISIBLE_PATTERN.equals(key)) {
            lockPatternUtils.setVisiblePatternEnabled((Boolean) value);
        } else if (KEY_VISIBLE_ERROR_PATTERN.equals(key)) {
            lockPatternUtils.setShowErrorPath((Boolean) value);
        } else if (KEY_VISIBLE_DOTS.equals(key)) {
            lockPatternUtils.setVisibleDotsEnabled((Boolean) value);
        } else  if (KEY_BIOMETRIC_WEAK_LIVELINESS.equals(key)) {
            if ((Boolean) value) {
                lockPatternUtils.setBiometricWeakLivelinessEnabled(true);
@@ -560,6 +583,8 @@ public class LockScreenSettings extends SettingsPreferenceFragment
                    lockPatternUtils.getKeyguardStoredPasswordQuality() !=
                            DevicePolicyManager.PASSWORD_QUALITY_SOMETHING) {
                keys.add(KEY_VISIBLE_PATTERN);
                keys.add(KEY_VISIBLE_ERROR_PATTERN);
                keys.add(KEY_VISIBLE_DOTS);
            }

            // TrustAgent settings disappear when the user has no primary security.