Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 61913f17 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix sound rate limiting issue" into oc-dr1-dev

parents 29119b6f 65b85cf3
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -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;
    }

+10 −0
Original line number Diff line number Diff line
@@ -830,6 +830,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")