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

Commit 93bbf3f7 authored by Fang Yunong's avatar Fang Yunong Committed by Gerrit - the friendly Code Review server
Browse files

Settings: Set security password visible as default

We add this to control the default value of showing password in SecuritySettings

Change-Id: I752dcfcbee00c9ce4b77584222f464100e68d9a4
CRs-Fixed: 1069392
parent 3f63f667
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -90,4 +90,5 @@
    <bool name="config_regional_hotspot_show_maximum_connection_enable">false</bool>
    <string-array translatable="false" name="carrier_operator_list">
    </string-array>
    <bool name="config_regional_security_show_password_enable">false</bool>
</resources>
+13 −2
Original line number Diff line number Diff line
@@ -112,6 +112,8 @@ public class SecuritySettings extends SettingsPreferenceFragment
    private static final String PACKAGE_MIME_TYPE = "application/vnd.android.package-archive";
    private static final String KEY_TRUST_AGENT = "trust_agent";
    private static final String KEY_SCREEN_PINNING = "screen_pinning_settings";
    private static final int PASSWORD_VISIBLE = 1;
    private static final int PASSWORD_INVISIBLE = 0;

    // These switch preferences need special handling since they're not all stored in Settings.
    private static final String SWITCH_PREFERENCE_KEYS[] = {
@@ -602,8 +604,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
        updateUnificationPreference();

        if (mShowPassword != null) {
            mShowPassword.setChecked(Settings.System.getInt(getContentResolver(),
                    Settings.System.TEXT_SHOW_PASSWORD, 1) != 0);
            mShowPassword.setChecked(isPasswordVisible());
        }

        if (mResetCredentials != null && !mResetCredentials.isDisabledByAdmin()) {
@@ -611,6 +612,16 @@ public class SecuritySettings extends SettingsPreferenceFragment
        }
    }

    private boolean isPasswordVisible() {
        int defaultValue = PASSWORD_VISIBLE ;
        if (getResources().getBoolean(
                R.bool.config_regional_security_show_password_enable)) {
            defaultValue = PASSWORD_INVISIBLE ;
        }
        return Settings.System.getInt(getContentResolver(),
                        Settings.System.TEXT_SHOW_PASSWORD, defaultValue) != 0 ;
    }

    private void updateUnificationPreference() {
        if (mUnifyProfile != null) {
            mUnifyProfile.setChecked(!mLockPatternUtils.isSeparateProfileChallengeEnabled(