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

Commit 2ac67960 authored by Bagus Maulana's avatar Bagus Maulana
Browse files

Add hardcoded Wear settings to Settings.java and SETTINGS_TO_BACKUP

Some settings used in Wear OS aren't in Settings.java, instead, they are
just hardcoded strings in various places. To add them to
SETTINGS_TO_BACKUP, they need to be in Settings.java. So, this CL adds
them to both Settings.java and SETTINGS_TO_BACKUP

Unfortunately, most of the usages of these strings are outside the
frameworks/base module. So, I will have to 'fix' them to use these new
constants in Settings.java instead of hardcoded strings in follow-up
CLs.

Bug: 228159084
Defer-CP-To-TM: 228159084
Test: Flashed a prototype build with these changes to a test watch
Change-Id: I6bebb0c2b93b34f80d56395caacc00f20a506ca0
(cherry picked from commit 24c2d4fb10e04e9b69ea4e3f4e82ec11c3eb4d08)
(cherry picked from commit 162b295dcdc797577af00ee5640e373abb907954)
parent 98fb69d9
Loading
Loading
Loading
Loading
+47 −2
Original line number Diff line number Diff line
@@ -3785,6 +3785,10 @@ public final class Settings {
        private static boolean putStringForUser(ContentResolver resolver, String name, String value,
                String tag, boolean makeDefault, int userHandle, boolean overrideableByRestore) {
            if (LOCAL_LOGV) {
                Log.v(TAG, "System.putString(name=" + name + ", value=" + value + ") for "
                        + userHandle);
            }
            if (MOVED_TO_SECURE.contains(name)) {
                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
                        + " to android.provider.Settings.Secure, value is unchanged.");
@@ -5678,6 +5682,33 @@ public final class Settings {
        @Readable
        public static final String WHEN_TO_MAKE_WIFI_CALLS = "when_to_make_wifi_calls";
        /** Controls whether bluetooth is on or off on wearable devices.
         *
         * <p>The valid values for this key are: 0 (disabled) or 1 (enabled).
         *
         * @hide
         */
        public static final String CLOCKWORK_BLUETOOTH_SETTINGS_PREF = "cw_bt_settings_pref";
        /**
         * Controls whether the unread notification dot indicator is shown on wearable devices.
         *
         * <p>The valid values for this key are: 0 (disabled) or 1 (enabled).
         *
         * @hide
         */
        public static final String UNREAD_NOTIFICATION_DOT_INDICATOR =
                "unread_notification_dot_indicator";
        /**
         * Controls whether auto-launching media controls is enabled on wearable devices.
         *
         * <p>The valid values for this key are: 0 (disabled) or 1 (enabled).
         *
         * @hide
         */
        public static final String AUTO_LAUNCH_MEDIA_CONTROLS = "auto_launch_media_controls";
        // Settings moved to Settings.Secure
        /**
@@ -6206,6 +6237,10 @@ public final class Settings {
        public static boolean putStringForUser(@NonNull ContentResolver resolver,
                @NonNull String name, @Nullable String value, @Nullable String tag,
                boolean makeDefault, @UserIdInt int userHandle, boolean overrideableByRestore) {
            if (LOCAL_LOGV) {
                Log.v(TAG, "Secure.putString(name=" + name + ", value=" + value + ") for "
                        + userHandle);
            }
            if (MOVED_TO_GLOBAL.contains(name)) {
                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
                        + " to android.provider.Settings.Global");
@@ -10721,6 +10756,16 @@ public final class Settings {
         */
        public static final String ADAPTIVE_CONNECTIVITY_ENABLED = "adaptive_connectivity_enabled";
        /**
         * Controls the 'Sunlight boost' toggle in wearable devices (high brightness mode).
         *
         * Valid values for this key are: '0' (disabled) or '1' (enabled).
         *
         * @hide
         */
        public static final String HBM_SETTING_KEY =
                "com.android.server.display.HBM_SETTING_KEY";
        /**
         * Keys we no longer back up under the current schema, but want to continue to
         * process when restoring historical backup datasets.
@@ -16054,8 +16099,8 @@ public final class Settings {
                @NonNull String name, @Nullable String value, @Nullable String tag,
                boolean makeDefault, @UserIdInt int userHandle, boolean overrideableByRestore) {
            if (LOCAL_LOGV) {
                Log.v(TAG, "Global.putString(name=" + name + ", value=" + value
                        + " for " + userHandle);
                Log.v(TAG, "Global.putString(name=" + name + ", value=" + value + ") for "
                        + userHandle);
            }
            // Global and Secure have the same access policy so we can forward writes
            if (MOVED_TO_SECURE.contains(name)) {
+2 −1
Original line number Diff line number Diff line
@@ -202,6 +202,7 @@ public class SecureSettings {
        Settings.Secure.LOCK_SCREEN_SHOW_QR_CODE_SCANNER,
        Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK,
        Settings.Secure.STATUS_BAR_SHOW_VIBRATE_ICON,
        Settings.Secure.WEAR_TALKBACK_ENABLED
        Settings.Secure.WEAR_TALKBACK_ENABLED,
        Settings.Secure.HBM_SETTING_KEY
    };
}
+4 −1
Original line number Diff line number Diff line
@@ -89,6 +89,9 @@ public class SystemSettings {
        Settings.System.DISPLAY_COLOR_MODE,
        Settings.System.ALARM_ALERT,
        Settings.System.NOTIFICATION_LIGHT_PULSE,
        Settings.System.WEAR_ACCESSIBILITY_GESTURE_ENABLED
        Settings.System.WEAR_ACCESSIBILITY_GESTURE_ENABLED,
        Settings.System.CLOCKWORK_BLUETOOTH_SETTINGS_PREF,
        Settings.System.UNREAD_NOTIFICATION_DOT_INDICATOR,
        Settings.System.AUTO_LAUNCH_MEDIA_CONTROLS
    };
}
+2 −0
Original line number Diff line number Diff line
@@ -332,5 +332,7 @@ public class SecureSettingsValidators {
            return true;
        });
        VALIDATORS.put(Secure.ODI_CAPTIONS_VOLUME_UI_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.WEAR_TALKBACK_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.HBM_SETTING_KEY, BOOLEAN_VALIDATOR);
    }
}
+3 −0
Original line number Diff line number Diff line
@@ -208,5 +208,8 @@ public class SystemSettingsValidators {
        VALIDATORS.put(System.SHOW_BATTERY_PERCENT, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.NOTIFICATION_LIGHT_PULSE, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.WEAR_ACCESSIBILITY_GESTURE_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.CLOCKWORK_BLUETOOTH_SETTINGS_PREF, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.UNREAD_NOTIFICATION_DOT_INDICATOR, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.AUTO_LAUNCH_MEDIA_CONTROLS, BOOLEAN_VALIDATOR);
    }
}