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

Commit f90a4720 authored by Lyn Han's avatar Lyn Han Committed by Android (Google) Code Review
Browse files

Merge "Global bubble settings" into qt-r1-bubbles-dev

parents 3e6d1299 b739fa6a
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -2343,6 +2343,7 @@ package android.provider {
    field public static final String LOCATION_IGNORE_SETTINGS_PACKAGE_WHITELIST = "location_ignore_settings_package_whitelist";
    field public static final String LOCATION_IGNORE_SETTINGS_PACKAGE_WHITELIST = "location_ignore_settings_package_whitelist";
    field public static final String LOW_POWER_MODE = "low_power";
    field public static final String LOW_POWER_MODE = "low_power";
    field public static final String LOW_POWER_MODE_STICKY = "low_power_sticky";
    field public static final String LOW_POWER_MODE_STICKY = "low_power_sticky";
    field public static final String NOTIFICATION_BUBBLES = "notification_bubbles";
    field public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices";
    field public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices";
    field public static final String USE_OPEN_WIFI_PACKAGE = "use_open_wifi_package";
    field public static final String USE_OPEN_WIFI_PACKAGE = "use_open_wifi_package";
  }
  }
+12 −1
Original line number Original line Diff line number Diff line
@@ -9015,7 +9015,7 @@ public final class Settings {
            ASSIST_GESTURE_WAKE_ENABLED,
            ASSIST_GESTURE_WAKE_ENABLED,
            VR_DISPLAY_MODE,
            VR_DISPLAY_MODE,
            NOTIFICATION_BADGING,
            NOTIFICATION_BADGING,
            NOTIFICATION_BUBBLES,
            NOTIFICATION_BUBBLES,                               // moved to global
            NOTIFICATION_DISMISS_RTL,
            NOTIFICATION_DISMISS_RTL,
            QS_AUTO_ADDED_TILES,
            QS_AUTO_ADDED_TILES,
            SCREENSAVER_ENABLED,
            SCREENSAVER_ENABLED,
@@ -9385,6 +9385,16 @@ public final class Settings {
         */
         */
        public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/global");
        public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/global");
        /**
         * Whether the notification bubbles are globally enabled
         * The value is boolean (1 or 0).
         * @hide
         */
        @TestApi
        public static final String NOTIFICATION_BUBBLES = "notification_bubbles";
        private static final Validator NOTIFICATION_BUBBLES_VALIDATOR = BOOLEAN_VALIDATOR;
        /**
        /**
         * Whether users are allowed to add more users or guest from lockscreen.
         * Whether users are allowed to add more users or guest from lockscreen.
         * <p>
         * <p>
@@ -13910,6 +13920,7 @@ public final class Settings {
            VALIDATORS.put(AWARE_ALLOWED, AWARE_ALLOWED_VALIDATOR);
            VALIDATORS.put(AWARE_ALLOWED, AWARE_ALLOWED_VALIDATOR);
            VALIDATORS.put(POWER_BUTTON_LONG_PRESS, POWER_BUTTON_LONG_PRESS_VALIDATOR);
            VALIDATORS.put(POWER_BUTTON_LONG_PRESS, POWER_BUTTON_LONG_PRESS_VALIDATOR);
            VALIDATORS.put(POWER_BUTTON_VERY_LONG_PRESS, POWER_BUTTON_VERY_LONG_PRESS_VALIDATOR);
            VALIDATORS.put(POWER_BUTTON_VERY_LONG_PRESS, POWER_BUTTON_VERY_LONG_PRESS_VALIDATOR);
            VALIDATORS.put(NOTIFICATION_BUBBLES, NOTIFICATION_BUBBLES_VALIDATOR);
        }
        }
        /**
        /**
+1 −0
Original line number Original line Diff line number Diff line
@@ -688,6 +688,7 @@ message GlobalSettingsProto {
        // Configuration options for smart replies and smart actions in notifications. This is
        // Configuration options for smart replies and smart actions in notifications. This is
        // encoded as a key=value list separated by commas.
        // encoded as a key=value list separated by commas.
        optional SettingProto smart_suggestions_in_notifications_flags = 5 [ (android.privacy).dest = DEST_AUTOMATIC ];
        optional SettingProto smart_suggestions_in_notifications_flags = 5 [ (android.privacy).dest = DEST_AUTOMATIC ];
        optional SettingProto bubbles = 6 [ (android.privacy).dest = DEST_AUTOMATIC ];
    }
    }
    optional Notification notification = 82;
    optional Notification notification = 82;


+3 −0
Original line number Original line Diff line number Diff line
@@ -1056,6 +1056,9 @@ class SettingsProtoDumpUtil {
        dumpSetting(s, p,
        dumpSetting(s, p,
                Settings.Global.NOTIFICATION_SNOOZE_OPTIONS,
                Settings.Global.NOTIFICATION_SNOOZE_OPTIONS,
                GlobalSettingsProto.Notification.SNOOZE_OPTIONS);
                GlobalSettingsProto.Notification.SNOOZE_OPTIONS);
        dumpSetting(s, p,
                Settings.Global.NOTIFICATION_BUBBLES,
                GlobalSettingsProto.Notification.BUBBLES);
        dumpSetting(s, p,
        dumpSetting(s, p,
                Settings.Global.SMART_REPLIES_IN_NOTIFICATIONS_FLAGS,
                Settings.Global.SMART_REPLIES_IN_NOTIFICATIONS_FLAGS,
                GlobalSettingsProto.Notification.SMART_REPLIES_IN_NOTIFICATIONS_FLAGS);
                GlobalSettingsProto.Notification.SMART_REPLIES_IN_NOTIFICATIONS_FLAGS);
+17 −20
Original line number Original line Diff line number Diff line
@@ -4255,19 +4255,7 @@ public class SettingsProvider extends ContentProvider {


                if (currentVersion == 173) {
                if (currentVersion == 173) {
                    // Version 173: Set the default value for Secure Settings: NOTIFICATION_BUBBLES
                    // Version 173: Set the default value for Secure Settings: NOTIFICATION_BUBBLES

                    // Removed. Moved NOTIFICATION_BUBBLES to Global Settings.
                    final SettingsState secureSettings = getSecureSettingsLocked(userId);

                    final Setting bubblesSetting = secureSettings.getSettingLocked(
                            Secure.NOTIFICATION_BUBBLES);

                    if (bubblesSetting.isNull()) {
                        secureSettings.insertSettingLocked(Secure.NOTIFICATION_BUBBLES,
                                getContext().getResources().getBoolean(
                                        R.bool.def_notification_bubbles) ? "1" : "0", null,
                                true, SettingsState.SYSTEM_PACKAGE_NAME);
                    }

                    currentVersion = 174;
                    currentVersion = 174;
                }
                }


@@ -4391,14 +4379,9 @@ public class SettingsProvider extends ContentProvider {
                if (currentVersion == 179) {
                if (currentVersion == 179) {
                    // Version 178: Reset the default for Secure Settings: NOTIFICATION_BUBBLES
                    // Version 178: Reset the default for Secure Settings: NOTIFICATION_BUBBLES
                    // This is originally set in version 173, however, the default value changed
                    // This is originally set in version 173, however, the default value changed
                    // so this step is to ensure the value is updated to the correct defaulte
                    // so this step is to ensure the value is updated to the correct default.
                    final SettingsState secureSettings = getSecureSettingsLocked(userId);

                    secureSettings.insertSettingLocked(Secure.NOTIFICATION_BUBBLES,
                            getContext().getResources().getBoolean(
                                    R.bool.def_notification_bubbles) ? "1" : "0", null,
                                    true, SettingsState.SYSTEM_PACKAGE_NAME);


                    // Removed. Moved NOTIFICATION_BUBBLES to Global Settings.
                    currentVersion = 180;
                    currentVersion = 180;
                }
                }


@@ -4452,6 +4435,20 @@ public class SettingsProvider extends ContentProvider {
                    currentVersion = 182;
                    currentVersion = 182;
                }
                }


                if (currentVersion == 182) {
                    // Remove secure bubble settings.
                    getSecureSettingsLocked(userId).deleteSettingLocked(
                            Secure.NOTIFICATION_BUBBLES);

                    // Add global bubble settings.
                    getGlobalSettingsLocked().insertSettingLocked(Global.NOTIFICATION_BUBBLES,
                            getContext().getResources().getBoolean(
                                    R.bool.def_notification_bubbles) ? "1" : "0", null /* tag */,
                            true /* makeDefault */, SettingsState.SYSTEM_PACKAGE_NAME);

                    currentVersion = 183;
                }

                // vXXX: Add new settings above this point.
                // vXXX: Add new settings above this point.


                if (currentVersion != newVersion) {
                if (currentVersion != newVersion) {