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

Commit db5e27a5 authored by Jay Aliomer's avatar Jay Aliomer Committed by Android (Google) Code Review
Browse files

Merge "Dont clear Notifs with FLAG_NO_CLEAR"

parents 796fa1f0 c5f7cfe5
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