Loading services/core/java/com/android/server/notification/NotificationManagerService.java +9 −14 Original line number Diff line number Diff line Loading @@ -6625,10 +6625,6 @@ public class NotificationManagerService extends SystemService { || r.getImportance() == IMPORTANCE_NONE)) { // Increase the importance of foreground service notifications unless the user had // an opinion otherwise (and the channel hasn't yet shown a fg service). if (TextUtils.isEmpty(channelId) || NotificationChannel.DEFAULT_CHANNEL_ID.equals(channelId)) { r.setSystemImportance(IMPORTANCE_LOW); } else { channel.setImportance(IMPORTANCE_LOW); r.setSystemImportance(IMPORTANCE_LOW); if (!fgServiceShown) { Loading @@ -6638,7 +6634,6 @@ public class NotificationManagerService extends SystemService { mPreferencesHelper.updateNotificationChannel( pkg, notificationUid, channel, false); r.updateNotificationChannel(channel); } } else if (!fgServiceShown && !TextUtils.isEmpty(channelId) && !NotificationChannel.DEFAULT_CHANNEL_ID.equals(channelId)) { channel.setFgServiceShown(true); Loading services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +5 −5 Original line number Diff line number Diff line Loading @@ -4734,7 +4734,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { } @Test public void testBumpFGImportance_noChannelChangePreOApp() throws Exception { public void testBumpFGImportance_channelChangePreOApp() throws Exception { String preOPkg = PKG_N_MR1; final ApplicationInfo legacy = new ApplicationInfo(); legacy.targetSdkVersion = Build.VERSION_CODES.N_MR1; Loading @@ -4752,7 +4752,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { .setPriority(Notification.PRIORITY_MIN); StatusBarNotification sbn = new StatusBarNotification(preOPkg, preOPkg, 9, "testBumpFGImportance_noChannelChangePreOApp", "testBumpFGImportance_channelChangePreOApp", Binder.getCallingUid(), 0, nb.build(), UserHandle.getUserHandleForUid(Binder.getCallingUid()), null, 0); Loading @@ -4772,11 +4772,11 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { .setPriority(Notification.PRIORITY_MIN); sbn = new StatusBarNotification(preOPkg, preOPkg, 9, "testBumpFGImportance_noChannelChangePreOApp", Binder.getCallingUid(), "testBumpFGImportance_channelChangePreOApp", Binder.getCallingUid(), 0, nb.build(), UserHandle.getUserHandleForUid(Binder.getCallingUid()), null, 0); mBinderService.enqueueNotificationWithTag(preOPkg, preOPkg, "testBumpFGImportance_noChannelChangePreOApp", "testBumpFGImportance_channelChangePreOApp", sbn.getId(), sbn.getNotification(), sbn.getUserId()); waitForIdle(); assertEquals(IMPORTANCE_LOW, Loading @@ -4784,7 +4784,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { NotificationChannel defaultChannel = mBinderService.getNotificationChannel( preOPkg, mContext.getUserId(), preOPkg, NotificationChannel.DEFAULT_CHANNEL_ID); assertEquals(IMPORTANCE_UNSPECIFIED, defaultChannel.getImportance()); assertEquals(IMPORTANCE_LOW, defaultChannel.getImportance()); } @Test Loading Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +9 −14 Original line number Diff line number Diff line Loading @@ -6625,10 +6625,6 @@ public class NotificationManagerService extends SystemService { || r.getImportance() == IMPORTANCE_NONE)) { // Increase the importance of foreground service notifications unless the user had // an opinion otherwise (and the channel hasn't yet shown a fg service). if (TextUtils.isEmpty(channelId) || NotificationChannel.DEFAULT_CHANNEL_ID.equals(channelId)) { r.setSystemImportance(IMPORTANCE_LOW); } else { channel.setImportance(IMPORTANCE_LOW); r.setSystemImportance(IMPORTANCE_LOW); if (!fgServiceShown) { Loading @@ -6638,7 +6634,6 @@ public class NotificationManagerService extends SystemService { mPreferencesHelper.updateNotificationChannel( pkg, notificationUid, channel, false); r.updateNotificationChannel(channel); } } else if (!fgServiceShown && !TextUtils.isEmpty(channelId) && !NotificationChannel.DEFAULT_CHANNEL_ID.equals(channelId)) { channel.setFgServiceShown(true); Loading
services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +5 −5 Original line number Diff line number Diff line Loading @@ -4734,7 +4734,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { } @Test public void testBumpFGImportance_noChannelChangePreOApp() throws Exception { public void testBumpFGImportance_channelChangePreOApp() throws Exception { String preOPkg = PKG_N_MR1; final ApplicationInfo legacy = new ApplicationInfo(); legacy.targetSdkVersion = Build.VERSION_CODES.N_MR1; Loading @@ -4752,7 +4752,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { .setPriority(Notification.PRIORITY_MIN); StatusBarNotification sbn = new StatusBarNotification(preOPkg, preOPkg, 9, "testBumpFGImportance_noChannelChangePreOApp", "testBumpFGImportance_channelChangePreOApp", Binder.getCallingUid(), 0, nb.build(), UserHandle.getUserHandleForUid(Binder.getCallingUid()), null, 0); Loading @@ -4772,11 +4772,11 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { .setPriority(Notification.PRIORITY_MIN); sbn = new StatusBarNotification(preOPkg, preOPkg, 9, "testBumpFGImportance_noChannelChangePreOApp", Binder.getCallingUid(), "testBumpFGImportance_channelChangePreOApp", Binder.getCallingUid(), 0, nb.build(), UserHandle.getUserHandleForUid(Binder.getCallingUid()), null, 0); mBinderService.enqueueNotificationWithTag(preOPkg, preOPkg, "testBumpFGImportance_noChannelChangePreOApp", "testBumpFGImportance_channelChangePreOApp", sbn.getId(), sbn.getNotification(), sbn.getUserId()); waitForIdle(); assertEquals(IMPORTANCE_LOW, Loading @@ -4784,7 +4784,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { NotificationChannel defaultChannel = mBinderService.getNotificationChannel( preOPkg, mContext.getUserId(), preOPkg, NotificationChannel.DEFAULT_CHANNEL_ID); assertEquals(IMPORTANCE_UNSPECIFIED, defaultChannel.getImportance()); assertEquals(IMPORTANCE_LOW, defaultChannel.getImportance()); } @Test Loading