From a5d2f235add2b8c1e4199918b5fc18040e8af434 Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Fri, 24 Feb 2017 14:43:01 -0500 Subject: [PATCH] Send ranking update on channel update. Change-Id: I26aca0f27df0fca549d863ed6a5fac2c5b025907 Fixes: 35623384 Test: manual, runtest systemui-notification --- .../core/java/com/android/server/notification/BadgeExtractor.java | 4 +++- .../src/com/android/server/notification/BadgeExtractorTest.java | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/notification/BadgeExtractor.java b/services/core/java/com/android/server/notification/BadgeExtractor.java index 4795fbf0ba3c..e6edaf1d3079 100644 --- a/services/core/java/com/android/server/notification/BadgeExtractor.java +++ b/services/core/java/com/android/server/notification/BadgeExtractor.java @@ -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; diff --git a/services/tests/notification/src/com/android/server/notification/BadgeExtractorTest.java b/services/tests/notification/src/com/android/server/notification/BadgeExtractorTest.java index b26bac3188eb..0cf4994ebbce 100644 --- a/services/tests/notification/src/com/android/server/notification/BadgeExtractorTest.java +++ b/services/tests/notification/src/com/android/server/notification/BadgeExtractorTest.java @@ -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); @@ -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); @@ -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); @@ -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); -- 2.11.0