diff options
| author | 2016-12-12 08:51:08 -0500 | |
|---|---|---|
| committer | 2016-12-13 13:57:54 +0000 | |
| commit | 19ad7477ce6818bbaf1fe8e143d7d157dd11bddc (patch) | |
| tree | 3a7780dc93e2a983bac620ab963498440b01fe0c | |
| parent | 6ae1332762295a4f2440ac8aa225c823a55383e6 (diff) | |
Cleanup log spam on system notification post.
Bug: 33209911
Test: unplug/replug adb cable, monitor log. runtest systemui-notifications
Change-Id: I294ccdcb0a353463fe0c6b52f1dbbd97f4c75079
3 files changed, 8 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index f58522b52dea..209662613b68 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -3924,7 +3924,7 @@ public class NotificationManagerService extends SystemService { } } - private static boolean isUidSystem(int uid) { + protected static boolean isUidSystem(int uid) { final int appid = UserHandle.getAppId(uid); return (appid == Process.SYSTEM_UID || appid == Process.PHONE_UID || uid == 0); } diff --git a/services/core/java/com/android/server/notification/NotificationRecord.java b/services/core/java/com/android/server/notification/NotificationRecord.java index 4fcc98764ac8..a03c4aa62045 100644 --- a/services/core/java/com/android/server/notification/NotificationRecord.java +++ b/services/core/java/com/android/server/notification/NotificationRecord.java @@ -136,6 +136,12 @@ public final class NotificationRecord { private boolean isPreChannelsNotification() { try { if (NotificationChannel.DEFAULT_CHANNEL_ID.equals(getChannel().getId())) { + final boolean isSystemNotification = + NotificationManagerService.isUidSystem(sbn.getUid()) + || ("android".equals(sbn.getPackageName())); + if (isSystemNotification) { + return false; + } final ApplicationInfo applicationInfo = mContext.getPackageManager().getApplicationInfoAsUser(sbn.getPackageName(), 0, sbn.getUserId()); diff --git a/services/tests/notification/src/com/android/server/notification/NotificationRecordTest.java b/services/tests/notification/src/com/android/server/notification/NotificationRecordTest.java index a7d2c04ecb61..fc94271f8f86 100644 --- a/services/tests/notification/src/com/android/server/notification/NotificationRecordTest.java +++ b/services/tests/notification/src/com/android/server/notification/NotificationRecordTest.java @@ -59,7 +59,7 @@ public class NotificationRecordTest { @Mock PackageManager mPm; private final String pkg = "com.android.server.notification"; - private final int uid = 0; + private final int uid = 9583; private final String pkg2 = "pkg2"; private final int uid2 = 1111111; private final int id1 = 1; |