Loading services/core/java/com/android/server/EventLogTags.logtags +1 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ option java_package com.android.server # NotificationManagerService.java # --------------------------- # when a NotificationManager.notify is called. status: 0=post, 1=update, 2=ignored 2750 notification_enqueue (uid|1|5),(pid|1|5),(pkg|3),(id|1|5),(tag|3),(userid|1|5),(notification|3),(status|1) 2750 notification_enqueue (uid|1|5),(pid|1|5),(pkg|3),(id|1|5),(tag|3),(userid|1|5),(notification|3),(status|1),(app_provided|1) # when someone tries to cancel a notification, the notification manager sometimes # calls this with flags too 2751 notification_cancel (uid|1|5),(pid|1|5),(pkg|3),(id|1|5),(tag|3),(userid|1|5),(required_flags|1),(forbidden_flags|1),(reason|1|5),(listener|3) Loading services/core/java/com/android/server/notification/NotificationManagerService.java +27 −18 Original line number Diff line number Diff line Loading @@ -1033,7 +1033,7 @@ public class NotificationManagerService extends SystemService { summary.getSbn().getNotification().color = summaryAttr.iconColor; summary.getSbn().getNotification().visibility = summaryAttr.visibility; mHandler.post(new EnqueueNotificationRunnable(userId, summary, isAppForeground, mPostNotificationTrackerFactory.newTracker(null))); /* isAppProvided= */ false, mPostNotificationTrackerFactory.newTracker(null))); } } Loading Loading @@ -1660,7 +1660,7 @@ public class NotificationManagerService extends SystemService { // Force isAppForeground true here, because for sysui's purposes we // want to adjust the flag behaviour. mHandler.post(new EnqueueNotificationRunnable(r.getUser().getIdentifier(), r, true /* isAppForeground*/, r, /* isAppForeground= */ true , /* isAppProvided= */ false, mPostNotificationTrackerFactory.newTracker(null))); } } Loading Loading @@ -1691,7 +1691,7 @@ public class NotificationManagerService extends SystemService { // want to be able to adjust the flag behaviour. mHandler.post( new EnqueueNotificationRunnable(r.getUser().getIdentifier(), r, /* foreground= */ true, /* foreground= */ true, /* isAppProvided= */ false, mPostNotificationTrackerFactory.newTracker(null))); } } Loading Loading @@ -2716,7 +2716,7 @@ public class NotificationManagerService extends SystemService { enqueueNotificationInternal(r.getSbn().getPackageName(), r.getSbn().getOpPkg(), r.getSbn().getUid(), r.getSbn().getInitialPid(), r.getSbn().getTag(), r.getSbn().getId(), r.getSbn().getNotification(), userId, muteOnReturn, false /* byForegroundService */); /* byForegroundService= */ false, /* isAppProvided= */ false); } catch (Exception e) { Slog.e(TAG, "Cannot un-snooze notification", e); } Loading Loading @@ -2861,6 +2861,7 @@ public class NotificationManagerService extends SystemService { final boolean isAppForeground = mActivityManager.getPackageImportance(pkg) == IMPORTANCE_FOREGROUND; mHandler.post(new EnqueueNotificationRunnable(userId, r, isAppForeground, /* isAppProvided= */ false, mPostNotificationTrackerFactory.newTracker(null))); } } Loading Loading @@ -3773,7 +3774,7 @@ public class NotificationManagerService extends SystemService { Notification notification, int userId) throws RemoteException { enqueueNotificationInternal(pkg, opPkg, Binder.getCallingUid(), Binder.getCallingPid(), tag, id, notification, userId, false /* byForegroundService */); /* byForegroundService= */ false, /* isAppProvided= */ true); } @Override Loading Loading @@ -7059,7 +7060,7 @@ public class NotificationManagerService extends SystemService { public void enqueueNotification(String pkg, String opPkg, int callingUid, int callingPid, String tag, int id, Notification notification, int userId) { enqueueNotificationInternal(pkg, opPkg, callingUid, callingPid, tag, id, notification, userId, false /* byForegroundService */); userId, /* byForegroundService= */ false , /* isAppProvided= */ true); } @Override Loading @@ -7067,7 +7068,7 @@ public class NotificationManagerService extends SystemService { String tag, int id, Notification notification, int userId, boolean byForegroundService) { enqueueNotificationInternal(pkg, opPkg, callingUid, callingPid, tag, id, notification, userId, byForegroundService); userId, byForegroundService, /* isAppProvided= */ true); } @Override Loading Loading @@ -7279,7 +7280,8 @@ public class NotificationManagerService extends SystemService { r.getSbn().getInitialPid(), r.getSbn().getTag(), r.getSbn().getId(), r.getNotification(), r.getSbn().getUserId(), /* postSilently= */ true, /* byForegroundService= */ false); /* byForegroundService= */ false, /* isAppProvided= */ false); } int getNumNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted) { Loading Loading @@ -7340,19 +7342,21 @@ public class NotificationManagerService extends SystemService { void enqueueNotificationInternal(final String pkg, final String opPkg, final int callingUid, final int callingPid, final String tag, final int id, final Notification notification, int incomingUserId, boolean byForegroundService) { int incomingUserId, boolean byForegroundService, boolean isAppProvided) { enqueueNotificationInternal(pkg, opPkg, callingUid, callingPid, tag, id, notification, incomingUserId, false /* postSilently */, byForegroundService); incomingUserId, false /* postSilently */, byForegroundService, isAppProvided); } void enqueueNotificationInternal(final String pkg, final String opPkg, final int callingUid, final int callingPid, final String tag, final int id, final Notification notification, int incomingUserId, boolean postSilently, boolean byForegroundService) { int incomingUserId, boolean postSilently, boolean byForegroundService, boolean isAppProvided) { PostNotificationTracker tracker = acquireWakeLockForPost(pkg, callingUid); boolean enqueued = false; try { enqueued = enqueueNotificationInternal(pkg, opPkg, callingUid, callingPid, tag, id, notification, incomingUserId, postSilently, tracker, byForegroundService); notification, incomingUserId, postSilently, tracker, byForegroundService, isAppProvided); } finally { if (!enqueued) { tracker.cancel(); Loading @@ -7378,7 +7382,7 @@ public class NotificationManagerService extends SystemService { private boolean enqueueNotificationInternal(final String pkg, final String opPkg, //HUI final int callingUid, final int callingPid, final String tag, final int id, final Notification notification, int incomingUserId, boolean postSilently, PostNotificationTracker tracker, boolean byForegroundService) { PostNotificationTracker tracker, boolean byForegroundService, boolean isAppProvided) { if (DBG) { Slog.v(TAG, "enqueueNotificationInternal: pkg=" + pkg + " id=" + id + " notification=" + notification); Loading Loading @@ -7579,7 +7583,8 @@ public class NotificationManagerService extends SystemService { // Need escalated privileges to get package importance. final int packageImportance = getPackageImportanceWithIdentity(pkg); boolean isAppForeground = packageImportance == IMPORTANCE_FOREGROUND; mHandler.post(new EnqueueNotificationRunnable(userId, r, isAppForeground, tracker)); mHandler.post(new EnqueueNotificationRunnable(userId, r, isAppForeground, /* isAppProvided= */ isAppProvided, tracker)); return true; } Loading Loading @@ -7959,6 +7964,7 @@ public class NotificationManagerService extends SystemService { mHandler.post( new EnqueueNotificationRunnable( r.getUser().getIdentifier(), r, isAppForeground, /* isAppProvided= */ false, mPostNotificationTrackerFactory.newTracker(null))); } } Loading Loading @@ -8529,13 +8535,15 @@ public class NotificationManagerService extends SystemService { private final NotificationRecord r; private final int userId; private final boolean isAppForeground; private final boolean isAppProvided; private final PostNotificationTracker mTracker; EnqueueNotificationRunnable(int userId, NotificationRecord r, boolean foreground, PostNotificationTracker tracker) { boolean isAppProvided, PostNotificationTracker tracker) { this.userId = userId; this.r = r; this.isAppForeground = foreground; this.isAppProvided = isAppProvided; this.mTracker = checkNotNull(tracker); } Loading Loading @@ -8620,9 +8628,10 @@ public class NotificationManagerService extends SystemService { if (old != null) { enqueueStatus = EVENTLOG_ENQUEUE_STATUS_UPDATE; } int appProvided = isAppProvided ? 1 : 0; EventLogTags.writeNotificationEnqueue(callingUid, callingPid, pkg, id, tag, userId, notification.toString(), enqueueStatus); enqueueStatus, appProvided); } // tell the assistant service about the notification Loading Loading @@ -11407,7 +11416,7 @@ public class NotificationManagerService extends SystemService { record.getNotification().flags |= FLAG_ONLY_ALERT_ONCE; mHandler.post(new EnqueueNotificationRunnable(record.getUser().getIdentifier(), record, isAppForeground, record, isAppForeground, /* isAppProvided= */ false, mPostNotificationTrackerFactory.newTracker(null))); } } Loading
services/core/java/com/android/server/EventLogTags.logtags +1 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ option java_package com.android.server # NotificationManagerService.java # --------------------------- # when a NotificationManager.notify is called. status: 0=post, 1=update, 2=ignored 2750 notification_enqueue (uid|1|5),(pid|1|5),(pkg|3),(id|1|5),(tag|3),(userid|1|5),(notification|3),(status|1) 2750 notification_enqueue (uid|1|5),(pid|1|5),(pkg|3),(id|1|5),(tag|3),(userid|1|5),(notification|3),(status|1),(app_provided|1) # when someone tries to cancel a notification, the notification manager sometimes # calls this with flags too 2751 notification_cancel (uid|1|5),(pid|1|5),(pkg|3),(id|1|5),(tag|3),(userid|1|5),(required_flags|1),(forbidden_flags|1),(reason|1|5),(listener|3) Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +27 −18 Original line number Diff line number Diff line Loading @@ -1033,7 +1033,7 @@ public class NotificationManagerService extends SystemService { summary.getSbn().getNotification().color = summaryAttr.iconColor; summary.getSbn().getNotification().visibility = summaryAttr.visibility; mHandler.post(new EnqueueNotificationRunnable(userId, summary, isAppForeground, mPostNotificationTrackerFactory.newTracker(null))); /* isAppProvided= */ false, mPostNotificationTrackerFactory.newTracker(null))); } } Loading Loading @@ -1660,7 +1660,7 @@ public class NotificationManagerService extends SystemService { // Force isAppForeground true here, because for sysui's purposes we // want to adjust the flag behaviour. mHandler.post(new EnqueueNotificationRunnable(r.getUser().getIdentifier(), r, true /* isAppForeground*/, r, /* isAppForeground= */ true , /* isAppProvided= */ false, mPostNotificationTrackerFactory.newTracker(null))); } } Loading Loading @@ -1691,7 +1691,7 @@ public class NotificationManagerService extends SystemService { // want to be able to adjust the flag behaviour. mHandler.post( new EnqueueNotificationRunnable(r.getUser().getIdentifier(), r, /* foreground= */ true, /* foreground= */ true, /* isAppProvided= */ false, mPostNotificationTrackerFactory.newTracker(null))); } } Loading Loading @@ -2716,7 +2716,7 @@ public class NotificationManagerService extends SystemService { enqueueNotificationInternal(r.getSbn().getPackageName(), r.getSbn().getOpPkg(), r.getSbn().getUid(), r.getSbn().getInitialPid(), r.getSbn().getTag(), r.getSbn().getId(), r.getSbn().getNotification(), userId, muteOnReturn, false /* byForegroundService */); /* byForegroundService= */ false, /* isAppProvided= */ false); } catch (Exception e) { Slog.e(TAG, "Cannot un-snooze notification", e); } Loading Loading @@ -2861,6 +2861,7 @@ public class NotificationManagerService extends SystemService { final boolean isAppForeground = mActivityManager.getPackageImportance(pkg) == IMPORTANCE_FOREGROUND; mHandler.post(new EnqueueNotificationRunnable(userId, r, isAppForeground, /* isAppProvided= */ false, mPostNotificationTrackerFactory.newTracker(null))); } } Loading Loading @@ -3773,7 +3774,7 @@ public class NotificationManagerService extends SystemService { Notification notification, int userId) throws RemoteException { enqueueNotificationInternal(pkg, opPkg, Binder.getCallingUid(), Binder.getCallingPid(), tag, id, notification, userId, false /* byForegroundService */); /* byForegroundService= */ false, /* isAppProvided= */ true); } @Override Loading Loading @@ -7059,7 +7060,7 @@ public class NotificationManagerService extends SystemService { public void enqueueNotification(String pkg, String opPkg, int callingUid, int callingPid, String tag, int id, Notification notification, int userId) { enqueueNotificationInternal(pkg, opPkg, callingUid, callingPid, tag, id, notification, userId, false /* byForegroundService */); userId, /* byForegroundService= */ false , /* isAppProvided= */ true); } @Override Loading @@ -7067,7 +7068,7 @@ public class NotificationManagerService extends SystemService { String tag, int id, Notification notification, int userId, boolean byForegroundService) { enqueueNotificationInternal(pkg, opPkg, callingUid, callingPid, tag, id, notification, userId, byForegroundService); userId, byForegroundService, /* isAppProvided= */ true); } @Override Loading Loading @@ -7279,7 +7280,8 @@ public class NotificationManagerService extends SystemService { r.getSbn().getInitialPid(), r.getSbn().getTag(), r.getSbn().getId(), r.getNotification(), r.getSbn().getUserId(), /* postSilently= */ true, /* byForegroundService= */ false); /* byForegroundService= */ false, /* isAppProvided= */ false); } int getNumNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted) { Loading Loading @@ -7340,19 +7342,21 @@ public class NotificationManagerService extends SystemService { void enqueueNotificationInternal(final String pkg, final String opPkg, final int callingUid, final int callingPid, final String tag, final int id, final Notification notification, int incomingUserId, boolean byForegroundService) { int incomingUserId, boolean byForegroundService, boolean isAppProvided) { enqueueNotificationInternal(pkg, opPkg, callingUid, callingPid, tag, id, notification, incomingUserId, false /* postSilently */, byForegroundService); incomingUserId, false /* postSilently */, byForegroundService, isAppProvided); } void enqueueNotificationInternal(final String pkg, final String opPkg, final int callingUid, final int callingPid, final String tag, final int id, final Notification notification, int incomingUserId, boolean postSilently, boolean byForegroundService) { int incomingUserId, boolean postSilently, boolean byForegroundService, boolean isAppProvided) { PostNotificationTracker tracker = acquireWakeLockForPost(pkg, callingUid); boolean enqueued = false; try { enqueued = enqueueNotificationInternal(pkg, opPkg, callingUid, callingPid, tag, id, notification, incomingUserId, postSilently, tracker, byForegroundService); notification, incomingUserId, postSilently, tracker, byForegroundService, isAppProvided); } finally { if (!enqueued) { tracker.cancel(); Loading @@ -7378,7 +7382,7 @@ public class NotificationManagerService extends SystemService { private boolean enqueueNotificationInternal(final String pkg, final String opPkg, //HUI final int callingUid, final int callingPid, final String tag, final int id, final Notification notification, int incomingUserId, boolean postSilently, PostNotificationTracker tracker, boolean byForegroundService) { PostNotificationTracker tracker, boolean byForegroundService, boolean isAppProvided) { if (DBG) { Slog.v(TAG, "enqueueNotificationInternal: pkg=" + pkg + " id=" + id + " notification=" + notification); Loading Loading @@ -7579,7 +7583,8 @@ public class NotificationManagerService extends SystemService { // Need escalated privileges to get package importance. final int packageImportance = getPackageImportanceWithIdentity(pkg); boolean isAppForeground = packageImportance == IMPORTANCE_FOREGROUND; mHandler.post(new EnqueueNotificationRunnable(userId, r, isAppForeground, tracker)); mHandler.post(new EnqueueNotificationRunnable(userId, r, isAppForeground, /* isAppProvided= */ isAppProvided, tracker)); return true; } Loading Loading @@ -7959,6 +7964,7 @@ public class NotificationManagerService extends SystemService { mHandler.post( new EnqueueNotificationRunnable( r.getUser().getIdentifier(), r, isAppForeground, /* isAppProvided= */ false, mPostNotificationTrackerFactory.newTracker(null))); } } Loading Loading @@ -8529,13 +8535,15 @@ public class NotificationManagerService extends SystemService { private final NotificationRecord r; private final int userId; private final boolean isAppForeground; private final boolean isAppProvided; private final PostNotificationTracker mTracker; EnqueueNotificationRunnable(int userId, NotificationRecord r, boolean foreground, PostNotificationTracker tracker) { boolean isAppProvided, PostNotificationTracker tracker) { this.userId = userId; this.r = r; this.isAppForeground = foreground; this.isAppProvided = isAppProvided; this.mTracker = checkNotNull(tracker); } Loading Loading @@ -8620,9 +8628,10 @@ public class NotificationManagerService extends SystemService { if (old != null) { enqueueStatus = EVENTLOG_ENQUEUE_STATUS_UPDATE; } int appProvided = isAppProvided ? 1 : 0; EventLogTags.writeNotificationEnqueue(callingUid, callingPid, pkg, id, tag, userId, notification.toString(), enqueueStatus); enqueueStatus, appProvided); } // tell the assistant service about the notification Loading Loading @@ -11407,7 +11416,7 @@ public class NotificationManagerService extends SystemService { record.getNotification().flags |= FLAG_ONLY_ALERT_ONCE; mHandler.post(new EnqueueNotificationRunnable(record.getUser().getIdentifier(), record, isAppForeground, record, isAppForeground, /* isAppProvided= */ false, mPostNotificationTrackerFactory.newTracker(null))); } }