diff options
| author | 2017-07-20 18:04:02 +0000 | |
|---|---|---|
| committer | 2017-07-20 18:04:02 +0000 | |
| commit | 61913f178ed35e5f9f8b91f4c1e9f986ab39c83e (patch) | |
| tree | 9e2204b9588cc056279a8910f058dd3b18cc80a0 | |
| parent | 29119b6f5f497f9ea23662eca752a15f62768e3e (diff) | |
| parent | 65b85cf3a2f83729d7657e81bb001b0656a3c532 (diff) | |
Merge "Fix sound rate limiting issue" into oc-dr1-dev
| -rw-r--r-- | services/core/java/com/android/server/notification/NotificationManagerService.java | 14 | ||||
| -rw-r--r-- | services/tests/notification/src/com/android/server/notification/BuzzBeepBlinkTest.java | 10 |
2 files changed, 17 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 1f684aa1770d..5a8ebc2cc5c9 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -3828,13 +3828,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) { @@ -3852,6 +3845,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 807703b95a63..b02312661ab6 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 { } @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") .setSmallIcon(android.R.drawable.sym_def_app_icon).build(); |