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

Commit 5464aaf4 authored by Md Shahadat Hossain Shahin's avatar Md Shahadat Hossain Shahin Committed by Android (Google) Code Review
Browse files

Merge "Allow setting default value for TEXT_SHOW_PASSWORD" into main

parents 869a9ac9 68cc6432
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -344,4 +344,12 @@

    <!-- Caps minsum contrast from -1.0 (Material API) to 0.0 (Android Support)-->
    <bool name="config_increaseMinContrast">true</bool>

    <!--
        Default for Settings.System.TEXT_SHOW_PASSWORD.

        Intentionally left empty. The goal is to set a default for desktop
        devices without forcing it on other form factors.
    -->
    <bool name="def_text_show_password"></bool>
</resources>
+29 −1
Original line number Diff line number Diff line
@@ -4254,7 +4254,7 @@ public class SettingsProvider extends ContentProvider {

        @VisibleForTesting
        final class UpgradeController {
            private static final int SETTINGS_VERSION = 230;
            private static final int SETTINGS_VERSION = 231;

            private final int mUserId;
            private final int mDeviceId;
@@ -6585,6 +6585,34 @@ public class SettingsProvider extends ContentProvider {
                    currentVersion = 230;
                }

                if (currentVersion == 230) {
                    if (Flags.allowDefaultValueForTextShowPassword()) {
                        final SettingsState systemSettings =
                                getSystemSettingsLocked(userId, deviceId);

                        if (systemSettings
                                .getSettingLocked(Settings.System.TEXT_SHOW_PASSWORD)
                                .isNull()) {
                            try {
                                boolean defTextShowPassword =
                                        getContext()
                                                .getResources()
                                                .getBoolean(R.bool.def_text_show_password);
                                systemSettings.insertSettingOverrideableByRestoreLocked(
                                        Settings.System.TEXT_SHOW_PASSWORD,
                                        defTextShowPassword ? "1" : "0",
                                        null /* tag */,
                                        true /* makeDefault */,
                                        SettingsState.SYSTEM_PACKAGE_NAME);
                            } catch (Resources.NotFoundException e) {
                                // Do nothing
                            }
                        }
                    }

                    currentVersion = 231;
                }

                // vXXX: Add new settings above this point.

                if (currentVersion != newVersion) {
+10 −0
Original line number Diff line number Diff line
@@ -111,3 +111,13 @@ flag {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "allow_default_value_for_text_show_password"
    namespace: "desktop_privacy"
    description: "Allows setting a default value for Settings.System.TEXT_SHOW_PASSWORD."
    bug: "339270220"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}