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

Commit a47fef1a authored by Iavor-Valentin Iftime's avatar Iavor-Valentin Iftime Committed by Android (Google) Code Review
Browse files

Merge "Only exempt important conversations from notification avalanche" into main

parents f051090a 66763738
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -1540,9 +1540,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
@@ -2363,8 +2363,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