Loading core/java/android/provider/Settings.java +1 −0 Original line number Diff line number Diff line Loading @@ -9015,6 +9015,7 @@ public final class Settings { ASSIST_GESTURE_WAKE_ENABLED, VR_DISPLAY_MODE, NOTIFICATION_BADGING, NOTIFICATION_BUBBLES, // moved to global NOTIFICATION_DISMISS_RTL, QS_AUTO_ADDED_TILES, SCREENSAVER_ENABLED, Loading services/core/java/com/android/server/notification/NotificationManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -1359,7 +1359,7 @@ public class NotificationManagerService extends SystemService { private final Uri NOTIFICATION_BADGING_URI = Settings.Secure.getUriFor(Settings.Secure.NOTIFICATION_BADGING); private final Uri NOTIFICATION_BUBBLES_URI = Settings.Secure.getUriFor(Settings.Global.NOTIFICATION_BUBBLES); = Settings.Secure.getUriFor(Settings.Secure.NOTIFICATION_BUBBLES); private final Uri NOTIFICATION_LIGHT_PULSE_URI = Settings.System.getUriFor(Settings.System.NOTIFICATION_LIGHT_PULSE); private final Uri NOTIFICATION_RATE_LIMIT_URI Loading services/core/java/com/android/server/notification/PreferencesHelper.java +6 −6 Original line number Diff line number Diff line Loading @@ -1826,9 +1826,9 @@ public class PreferencesHelper implements RankingConfig { for (int index = 0; index < mBubblesEnabled.size(); index++) { int userId = mBubblesEnabled.keyAt(index); final boolean oldValue = mBubblesEnabled.get(userId); final boolean newValue = Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.NOTIFICATION_BUBBLES, DEFAULT_ALLOW_BUBBLE ? 1 : 0) != 0; final boolean newValue = Settings.Secure.getIntForUser(mContext.getContentResolver(), Settings.Secure.NOTIFICATION_BUBBLES, DEFAULT_ALLOW_BUBBLE ? 1 : 0, userId) != 0; mBubblesEnabled.put(userId, newValue); changed |= oldValue != newValue; } Loading @@ -1844,9 +1844,9 @@ public class PreferencesHelper implements RankingConfig { } if (mBubblesEnabled.indexOfKey(userId) < 0) { mBubblesEnabled.put(userId, Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.NOTIFICATION_BUBBLES, DEFAULT_ALLOW_BUBBLE ? 1 : 0) != 0); Settings.Secure.getIntForUser(mContext.getContentResolver(), Settings.Secure.NOTIFICATION_BUBBLES, DEFAULT_ALLOW_BUBBLE ? 1 : 0, userId) != 0); } return mBubblesEnabled.get(userId, DEFAULT_ALLOW_BUBBLE); } Loading services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java +21 −7 Original line number Diff line number Diff line Loading @@ -58,9 +58,7 @@ import android.net.Uri; import android.os.Build; import android.os.UserHandle; import android.provider.Settings; import android.provider.Settings.Global; import android.provider.Settings.Secure; import android.test.suitebuilder.annotation.SmallTest; import android.testing.TestableContentResolver; import android.util.ArrayMap; Loading Loading @@ -154,7 +152,8 @@ public class PreferencesHelperTest extends UiServiceTestCase { contentResolver.setFallbackToExisting(false); Secure.putIntForUser(contentResolver, Secure.NOTIFICATION_BADGING, 1, UserHandle.getUserId(UID_N_MR1)); Global.putInt(contentResolver, Global.NOTIFICATION_BUBBLES, 1); Secure.putIntForUser(contentResolver, Secure.NOTIFICATION_BUBBLES, 1, UserHandle.getUserId(UID_N_MR1)); ContentProvider testContentProvider = mock(ContentProvider.class); when(testContentProvider.getIContentProvider()).thenReturn(mTestIContentProvider); Loading Loading @@ -1949,16 +1948,18 @@ public class PreferencesHelperTest extends UiServiceTestCase { @Test public void testBubblesOverrideTrue() { Global.putInt(getContext().getContentResolver(), Global.NOTIFICATION_BUBBLES, 1); Secure.putIntForUser(getContext().getContentResolver(), Secure.NOTIFICATION_BUBBLES, 1, USER.getIdentifier()); mHelper.updateBubblesEnabled(); // would be called by settings observer assertTrue(mHelper.bubblesEnabled(USER)); } @Test public void testBubblesOverrideFalse() { Global.putInt(getContext().getContentResolver(), Global.NOTIFICATION_BUBBLES, 0); Secure.putIntForUser(getContext().getContentResolver(), Secure.NOTIFICATION_BUBBLES, 0, USER.getIdentifier()); mHelper.updateBubblesEnabled(); // would be called by settings observer assertFalse(mHelper.bubblesEnabled(USER)); } Loading @@ -1972,6 +1973,19 @@ public class PreferencesHelperTest extends UiServiceTestCase { } } @Test public void testBubblesOverrideUserIsolation() { Secure.putIntForUser(getContext().getContentResolver(), Secure.NOTIFICATION_BUBBLES, 0, USER.getIdentifier()); Secure.putIntForUser(getContext().getContentResolver(), Secure.NOTIFICATION_BUBBLES, 1, USER2.getIdentifier()); mHelper.updateBubblesEnabled(); // would be called by settings observer assertFalse(mHelper.bubblesEnabled(USER)); assertTrue(mHelper.bubblesEnabled(USER2)); } @Test public void testOnLocaleChanged_updatesDefaultChannels() throws Exception { String newLabel = "bananas!"; Loading Loading
core/java/android/provider/Settings.java +1 −0 Original line number Diff line number Diff line Loading @@ -9015,6 +9015,7 @@ public final class Settings { ASSIST_GESTURE_WAKE_ENABLED, VR_DISPLAY_MODE, NOTIFICATION_BADGING, NOTIFICATION_BUBBLES, // moved to global NOTIFICATION_DISMISS_RTL, QS_AUTO_ADDED_TILES, SCREENSAVER_ENABLED, Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -1359,7 +1359,7 @@ public class NotificationManagerService extends SystemService { private final Uri NOTIFICATION_BADGING_URI = Settings.Secure.getUriFor(Settings.Secure.NOTIFICATION_BADGING); private final Uri NOTIFICATION_BUBBLES_URI = Settings.Secure.getUriFor(Settings.Global.NOTIFICATION_BUBBLES); = Settings.Secure.getUriFor(Settings.Secure.NOTIFICATION_BUBBLES); private final Uri NOTIFICATION_LIGHT_PULSE_URI = Settings.System.getUriFor(Settings.System.NOTIFICATION_LIGHT_PULSE); private final Uri NOTIFICATION_RATE_LIMIT_URI Loading
services/core/java/com/android/server/notification/PreferencesHelper.java +6 −6 Original line number Diff line number Diff line Loading @@ -1826,9 +1826,9 @@ public class PreferencesHelper implements RankingConfig { for (int index = 0; index < mBubblesEnabled.size(); index++) { int userId = mBubblesEnabled.keyAt(index); final boolean oldValue = mBubblesEnabled.get(userId); final boolean newValue = Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.NOTIFICATION_BUBBLES, DEFAULT_ALLOW_BUBBLE ? 1 : 0) != 0; final boolean newValue = Settings.Secure.getIntForUser(mContext.getContentResolver(), Settings.Secure.NOTIFICATION_BUBBLES, DEFAULT_ALLOW_BUBBLE ? 1 : 0, userId) != 0; mBubblesEnabled.put(userId, newValue); changed |= oldValue != newValue; } Loading @@ -1844,9 +1844,9 @@ public class PreferencesHelper implements RankingConfig { } if (mBubblesEnabled.indexOfKey(userId) < 0) { mBubblesEnabled.put(userId, Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.NOTIFICATION_BUBBLES, DEFAULT_ALLOW_BUBBLE ? 1 : 0) != 0); Settings.Secure.getIntForUser(mContext.getContentResolver(), Settings.Secure.NOTIFICATION_BUBBLES, DEFAULT_ALLOW_BUBBLE ? 1 : 0, userId) != 0); } return mBubblesEnabled.get(userId, DEFAULT_ALLOW_BUBBLE); } Loading
services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java +21 −7 Original line number Diff line number Diff line Loading @@ -58,9 +58,7 @@ import android.net.Uri; import android.os.Build; import android.os.UserHandle; import android.provider.Settings; import android.provider.Settings.Global; import android.provider.Settings.Secure; import android.test.suitebuilder.annotation.SmallTest; import android.testing.TestableContentResolver; import android.util.ArrayMap; Loading Loading @@ -154,7 +152,8 @@ public class PreferencesHelperTest extends UiServiceTestCase { contentResolver.setFallbackToExisting(false); Secure.putIntForUser(contentResolver, Secure.NOTIFICATION_BADGING, 1, UserHandle.getUserId(UID_N_MR1)); Global.putInt(contentResolver, Global.NOTIFICATION_BUBBLES, 1); Secure.putIntForUser(contentResolver, Secure.NOTIFICATION_BUBBLES, 1, UserHandle.getUserId(UID_N_MR1)); ContentProvider testContentProvider = mock(ContentProvider.class); when(testContentProvider.getIContentProvider()).thenReturn(mTestIContentProvider); Loading Loading @@ -1949,16 +1948,18 @@ public class PreferencesHelperTest extends UiServiceTestCase { @Test public void testBubblesOverrideTrue() { Global.putInt(getContext().getContentResolver(), Global.NOTIFICATION_BUBBLES, 1); Secure.putIntForUser(getContext().getContentResolver(), Secure.NOTIFICATION_BUBBLES, 1, USER.getIdentifier()); mHelper.updateBubblesEnabled(); // would be called by settings observer assertTrue(mHelper.bubblesEnabled(USER)); } @Test public void testBubblesOverrideFalse() { Global.putInt(getContext().getContentResolver(), Global.NOTIFICATION_BUBBLES, 0); Secure.putIntForUser(getContext().getContentResolver(), Secure.NOTIFICATION_BUBBLES, 0, USER.getIdentifier()); mHelper.updateBubblesEnabled(); // would be called by settings observer assertFalse(mHelper.bubblesEnabled(USER)); } Loading @@ -1972,6 +1973,19 @@ public class PreferencesHelperTest extends UiServiceTestCase { } } @Test public void testBubblesOverrideUserIsolation() { Secure.putIntForUser(getContext().getContentResolver(), Secure.NOTIFICATION_BUBBLES, 0, USER.getIdentifier()); Secure.putIntForUser(getContext().getContentResolver(), Secure.NOTIFICATION_BUBBLES, 1, USER2.getIdentifier()); mHelper.updateBubblesEnabled(); // would be called by settings observer assertFalse(mHelper.bubblesEnabled(USER)); assertTrue(mHelper.bubblesEnabled(USER2)); } @Test public void testOnLocaleChanged_updatesDefaultChannels() throws Exception { String newLabel = "bananas!"; Loading