Global bubble settings
Background: Bubble settings have the following levels
- Global (developer options flag)
- App-level
- Channel-level
Issue: Global settings do not propagate to the work profile user because we are
storing NOTIFICATION_BUBBLES in the Secure Settings table instead of the
Global Settings table. Settings are global XOR per-user.
This change
- Sets default value for NOTIFICATION_BUBBLES in global settings table.
- Adds Global.NOTIFICATIONS_BUBBLES to frameworks/base/api/test-current.txt
- Keeps old upgrade steps as no-op to keep db versioning stable.
Bug: 136034310
Test: RunSettingsRoboTests ROBOTEST_FILTER="Bubble"
Change-Id: I21d3dae75e2a4ab0fac10f3d7ea7eed16e0f5d6c
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
index b2c10ec..cc39f5c 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
@@ -1057,6 +1057,9 @@
Settings.Global.NOTIFICATION_SNOOZE_OPTIONS,
GlobalSettingsProto.Notification.SNOOZE_OPTIONS);
dumpSetting(s, p,
+ Settings.Global.NOTIFICATION_BUBBLES,
+ GlobalSettingsProto.Notification.BUBBLES);
+ dumpSetting(s, p,
Settings.Global.SMART_REPLIES_IN_NOTIFICATIONS_FLAGS,
GlobalSettingsProto.Notification.SMART_REPLIES_IN_NOTIFICATIONS_FLAGS);
dumpSetting(s, p,
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 5cd29b7..50c976a 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -4255,19 +4255,7 @@
if (currentVersion == 173) {
// Version 173: Set the default value for Secure Settings: NOTIFICATION_BUBBLES
-
- 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);
- }
-
+ // Removed. Moved NOTIFICATION_BUBBLES to Global Settings.
currentVersion = 174;
}
@@ -4391,14 +4379,9 @@
if (currentVersion == 179) {
// Version 178: Reset the default for Secure Settings: NOTIFICATION_BUBBLES
// 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
- final SettingsState secureSettings = getSecureSettingsLocked(userId);
+ // so this step is to ensure the value is updated to the correct default.
- 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;
}
@@ -4452,6 +4435,20 @@
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.
if (currentVersion != newVersion) {