Merge "Don't recommend downranking _HIGH notifications"
This commit is contained in:
committed by
Android (Google) Code Review
commit
d81e517057
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user