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

Commit c5f7cfe5 authored by Jay Aliomer's avatar Jay Aliomer
Browse files

Dont clear Notifs with FLAG_NO_CLEAR

Fixes: 206842750
Test: NotifCollectionTest
Change-Id: Ic43e605560e2d158e72dce070e92d1ffc08b0d96
parent ca5641d3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,6 @@ import android.service.notification.NotificationListenerService.RankingMap;
import android.service.notification.StatusBarNotification;
import android.util.ArrayMap;
import android.util.Pair;
import android.util.Slog;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -756,6 +755,7 @@ public class NotifCollection implements Dumpable {
                && !entry.getSbn().getNotification().isGroupSummary()
                && !hasFlag(entry, Notification.FLAG_ONGOING_EVENT)
                && !hasFlag(entry, Notification.FLAG_BUBBLE)
                && !hasFlag(entry, Notification.FLAG_NO_CLEAR)
                && entry.getDismissState() != DISMISSED;
    }

+12 −0
Original line number Diff line number Diff line
@@ -1468,6 +1468,18 @@ public class NotifCollectionTest extends SysuiTestCase {
                container, container.getSbn().getGroupKey()));
    }

    @Test
    public void testCannotDismissNoClearNotifications() {
        // GIVEN an no-clear notification
        final NotificationEntry container = new NotificationEntryBuilder()
                .setFlag(mContext, FLAG_NO_CLEAR, true)
                .build();

        // THEN its children are not dismissible
        assertFalse(mCollection.shouldAutoDismissChildren(
                container, container.getSbn().getGroupKey()));
    }

    @Test
    public void testCanDismissFgsNotificationChildren() {
        // GIVEN an FGS but not ongoing notification