Merge "Merge "Hide overlay notification" into pi-dev am: b88b9640cb" into pi-dev-plus-aosp

This commit is contained in:
Android Build Merger (Role)
2018-03-07 01:00:37 +00:00
committed by Android (Google) Code Review
2 changed files with 16 additions and 4 deletions

View File

@@ -23,6 +23,7 @@ import android.service.notification.StatusBarNotification;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.Log;
import android.util.Slog;
import android.util.SparseArray;
import com.android.internal.messages.nano.SystemMessageProto;
@@ -174,9 +175,9 @@ public class ForegroundServiceControllerImpl
@Override
public boolean isSystemAlertNotification(StatusBarNotification sbn) {
// TODO: tag system alert notifications so they can be suppressed if app's notification
// is tagged
return false;
return sbn.getPackageName().equals("android")
&& sbn.getTag() != null
&& sbn.getTag().contains("AlertWindowNotification");
}
/**

View File

@@ -368,6 +368,17 @@ public class ForegroundServiceControllerTest extends SysuiTestCase {
assertFalse(fsc.isDungeonNeededForUser(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(fsc.isSystemAlertNotification(sbn_user1_overlay));
assertFalse(fsc.isSystemAlertNotification(sbn_user1_app1));
}
@Test
public void testStdLayoutBasic() {
final String PKG1 = "com.example.app0";
@@ -439,7 +450,7 @@ public class ForegroundServiceControllerTest extends SysuiTestCase {
when(sbn.getNotification()).thenReturn(n);
when(sbn.getId()).thenReturn(id);
when(sbn.getPackageName()).thenReturn(pkg);
when(sbn.getTag()).thenReturn(null);
when(sbn.getTag()).thenReturn(tag);
when(sbn.getUserId()).thenReturn(userid);
when(sbn.getUser()).thenReturn(new UserHandle(userid));
when(sbn.getKey()).thenReturn("MOCK:"+userid+"|"+pkg+"|"+id+"|"+tag);