Merge "Fix sound rate limiting issue" into oc-dr1-dev am: 61913f178e am: 3f0eb37e66

am: 7c120d9cf0

Change-Id: I95f28b31387e0bc3e801420ec6cf5ef2a23111cf
This commit is contained in:
Julia Reynolds
2017-07-20 18:44:07 +00:00
committed by android-build-merger
2 changed files with 17 additions and 7 deletions

View File

@@ -4024,13 +4024,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) {
@@ -4048,6 +4041,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;
}

View File

@@ -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")