Loading services/core/java/com/android/server/notification/NotificationManagerService.java +2 −1 Original line number Diff line number Diff line Loading @@ -2863,7 +2863,8 @@ public class NotificationManagerService extends SystemService { // Reset notification preferences if (!fromApp) { mPreferencesHelper.clearData(packageName, uid); mPreferencesHelper.onPackagesChanged( true, UserHandle.getCallingUserId(), packages, uids); } handleSavePolicyFile(); Loading services/core/java/com/android/server/notification/PreferencesHelper.java +0 −16 Original line number Diff line number Diff line Loading @@ -1717,22 +1717,6 @@ public class PreferencesHelper implements RankingConfig { } } public void clearData(String pkg, int uid) { synchronized (mPackagePreferences) { PackagePreferences p = getPackagePreferencesLocked(pkg, uid); p.channels = new ArrayMap<>(); p.groups = new ArrayMap<>(); p.delegate = null; p.lockedAppFields = DEFAULT_LOCKED_APP_FIELDS; p.allowBubble = DEFAULT_ALLOW_BUBBLE; p.importance = DEFAULT_IMPORTANCE; p.priority = DEFAULT_PRIORITY; p.visibility = DEFAULT_VISIBILITY; p.showBadge = DEFAULT_SHOW_BADGE; } } private LogMaker getChannelLog(NotificationChannel channel, String pkg) { return new LogMaker( com.android.internal.logging.nano.MetricsProto.MetricsEvent Loading services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java +0 −32 Original line number Diff line number Diff line Loading @@ -1643,38 +1643,6 @@ public class PreferencesHelperTest extends UiServiceTestCase { PKG_O, UID_O, NotificationChannel.DEFAULT_CHANNEL_ID, false)); } @Test public void testClearData() { ArraySet<String> pkg = new ArraySet<>(); pkg.add(PKG_O); mHelper.createNotificationChannel(PKG_O, UID_O, getChannel(), true, false); mHelper.createNotificationChannelGroup( PKG_O, UID_O, new NotificationChannelGroup("1", "bye"), true); mHelper.lockChannelsForOEM(pkg.toArray(new String[]{})); mHelper.updateDefaultApps(UserHandle.getUserId(UID_O), null, pkg); mHelper.setNotificationDelegate(PKG_O, UID_O, "", 1); mHelper.setImportance(PKG_O, UID_O, IMPORTANCE_NONE); mHelper.setBubblesAllowed(PKG_O, UID_O, false); mHelper.setShowBadge(PKG_O, UID_O, false); mHelper.setAppImportanceLocked(PKG_O, UID_O); mHelper.clearData(PKG_O, UID_O); assertEquals(IMPORTANCE_UNSPECIFIED, mHelper.getImportance(PKG_O, UID_O)); assertTrue(mHelper.areBubblesAllowed(PKG_O, UID_O)); assertTrue(mHelper.canShowBadge(PKG_O, UID_O)); assertNull(mHelper.getNotificationDelegate(PKG_O, UID_O)); assertEquals(0, mHelper.getAppLockedFields(PKG_O, UID_O)); assertEquals(0, mHelper.getNotificationChannels(PKG_O, UID_O, true).getList().size()); assertEquals(0, mHelper.getNotificationChannelGroups(PKG_O, UID_O).size()); NotificationChannel channel = getChannel(); mHelper.createNotificationChannel(PKG_O, UID_O, channel, true, false); assertTrue(channel.isImportanceLockedByCriticalDeviceFunction()); assertTrue(channel.isImportanceLockedByOEM()); } @Test public void testRecordDefaults() throws Exception { assertEquals(NotificationManager.IMPORTANCE_UNSPECIFIED, mHelper.getImportance(PKG_N_MR1, Loading Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +2 −1 Original line number Diff line number Diff line Loading @@ -2863,7 +2863,8 @@ public class NotificationManagerService extends SystemService { // Reset notification preferences if (!fromApp) { mPreferencesHelper.clearData(packageName, uid); mPreferencesHelper.onPackagesChanged( true, UserHandle.getCallingUserId(), packages, uids); } handleSavePolicyFile(); Loading
services/core/java/com/android/server/notification/PreferencesHelper.java +0 −16 Original line number Diff line number Diff line Loading @@ -1717,22 +1717,6 @@ public class PreferencesHelper implements RankingConfig { } } public void clearData(String pkg, int uid) { synchronized (mPackagePreferences) { PackagePreferences p = getPackagePreferencesLocked(pkg, uid); p.channels = new ArrayMap<>(); p.groups = new ArrayMap<>(); p.delegate = null; p.lockedAppFields = DEFAULT_LOCKED_APP_FIELDS; p.allowBubble = DEFAULT_ALLOW_BUBBLE; p.importance = DEFAULT_IMPORTANCE; p.priority = DEFAULT_PRIORITY; p.visibility = DEFAULT_VISIBILITY; p.showBadge = DEFAULT_SHOW_BADGE; } } private LogMaker getChannelLog(NotificationChannel channel, String pkg) { return new LogMaker( com.android.internal.logging.nano.MetricsProto.MetricsEvent Loading
services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java +0 −32 Original line number Diff line number Diff line Loading @@ -1643,38 +1643,6 @@ public class PreferencesHelperTest extends UiServiceTestCase { PKG_O, UID_O, NotificationChannel.DEFAULT_CHANNEL_ID, false)); } @Test public void testClearData() { ArraySet<String> pkg = new ArraySet<>(); pkg.add(PKG_O); mHelper.createNotificationChannel(PKG_O, UID_O, getChannel(), true, false); mHelper.createNotificationChannelGroup( PKG_O, UID_O, new NotificationChannelGroup("1", "bye"), true); mHelper.lockChannelsForOEM(pkg.toArray(new String[]{})); mHelper.updateDefaultApps(UserHandle.getUserId(UID_O), null, pkg); mHelper.setNotificationDelegate(PKG_O, UID_O, "", 1); mHelper.setImportance(PKG_O, UID_O, IMPORTANCE_NONE); mHelper.setBubblesAllowed(PKG_O, UID_O, false); mHelper.setShowBadge(PKG_O, UID_O, false); mHelper.setAppImportanceLocked(PKG_O, UID_O); mHelper.clearData(PKG_O, UID_O); assertEquals(IMPORTANCE_UNSPECIFIED, mHelper.getImportance(PKG_O, UID_O)); assertTrue(mHelper.areBubblesAllowed(PKG_O, UID_O)); assertTrue(mHelper.canShowBadge(PKG_O, UID_O)); assertNull(mHelper.getNotificationDelegate(PKG_O, UID_O)); assertEquals(0, mHelper.getAppLockedFields(PKG_O, UID_O)); assertEquals(0, mHelper.getNotificationChannels(PKG_O, UID_O, true).getList().size()); assertEquals(0, mHelper.getNotificationChannelGroups(PKG_O, UID_O).size()); NotificationChannel channel = getChannel(); mHelper.createNotificationChannel(PKG_O, UID_O, channel, true, false); assertTrue(channel.isImportanceLockedByCriticalDeviceFunction()); assertTrue(channel.isImportanceLockedByOEM()); } @Test public void testRecordDefaults() throws Exception { assertEquals(NotificationManager.IMPORTANCE_UNSPECIFIED, mHelper.getImportance(PKG_N_MR1, Loading