Bring back the SAW notification
The SAW privacy indicator is no longer shown on notification templates, so we should always show the system SAW alert notification Test: SystemUiTests Fixes: 168297179 Change-Id: Ife18aea49fd963beee1f5c16627f785fac2a113f
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user