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

Commit d81e5170 authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Don't recommend downranking _HIGH notifications"

parents bcd8465a 98f6e69f
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -45,12 +45,13 @@ public class NotificationCategorizer {
    protected static final int CATEGORY_PEOPLE = 4;
    protected static final int CATEGORY_ALARM = 5;
    protected static final int CATEGORY_CALL = 6;
    protected static final int CATEGORY_HIGH = 7;

    /** @hide */
    @IntDef(prefix = { "CATEGORY_" }, value = {
            CATEGORY_MIN, CATEGORY_EVERYTHING_ELSE, CATEGORY_ONGOING, CATEGORY_CALL,
            CATEGORY_SYSTEM_LOW, CATEGORY_EVENT, CATEGORY_REMINDER, CATEGORY_SYSTEM,
            CATEGORY_PEOPLE, CATEGORY_ALARM
            CATEGORY_PEOPLE, CATEGORY_ALARM, CATEGORY_HIGH
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface Category {}
@@ -96,6 +97,9 @@ public class NotificationCategorizer {
                return CATEGORY_SYSTEM_LOW;
            }
        }
        if (entry.getChannel().getImportance() == IMPORTANCE_HIGH) {
            return CATEGORY_HIGH;
        }
        if (entry.isOngoing()) {
            return CATEGORY_ONGOING;
        }
+10 −0
Original line number Diff line number Diff line
@@ -84,6 +84,16 @@ public class NotificationCategorizerTest {
        assertTrue(nc.shouldSilence(NotificationCategorizer.CATEGORY_MIN));
    }

    @Test
    public void testHigh() {
        NotificationCategorizer nc = new NotificationCategorizer();

        when(mEntry.getChannel()).thenReturn(new NotificationChannel("", "", IMPORTANCE_HIGH));

        assertEquals(NotificationCategorizer.CATEGORY_HIGH, nc.getCategory(mEntry));
        assertFalse(nc.shouldSilence(NotificationCategorizer.CATEGORY_HIGH));
    }

    @Test
    public void testOngoingCategory() {
        NotificationCategorizer nc = new NotificationCategorizer();