Loading services/core/java/com/android/server/notification/BadgeExtractor.java +3 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,9 @@ public class BadgeExtractor implements NotificationSignalExtractor { if (!appCanShowBadge) { record.setShowBadge(false); } else { record.setShowBadge(record.getChannel().canShowBadge() && appCanShowBadge); record.setShowBadge(mConfig.getNotificationChannel(record.sbn.getPackageName(), record.sbn.getUid(), record.getChannel().getId(), false).canShowBadge() && appCanShowBadge); } return null; Loading services/tests/notification/src/com/android/server/notification/BadgeExtractorTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,7 @@ public class BadgeExtractorTest { when(mConfig.canShowBadge(mPkg, mUid)).thenReturn(true); NotificationChannel channel = new NotificationChannel("a", "a", NotificationManager.IMPORTANCE_UNSPECIFIED); when(mConfig.getNotificationChannel(mPkg, mUid, "a", false)).thenReturn(channel); channel.setShowBadge(false); NotificationRecord r = getNotificationRecord(channel); Loading @@ -107,6 +108,7 @@ public class BadgeExtractorTest { NotificationChannel channel = new NotificationChannel("a", "a", NotificationManager.IMPORTANCE_HIGH); channel.setShowBadge(true); when(mConfig.getNotificationChannel(mPkg, mUid, "a", false)).thenReturn(channel); NotificationRecord r = getNotificationRecord(channel); Loading @@ -124,6 +126,7 @@ public class BadgeExtractorTest { NotificationChannel channel = new NotificationChannel("a", "a", NotificationManager.IMPORTANCE_UNSPECIFIED); channel.setShowBadge(true); when(mConfig.getNotificationChannel(mPkg, mUid, "a", false)).thenReturn(channel); NotificationRecord r = getNotificationRecord(channel); Loading @@ -141,6 +144,7 @@ public class BadgeExtractorTest { NotificationChannel channel = new NotificationChannel("a", "a", NotificationManager.IMPORTANCE_UNSPECIFIED); channel.setShowBadge(false); when(mConfig.getNotificationChannel(mPkg, mUid, "a", false)).thenReturn(channel); NotificationRecord r = getNotificationRecord(channel); Loading Loading
services/core/java/com/android/server/notification/BadgeExtractor.java +3 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,9 @@ public class BadgeExtractor implements NotificationSignalExtractor { if (!appCanShowBadge) { record.setShowBadge(false); } else { record.setShowBadge(record.getChannel().canShowBadge() && appCanShowBadge); record.setShowBadge(mConfig.getNotificationChannel(record.sbn.getPackageName(), record.sbn.getUid(), record.getChannel().getId(), false).canShowBadge() && appCanShowBadge); } return null; Loading
services/tests/notification/src/com/android/server/notification/BadgeExtractorTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,7 @@ public class BadgeExtractorTest { when(mConfig.canShowBadge(mPkg, mUid)).thenReturn(true); NotificationChannel channel = new NotificationChannel("a", "a", NotificationManager.IMPORTANCE_UNSPECIFIED); when(mConfig.getNotificationChannel(mPkg, mUid, "a", false)).thenReturn(channel); channel.setShowBadge(false); NotificationRecord r = getNotificationRecord(channel); Loading @@ -107,6 +108,7 @@ public class BadgeExtractorTest { NotificationChannel channel = new NotificationChannel("a", "a", NotificationManager.IMPORTANCE_HIGH); channel.setShowBadge(true); when(mConfig.getNotificationChannel(mPkg, mUid, "a", false)).thenReturn(channel); NotificationRecord r = getNotificationRecord(channel); Loading @@ -124,6 +126,7 @@ public class BadgeExtractorTest { NotificationChannel channel = new NotificationChannel("a", "a", NotificationManager.IMPORTANCE_UNSPECIFIED); channel.setShowBadge(true); when(mConfig.getNotificationChannel(mPkg, mUid, "a", false)).thenReturn(channel); NotificationRecord r = getNotificationRecord(channel); Loading @@ -141,6 +144,7 @@ public class BadgeExtractorTest { NotificationChannel channel = new NotificationChannel("a", "a", NotificationManager.IMPORTANCE_UNSPECIFIED); channel.setShowBadge(false); when(mConfig.getNotificationChannel(mPkg, mUid, "a", false)).thenReturn(channel); NotificationRecord r = getNotificationRecord(channel); Loading