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

Commit 66763738 authored by Valentin Iftime's avatar Valentin Iftime
Browse files

Only exempt important conversations from notification avalanche

 Exempt only 'important conversations', not IMPORTANCE_HIGH notifications
 from being muted during the notification avalanche.

Flag: com.android.server.notification.polite_notifications_attn_update
Test: atest NotificationAttentionHelperTest
Bug: 341291320
Change-Id: I9020b6d1bdf98dca20f42a186e18a49af399027f
parent 8abd377b
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -1500,9 +1500,7 @@ public final class NotificationAttentionHelper {

        private boolean isAvalancheExemptedFullVolume(final NotificationRecord record) {
            // important conversation
            if (record.isConversation()
                    && (record.getImportance() > NotificationManager.IMPORTANCE_DEFAULT
                    || record.getChannel().isImportantConversation())) {
            if (record.isConversation() && record.getChannel().isImportantConversation()) {
                return true;
            }

+14 −2
Original line number Diff line number Diff line
@@ -2298,8 +2298,20 @@ public class NotificationAttentionHelperTest extends UiServiceTestCase {
        mAttentionHelper.buzzBeepBlinkLocked(r4, DEFAULT_SIGNALS);
        verifyBeepVolume(0.5f);

        verify(mAccessibilityService, times(4)).sendAccessibilityEvent(any(), anyInt());
        assertNotEquals(-1, r4.getLastAudiblyAlertedMs());
        // Set important conversation
        mChannel.setImportantConversation(true);
        NotificationRecord r5 = getConversationNotificationRecord(mId, false /* insistent */,
                false /* once */, true /* noisy */, false /* buzzy*/, false /* lights */, true,
                true, false, null, Notification.GROUP_ALERT_ALL, false, mUser, "yetAnotherPkg",
                "shortcut");

        // important conversation should beep at 100% volume
        Mockito.reset(mRingtonePlayer);
        mAttentionHelper.buzzBeepBlinkLocked(r5, DEFAULT_SIGNALS);
        verifyBeepVolume(1.0f);

        verify(mAccessibilityService, times(5)).sendAccessibilityEvent(any(), anyInt());
        assertNotEquals(-1, r5.getLastAudiblyAlertedMs());
    }

    @Test