diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationFilter.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationFilter.java index 73c7fd1b64a3f..f21771a89c9e3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationFilter.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationFilter.java @@ -128,15 +128,6 @@ public class NotificationFilter { // this is a foreground-service disclosure for a user that does not need to show one return true; } - if (getFsc().isSystemAlertNotification(sbn)) { - final String[] apps = sbn.getNotification().extras.getStringArray( - Notification.EXTRA_FOREGROUND_APPS); - if (apps != null && apps.length >= 1) { - if (!getFsc().isSystemAlertWarningNeeded(sbn.getUserId(), apps[0])) { - return true; - } - } - } if (mIsMediaFlagEnabled && isMediaNotification(sbn)) { return true; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/AppOpsCoordinator.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/AppOpsCoordinator.java index 998ae9e553134..3a87f6853bcf5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/AppOpsCoordinator.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/AppOpsCoordinator.java @@ -95,18 +95,6 @@ public class AppOpsCoordinator implements Coordinator { sbn.getUser().getIdentifier())) { return true; } - - // Filters out system alert notifications when unneeded - if (mForegroundServiceController.isSystemAlertNotification(sbn)) { - final String[] apps = sbn.getNotification().extras.getStringArray( - Notification.EXTRA_FOREGROUND_APPS); - if (apps != null && apps.length >= 1) { - if (!mForegroundServiceController.isSystemAlertWarningNeeded( - sbn.getUser().getIdentifier(), apps[0])) { - return true; - } - } - } return false; } }; diff --git a/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java index 6c3b37edbd15f..ba21afdfab0f1 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java @@ -308,17 +308,6 @@ public class ForegroundServiceControllerTest extends SysuiTestCase { assertFalse(mFsc.isDisclosureNeededForUser(USERID_TWO)); } - @Test - public void testOverlayPredicate() { - StatusBarNotification sbn_user1_app1 = makeMockSBN(USERID_ONE, "com.example.app1", - 5000, "monkeys", Notification.FLAG_AUTO_CANCEL); - StatusBarNotification sbn_user1_overlay = makeMockSBN(USERID_ONE, "android", - 0, "AlertWindowNotification", Notification.FLAG_NO_CLEAR); - - assertTrue(mFsc.isSystemAlertNotification(sbn_user1_overlay)); - assertFalse(mFsc.isSystemAlertNotification(sbn_user1_app1)); - } - @Test public void testNoNotifsNorAppOps_noSystemAlertWarningRequired() { // no notifications nor app op signals that this package/userId requires system alert diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java index 05cf33a3729c6..b493b9a6bd65a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java @@ -170,63 +170,11 @@ public class NotificationFilterTest extends SysuiTestCase { mMockStatusBarNotification)); } - @Test - public void testSuppressSystemAlertNotification() { - when(mFsc.isSystemAlertWarningNeeded(anyInt(), anyString())).thenReturn(false); - when(mFsc.isSystemAlertNotification(any())).thenReturn(true); - StatusBarNotification sbn = mRow.getEntry().getSbn(); - Bundle bundle = new Bundle(); - bundle.putStringArray(Notification.EXTRA_FOREGROUND_APPS, new String[]{"something"}); - sbn.getNotification().extras = bundle; - - assertTrue(mNotificationFilter.shouldFilterOut(mRow.getEntry())); - } - - @Test - public void testDoNotSuppressSystemAlertNotification() { - StatusBarNotification sbn = mRow.getEntry().getSbn(); - Bundle bundle = new Bundle(); - bundle.putStringArray(Notification.EXTRA_FOREGROUND_APPS, new String[]{"something"}); - sbn.getNotification().extras = bundle; - - when(mFsc.isSystemAlertWarningNeeded(anyInt(), anyString())).thenReturn(true); - when(mFsc.isSystemAlertNotification(any())).thenReturn(true); - - assertFalse(mNotificationFilter.shouldFilterOut(mRow.getEntry())); - - when(mFsc.isSystemAlertWarningNeeded(anyInt(), anyString())).thenReturn(true); - when(mFsc.isSystemAlertNotification(any())).thenReturn(false); - - assertFalse(mNotificationFilter.shouldFilterOut(mRow.getEntry())); - - when(mFsc.isSystemAlertWarningNeeded(anyInt(), anyString())).thenReturn(false); - when(mFsc.isSystemAlertNotification(any())).thenReturn(false); - - assertFalse(mNotificationFilter.shouldFilterOut(mRow.getEntry())); - } - - @Test - public void testDoNotSuppressMalformedSystemAlertNotification() { - when(mFsc.isSystemAlertWarningNeeded(anyInt(), anyString())).thenReturn(true); - - // missing extra - assertFalse(mNotificationFilter.shouldFilterOut(mRow.getEntry())); - - StatusBarNotification sbn = mRow.getEntry().getSbn(); - Bundle bundle = new Bundle(); - bundle.putStringArray(Notification.EXTRA_FOREGROUND_APPS, new String[]{}); - sbn.getNotification().extras = bundle; - - // extra missing values - assertFalse(mNotificationFilter.shouldFilterOut(mRow.getEntry())); - } - @Test public void testShouldFilterHiddenNotifications() { initStatusBarNotification(false); // setup when(mFsc.isSystemAlertWarningNeeded(anyInt(), anyString())).thenReturn(false); - when(mFsc.isSystemAlertNotification(any())).thenReturn(false); // test should filter out hidden notifications: // hidden diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/AppOpsCoordinatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/AppOpsCoordinatorTest.java index 09546216183f3..278456859735c 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/AppOpsCoordinatorTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/AppOpsCoordinatorTest.java @@ -114,41 +114,6 @@ public class AppOpsCoordinatorTest extends SysuiTestCase { assertTrue(mForegroundFilter.shouldFilterOut(entry, 0)); } - @Test - public void filterTest_systemAlertNotificationUnnecessary() { - // GIVEN the alert notification isn't needed for this user - final Bundle extras = new Bundle(); - extras.putStringArray(Notification.EXTRA_FOREGROUND_APPS, - new String[]{TEST_PKG}); - mEntryBuilder.modifyNotification(mContext) - .setExtras(extras); - NotificationEntry entry = mEntryBuilder.build(); - StatusBarNotification sbn = entry.getSbn(); - when(mForegroundServiceController.isSystemAlertWarningNeeded(sbn.getUserId(), TEST_PKG)) - .thenReturn(false); - - // GIVEN the notification is a system alert notification + not a disclosure notification - when(mForegroundServiceController.isSystemAlertNotification(sbn)).thenReturn(true); - when(mForegroundServiceController.isDisclosureNotification(sbn)).thenReturn(false); - - - // THEN filter out the notification - assertTrue(mForegroundFilter.shouldFilterOut(entry, 0)); - } - - @Test - public void filterTest_doNotFilter() { - NotificationEntry entry = mEntryBuilder.build(); - StatusBarNotification sbn = entry.getSbn(); - - // GIVEN the notification isn't a system alert notification nor a disclosure notification - when(mForegroundServiceController.isSystemAlertNotification(sbn)).thenReturn(false); - when(mForegroundServiceController.isDisclosureNotification(sbn)).thenReturn(false); - - // THEN don't filter out the notification - assertFalse(mForegroundFilter.shouldFilterOut(entry, 0)); - } - @Test public void testIncludeFGSInSection_importanceDefault() { // GIVEN the notification represents a colorized foreground service with > min importance