diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 6a101139ec287..c04124a4b8a0e 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -4011,13 +4011,6 @@ public class NotificationManagerService extends SystemService { return true; } - // Suppressed for being too recently noisy - final String pkg = record.sbn.getPackageName(); - if (mUsageStats.isAlertRateLimited(pkg)) { - Slog.e(TAG, "Muting recently noisy " + record.getKey()); - return true; - } - // muted by listener final String disableEffects = disableNotificationEffects(record); if (disableEffects != null) { @@ -4035,6 +4028,13 @@ public class NotificationManagerService extends SystemService { return notification.suppressAlertingDueToGrouping(); } + // Suppressed for being too recently noisy + final String pkg = record.sbn.getPackageName(); + if (mUsageStats.isAlertRateLimited(pkg)) { + Slog.e(TAG, "Muting recently noisy " + record.getKey()); + return true; + } + return false; } diff --git a/services/tests/notification/src/com/android/server/notification/BuzzBeepBlinkTest.java b/services/tests/notification/src/com/android/server/notification/BuzzBeepBlinkTest.java index f7d2a0227e2a0..835603a9228ba 100644 --- a/services/tests/notification/src/com/android/server/notification/BuzzBeepBlinkTest.java +++ b/services/tests/notification/src/com/android/server/notification/BuzzBeepBlinkTest.java @@ -831,6 +831,16 @@ public class BuzzBeepBlinkTest extends NotificationTestCase { verify(mUsageStats, never()).isAlertRateLimited(any()); } + @Test + public void testPostingGroupSuppressedDoesNotAffectRateLimiting() throws Exception { + NotificationRecord summary = getBeepyNotificationRecord("a", GROUP_ALERT_CHILDREN); + summary.getNotification().flags |= Notification.FLAG_GROUP_SUMMARY; + + mService.buzzBeepBlinkLocked(summary); + + verify(mUsageStats, never()).isAlertRateLimited(any()); + } + @Test public void testCrossUserSoundMuted() throws Exception { final Notification n = new Builder(getContext(), "test")