diff options
5 files changed, 0 insertions, 119 deletions
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 73c7fd1b64a3..f21771a89c9e 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 998ae9e55313..3a87f6853bcf 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 6c3b37edbd15..ba21afdfab0f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java @@ -309,17 +309,6 @@ public class ForegroundServiceControllerTest extends SysuiTestCase {      }      @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          // warning 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 05cf33a3729c..b493b9a6bd65 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 @@ -171,62 +171,10 @@ public class NotificationFilterTest extends SysuiTestCase {      }      @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 09546216183f..278456859735 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 @@ -115,41 +115,6 @@ public class AppOpsCoordinatorTest extends SysuiTestCase {      }      @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          mEntryBuilder  |