diff options
| author | 2019-02-06 18:34:12 +0000 | |
|---|---|---|
| committer | 2019-02-06 18:34:12 +0000 | |
| commit | 418336afb68df70a8d59174ca8fb12ee97c1035c (patch) | |
| tree | 94fcc270ef927e98b680ad57edf7ea8b063df21b | |
| parent | 7e2115dc08f6b82c5fe886bede7bbdd6e1f39a1c (diff) | |
| parent | 11e085ad95b0c7e71737f43799e7cb32d965d9e4 (diff) | |
Merge "Exempt more notifications from heuristic"
2 files changed, 8 insertions, 6 deletions
diff --git a/packages/ExtServices/src/android/ext/services/notification/NotificationCategorizer.java b/packages/ExtServices/src/android/ext/services/notification/NotificationCategorizer.java index 7ba0f7ac1d30..f95891cc8962 100644 --- a/packages/ExtServices/src/android/ext/services/notification/NotificationCategorizer.java +++ b/packages/ExtServices/src/android/ext/services/notification/NotificationCategorizer.java @@ -15,6 +15,7 @@ */ package android.ext.services.notification; +import static android.app.NotificationManager.IMPORTANCE_DEFAULT; import static android.app.NotificationManager.IMPORTANCE_HIGH; import static android.app.NotificationManager.IMPORTANCE_MIN; @@ -91,7 +92,7 @@ public class NotificationCategorizer { } // TODO: is from signature app if (entry.getSbn().getUid() < Process.FIRST_APPLICATION_UID) { - if (entry.getImportance() >= IMPORTANCE_HIGH) { + if (entry.getImportance() >= IMPORTANCE_DEFAULT) { return CATEGORY_SYSTEM; } else { return CATEGORY_SYSTEM_LOW; diff --git a/packages/ExtServices/tests/src/android/ext/services/notification/NotificationCategorizerTest.java b/packages/ExtServices/tests/src/android/ext/services/notification/NotificationCategorizerTest.java index c59885e9f4d2..05af6e7a7b71 100644 --- a/packages/ExtServices/tests/src/android/ext/services/notification/NotificationCategorizerTest.java +++ b/packages/ExtServices/tests/src/android/ext/services/notification/NotificationCategorizerTest.java @@ -18,6 +18,7 @@ package android.ext.services.notification; import static android.app.NotificationManager.IMPORTANCE_DEFAULT; import static android.app.NotificationManager.IMPORTANCE_HIGH; +import static android.app.NotificationManager.IMPORTANCE_LOW; import static android.app.NotificationManager.IMPORTANCE_MIN; import static android.os.Process.FIRST_APPLICATION_UID; @@ -172,23 +173,23 @@ public class NotificationCategorizerTest { public void testSystemCategory() { NotificationCategorizer nc = new NotificationCategorizer(); - when(mEntry.getChannel()).thenReturn(new NotificationChannel("", "", IMPORTANCE_HIGH)); - when(mEntry.getImportance()).thenReturn(IMPORTANCE_HIGH); + when(mEntry.getChannel()).thenReturn(new NotificationChannel("", "", IMPORTANCE_DEFAULT)); + when(mEntry.getImportance()).thenReturn(IMPORTANCE_DEFAULT); when(mSbn.getUid()).thenReturn(FIRST_APPLICATION_UID - 1); assertEquals(NotificationCategorizer.CATEGORY_SYSTEM, nc.getCategory(mEntry)); assertFalse(nc.shouldSilence(NotificationCategorizer.CATEGORY_SYSTEM)); when(mSbn.getUid()).thenReturn(FIRST_APPLICATION_UID); - assertEquals(NotificationCategorizer.CATEGORY_HIGH, nc.getCategory(mEntry)); + assertEquals(NotificationCategorizer.CATEGORY_EVERYTHING_ELSE, nc.getCategory(mEntry)); } @Test public void testSystemLowCategory() { NotificationCategorizer nc = new NotificationCategorizer(); - when(mEntry.getChannel()).thenReturn(new NotificationChannel("", "", IMPORTANCE_DEFAULT)); - when(mEntry.getImportance()).thenReturn(IMPORTANCE_DEFAULT); + when(mEntry.getChannel()).thenReturn(new NotificationChannel("", "", IMPORTANCE_LOW)); + when(mEntry.getImportance()).thenReturn(IMPORTANCE_LOW); when(mSbn.getUid()).thenReturn(FIRST_APPLICATION_UID - 1); assertEquals(NotificationCategorizer.CATEGORY_SYSTEM_LOW, nc.getCategory(mEntry)); |