Loading core/java/android/app/NotificationManager.java +29 −7 Original line number Diff line number Diff line Loading @@ -28,11 +28,16 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SdkConstant; import android.annotation.SpecialUsers.CanBeALL; import android.annotation.SpecialUsers.CanBeCURRENT; import android.annotation.SpecialUsers.CannotBeSpecialUser; import android.annotation.SpecialUsers.SpecialUser; import android.annotation.SuppressLint; import android.annotation.SystemApi; import android.annotation.SystemService; import android.annotation.TestApi; import android.annotation.UserHandleAware; import android.annotation.UserIdInt; import android.annotation.WorkerThread; import android.app.Notification.Builder; import android.app.compat.CompatChanges; Loading Loading @@ -745,6 +750,7 @@ public class NotificationManager { * @param notification A {@link Notification} object describing what to * show the user. Must not be null. */ @UserHandleAware(specialUsersAllowed = { SpecialUser.USER_ALL, SpecialUser.USER_CURRENT}) public void notify(String tag, int id, Notification notification) { notifyAsUser(tag, id, notification, mContext.getUser()); Loading Loading @@ -772,6 +778,7 @@ public class NotificationManager { * @param notification A {@link Notification} object describing what to * show the user. Must not be null. */ @UserHandleAware(specialUsersAllowed = { SpecialUser.USER_ALL, SpecialUser.USER_CURRENT}) public void notifyAsPackage(@NonNull String targetPackage, @Nullable String tag, int id, @NonNull Notification notification) { INotificationManager service = service(); Loading @@ -795,7 +802,7 @@ public class NotificationManager { */ @UnsupportedAppUsage public void notifyAsUser(@Nullable String tag, int id, Notification notification, UserHandle user) @CanBeALL @CanBeCURRENT UserHandle user) { INotificationManager service = service(); String pkg = mContext.getPackageName(); Loading Loading @@ -955,6 +962,7 @@ public class NotificationManager { * {@link android.service.notification.NotificationListenerService notification listeners} * will be informed so they can remove the notification from their UIs.</p> */ @UserHandleAware(specialUsersAllowed = { SpecialUser.USER_ALL, SpecialUser.USER_CURRENT}) public void cancel(@Nullable String tag, int id) { cancelAsUser(tag, id, mContext.getUser()); Loading @@ -980,6 +988,7 @@ public class NotificationManager { * @param tag A string identifier for this notification. May be {@code null}. * @param id An identifier for this notification. */ @UserHandleAware(specialUsersAllowed = { SpecialUser.USER_ALL, SpecialUser.USER_CURRENT}) public void cancelAsPackage(@NonNull String targetPackage, @Nullable String tag, int id) { if (discardCancel(mContext.getUser(), targetPackage, tag, id)) { return; Loading @@ -998,7 +1007,7 @@ public class NotificationManager { * @hide */ @UnsupportedAppUsage public void cancelAsUser(@Nullable String tag, int id, UserHandle user) public void cancelAsUser(@Nullable String tag, int id, @CanBeALL @CanBeCURRENT UserHandle user) { String pkg = mContext.getPackageName(); if (discardCancel(user, pkg, tag, id)) { Loading Loading @@ -1042,6 +1051,7 @@ public class NotificationManager { * Cancel all previously shown notifications. See {@link #cancel} for the * detailed behavior. */ @UserHandleAware(specialUsersAllowed = { SpecialUser.USER_ALL, SpecialUser.USER_CURRENT}) public void cancelAll() { String pkg = mContext.getPackageName(); Loading Loading @@ -1109,6 +1119,7 @@ public class NotificationManager { * * See {@link #setNotificationDelegate(String)}. */ @UserHandleAware public boolean canNotifyAsPackage(@NonNull String pkg) { INotificationManager service = service(); try { Loading Loading @@ -1256,6 +1267,7 @@ public class NotificationManager { * a channel as a notification delegate, call this method from a context created for that * package (see {@link Context#createPackageContext(String, int)}).</p> */ @UserHandleAware(specialUsersAllowed = SpecialUser.DISALLOW_EVERY) public NotificationChannel getNotificationChannel(String channelId) { if (Flags.nmBinderPerfCacheChannels()) { return getChannelFromList(channelId, Loading Loading @@ -1287,6 +1299,7 @@ public class NotificationManager { * instead return the parent channel with the given channel ID, or {@code null} if neither * exists.</p> */ @UserHandleAware(specialUsersAllowed = SpecialUser.DISALLOW_EVERY) public @Nullable NotificationChannel getNotificationChannel(@NonNull String channelId, @NonNull String conversationId) { if (Flags.nmBinderPerfCacheChannels()) { Loading Loading @@ -1315,6 +1328,7 @@ public class NotificationManager { * method from a context created for that package (see * {@link Context#createPackageContext(String, int)}).</p> */ @UserHandleAware(specialUsersAllowed = SpecialUser.DISALLOW_EVERY) public List<NotificationChannel> getNotificationChannels() { if (Flags.nmBinderPerfCacheChannels()) { List<NotificationChannel> channelList = mNotificationChannelListCache.query( Loading Loading @@ -1403,6 +1417,7 @@ public class NotificationManager { * * The channel group must belong to your package, or null will be returned. */ @UserHandleAware(specialUsersAllowed = SpecialUser.DISALLOW_EVERY) public NotificationChannelGroup getNotificationChannelGroup(String channelGroupId) { if (Flags.nmBinderPerfCacheChannels()) { String pkgName = mContext.getPackageName(); Loading @@ -1428,6 +1443,7 @@ public class NotificationManager { /** * Returns all notification channel groups belonging to the calling app. */ @UserHandleAware(specialUsersAllowed = SpecialUser.DISALLOW_EVERY) public List<NotificationChannelGroup> getNotificationChannelGroups() { if (Flags.nmBinderPerfCacheChannels()) { String pkgName = mContext.getPackageName(); Loading Loading @@ -1526,7 +1542,7 @@ public class NotificationManager { private record NotificationChannelQuery( String callingPkg, String targetPkg, int userId) {} @CannotBeSpecialUser @UserIdInt int userId) {} private final IpcDataCache.QueryHandler<String, Map<String, NotificationChannelGroup>> mNotificationChannelGroupsQueryHandler = new IpcDataCache.QueryHandler<>() { Loading Loading @@ -2021,6 +2037,7 @@ public class NotificationManager { * * @see Notification.Builder#setBubbleMetadata(Notification.BubbleMetadata) */ @UserHandleAware(specialUsersAllowed = SpecialUser.DISALLOW_EVERY) public boolean areBubblesEnabled() { INotificationManager service = service(); try { Loading Loading @@ -2374,7 +2391,9 @@ public class NotificationManager { */ @SystemApi @TestApi @UserHandleAware(enabledSinceTargetSdkVersion = Build.VERSION_CODES.VANILLA_ICE_CREAM) @UserHandleAware( enabledSinceTargetSdkVersion = Build.VERSION_CODES.VANILLA_ICE_CREAM, specialUsersAllowed = SpecialUser.DISALLOW_EVERY) @RequiresPermission(android.Manifest.permission.MANAGE_NOTIFICATION_LISTENERS) public void setNotificationListenerAccessGranted( @NonNull ComponentName listener, boolean granted, boolean userSet) { Loading @@ -2392,8 +2411,8 @@ public class NotificationManager { } /** @hide */ public void setNotificationListenerAccessGrantedForUser(ComponentName listener, int userId, boolean granted) { public void setNotificationListenerAccessGrantedForUser(ComponentName listener, @CannotBeSpecialUser @UserIdInt int userId, boolean granted) { INotificationManager service = service(); try { service.setNotificationListenerAccessGrantedForUser(listener, userId, granted, true); Loading Loading @@ -2433,12 +2452,14 @@ public class NotificationManager { */ @SystemApi @RequiresPermission(android.Manifest.permission.MANAGE_NOTIFICATION_LISTENERS) @UserHandleAware(specialUsersAllowed = SpecialUser.DISALLOW_EVERY) public @NonNull List<ComponentName> getEnabledNotificationListeners() { return getEnabledNotificationListeners(mContext.getUserId()); } /** @hide */ public List<ComponentName> getEnabledNotificationListeners(int userId) { public List<ComponentName> getEnabledNotificationListeners( @CannotBeSpecialUser @UserIdInt int userId) { INotificationManager service = service(); try { return service.getEnabledNotificationListeners(userId); Loading Loading @@ -3275,6 +3296,7 @@ public class NotificationManager { * * @return An array of {@link StatusBarNotification}. */ @UserHandleAware(specialUsersAllowed = { SpecialUser.USER_ALL, SpecialUser.USER_CURRENT}) public StatusBarNotification[] getActiveNotifications() { final INotificationManager service = service(); final String pkg = mContext.getPackageName(); Loading services/core/java/com/android/server/notification/NotificationManagerService.java +21 −13 Original line number Diff line number Diff line Loading @@ -191,6 +191,9 @@ import android.annotation.MainThread; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SpecialUsers.CanBeALL; import android.annotation.SpecialUsers.CanBeCURRENT; import android.annotation.SpecialUsers.CannotBeSpecialUser; import android.annotation.UserIdInt; import android.annotation.WorkerThread; import android.app.ActivityManager; Loading Loading @@ -4215,7 +4218,8 @@ public class NotificationManagerService extends SystemService { @Override public void enqueueNotificationWithTag(String pkg, String opPkg, String tag, int id, Notification notification, int userId) throws RemoteException { Notification notification, @CanBeALL @CanBeCURRENT @UserIdInt int userId) throws RemoteException { enqueueNotificationInternal(pkg, opPkg, Binder.getCallingUid(), Binder.getCallingPid(), tag, id, notification, userId, /* byForegroundService= */ false, /* isAppProvided= */ true); Loading @@ -4223,7 +4227,7 @@ public class NotificationManagerService extends SystemService { @Override public void cancelNotificationWithTag(String pkg, String opPkg, String tag, int id, int userId) { @CanBeALL @CanBeCURRENT @UserIdInt int userId) { // Don't allow client applications to cancel foreground service notifs, user-initiated // job notifs, autobundled summaries, or notifs that have been replied to. int mustNotHaveFlags = isCallingUidSystem() ? 0 : Loading @@ -4238,7 +4242,8 @@ public class NotificationManagerService extends SystemService { } @Override public void cancelAllNotifications(String pkg, int userId) { public void cancelAllNotifications( String pkg, @CanBeALL @CanBeCURRENT @UserIdInt int userId) { checkCallerIsSystemOrSameApp(pkg); userId = ActivityManager.handleIncomingUser(Binder.getCallingPid(), Loading Loading @@ -4909,8 +4914,8 @@ public class NotificationManagerService extends SystemService { } @Override public NotificationChannel getNotificationChannel(String callingPkg, int userId, String targetPkg, String channelId) { public NotificationChannel getNotificationChannel(String callingPkg, @CannotBeSpecialUser @UserIdInt int userId, String targetPkg, String channelId) { return getConversationNotificationChannel( callingPkg, userId, targetPkg, channelId, true, null); } Loading Loading @@ -5221,7 +5226,7 @@ public class NotificationManagerService extends SystemService { @Override public ParceledListSlice<NotificationChannel> getNotificationChannels(String callingPkg, String targetPkg, int userId) { String targetPkg, @CannotBeSpecialUser @UserIdInt int userId) { if (canNotifyAsPackage(callingPkg, targetPkg, userId) || isCallingUidSystem()) { int targetUid = -1; Loading Loading @@ -5429,7 +5434,7 @@ public class NotificationManagerService extends SystemService { */ @Override public ParceledListSlice<StatusBarNotification> getAppActiveNotifications(String pkg, int incomingUserId) { @CanBeALL @CanBeCURRENT @UserIdInt int incomingUserId) { checkCallerIsSystemOrSameApp(pkg); int userId = ActivityManager.handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), incomingUserId, true, false, Loading Loading @@ -6854,7 +6859,8 @@ public class NotificationManagerService extends SystemService { } @Override public List<ComponentName> getEnabledNotificationListeners(int userId) { public List<ComponentName> getEnabledNotificationListeners( @CannotBeSpecialUser @UserIdInt int userId) { checkNotificationListenerAccess(); return mListeners.getAllowedComponents(userId); } Loading Loading @@ -6939,8 +6945,8 @@ public class NotificationManagerService extends SystemService { } @Override public void setNotificationListenerAccessGrantedForUser(ComponentName listener, int userId, boolean granted, boolean userSet) { public void setNotificationListenerAccessGrantedForUser(ComponentName listener, @CannotBeSpecialUser @UserIdInt int userId, boolean granted, boolean userSet) { Objects.requireNonNull(listener); if (UserHandle.getCallingUserId() != userId) { getContext().enforceCallingOrSelfPermission( Loading Loading @@ -8307,7 +8313,8 @@ public class NotificationManagerService extends SystemService { } void cancelNotificationInternal(String pkg, String opPkg, int callingUid, int callingPid, String tag, int id, int userId, int mustNotHaveFlags) { String tag, int id, @CanBeALL @CanBeCURRENT @UserIdInt int userId, int mustNotHaveFlags) { userId = ActivityManager.handleIncomingUser(callingPid, callingUid, userId, true, false, "cancelNotificationWithTag", pkg); Loading Loading @@ -8398,8 +8405,9 @@ 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, boolean isAppProvided) { final Notification notification, @CanBeALL @CanBeCURRENT @UserIdInt int incomingUserId, boolean postSilently, PostNotificationTracker tracker, boolean byForegroundService, boolean isAppProvided) { if (DBG) { Slog.v(TAG, "enqueueNotificationInternal: pkg=" + pkg + " id=" + id + " notification=" + notification); Loading Loading
core/java/android/app/NotificationManager.java +29 −7 Original line number Diff line number Diff line Loading @@ -28,11 +28,16 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SdkConstant; import android.annotation.SpecialUsers.CanBeALL; import android.annotation.SpecialUsers.CanBeCURRENT; import android.annotation.SpecialUsers.CannotBeSpecialUser; import android.annotation.SpecialUsers.SpecialUser; import android.annotation.SuppressLint; import android.annotation.SystemApi; import android.annotation.SystemService; import android.annotation.TestApi; import android.annotation.UserHandleAware; import android.annotation.UserIdInt; import android.annotation.WorkerThread; import android.app.Notification.Builder; import android.app.compat.CompatChanges; Loading Loading @@ -745,6 +750,7 @@ public class NotificationManager { * @param notification A {@link Notification} object describing what to * show the user. Must not be null. */ @UserHandleAware(specialUsersAllowed = { SpecialUser.USER_ALL, SpecialUser.USER_CURRENT}) public void notify(String tag, int id, Notification notification) { notifyAsUser(tag, id, notification, mContext.getUser()); Loading Loading @@ -772,6 +778,7 @@ public class NotificationManager { * @param notification A {@link Notification} object describing what to * show the user. Must not be null. */ @UserHandleAware(specialUsersAllowed = { SpecialUser.USER_ALL, SpecialUser.USER_CURRENT}) public void notifyAsPackage(@NonNull String targetPackage, @Nullable String tag, int id, @NonNull Notification notification) { INotificationManager service = service(); Loading @@ -795,7 +802,7 @@ public class NotificationManager { */ @UnsupportedAppUsage public void notifyAsUser(@Nullable String tag, int id, Notification notification, UserHandle user) @CanBeALL @CanBeCURRENT UserHandle user) { INotificationManager service = service(); String pkg = mContext.getPackageName(); Loading Loading @@ -955,6 +962,7 @@ public class NotificationManager { * {@link android.service.notification.NotificationListenerService notification listeners} * will be informed so they can remove the notification from their UIs.</p> */ @UserHandleAware(specialUsersAllowed = { SpecialUser.USER_ALL, SpecialUser.USER_CURRENT}) public void cancel(@Nullable String tag, int id) { cancelAsUser(tag, id, mContext.getUser()); Loading @@ -980,6 +988,7 @@ public class NotificationManager { * @param tag A string identifier for this notification. May be {@code null}. * @param id An identifier for this notification. */ @UserHandleAware(specialUsersAllowed = { SpecialUser.USER_ALL, SpecialUser.USER_CURRENT}) public void cancelAsPackage(@NonNull String targetPackage, @Nullable String tag, int id) { if (discardCancel(mContext.getUser(), targetPackage, tag, id)) { return; Loading @@ -998,7 +1007,7 @@ public class NotificationManager { * @hide */ @UnsupportedAppUsage public void cancelAsUser(@Nullable String tag, int id, UserHandle user) public void cancelAsUser(@Nullable String tag, int id, @CanBeALL @CanBeCURRENT UserHandle user) { String pkg = mContext.getPackageName(); if (discardCancel(user, pkg, tag, id)) { Loading Loading @@ -1042,6 +1051,7 @@ public class NotificationManager { * Cancel all previously shown notifications. See {@link #cancel} for the * detailed behavior. */ @UserHandleAware(specialUsersAllowed = { SpecialUser.USER_ALL, SpecialUser.USER_CURRENT}) public void cancelAll() { String pkg = mContext.getPackageName(); Loading Loading @@ -1109,6 +1119,7 @@ public class NotificationManager { * * See {@link #setNotificationDelegate(String)}. */ @UserHandleAware public boolean canNotifyAsPackage(@NonNull String pkg) { INotificationManager service = service(); try { Loading Loading @@ -1256,6 +1267,7 @@ public class NotificationManager { * a channel as a notification delegate, call this method from a context created for that * package (see {@link Context#createPackageContext(String, int)}).</p> */ @UserHandleAware(specialUsersAllowed = SpecialUser.DISALLOW_EVERY) public NotificationChannel getNotificationChannel(String channelId) { if (Flags.nmBinderPerfCacheChannels()) { return getChannelFromList(channelId, Loading Loading @@ -1287,6 +1299,7 @@ public class NotificationManager { * instead return the parent channel with the given channel ID, or {@code null} if neither * exists.</p> */ @UserHandleAware(specialUsersAllowed = SpecialUser.DISALLOW_EVERY) public @Nullable NotificationChannel getNotificationChannel(@NonNull String channelId, @NonNull String conversationId) { if (Flags.nmBinderPerfCacheChannels()) { Loading Loading @@ -1315,6 +1328,7 @@ public class NotificationManager { * method from a context created for that package (see * {@link Context#createPackageContext(String, int)}).</p> */ @UserHandleAware(specialUsersAllowed = SpecialUser.DISALLOW_EVERY) public List<NotificationChannel> getNotificationChannels() { if (Flags.nmBinderPerfCacheChannels()) { List<NotificationChannel> channelList = mNotificationChannelListCache.query( Loading Loading @@ -1403,6 +1417,7 @@ public class NotificationManager { * * The channel group must belong to your package, or null will be returned. */ @UserHandleAware(specialUsersAllowed = SpecialUser.DISALLOW_EVERY) public NotificationChannelGroup getNotificationChannelGroup(String channelGroupId) { if (Flags.nmBinderPerfCacheChannels()) { String pkgName = mContext.getPackageName(); Loading @@ -1428,6 +1443,7 @@ public class NotificationManager { /** * Returns all notification channel groups belonging to the calling app. */ @UserHandleAware(specialUsersAllowed = SpecialUser.DISALLOW_EVERY) public List<NotificationChannelGroup> getNotificationChannelGroups() { if (Flags.nmBinderPerfCacheChannels()) { String pkgName = mContext.getPackageName(); Loading Loading @@ -1526,7 +1542,7 @@ public class NotificationManager { private record NotificationChannelQuery( String callingPkg, String targetPkg, int userId) {} @CannotBeSpecialUser @UserIdInt int userId) {} private final IpcDataCache.QueryHandler<String, Map<String, NotificationChannelGroup>> mNotificationChannelGroupsQueryHandler = new IpcDataCache.QueryHandler<>() { Loading Loading @@ -2021,6 +2037,7 @@ public class NotificationManager { * * @see Notification.Builder#setBubbleMetadata(Notification.BubbleMetadata) */ @UserHandleAware(specialUsersAllowed = SpecialUser.DISALLOW_EVERY) public boolean areBubblesEnabled() { INotificationManager service = service(); try { Loading Loading @@ -2374,7 +2391,9 @@ public class NotificationManager { */ @SystemApi @TestApi @UserHandleAware(enabledSinceTargetSdkVersion = Build.VERSION_CODES.VANILLA_ICE_CREAM) @UserHandleAware( enabledSinceTargetSdkVersion = Build.VERSION_CODES.VANILLA_ICE_CREAM, specialUsersAllowed = SpecialUser.DISALLOW_EVERY) @RequiresPermission(android.Manifest.permission.MANAGE_NOTIFICATION_LISTENERS) public void setNotificationListenerAccessGranted( @NonNull ComponentName listener, boolean granted, boolean userSet) { Loading @@ -2392,8 +2411,8 @@ public class NotificationManager { } /** @hide */ public void setNotificationListenerAccessGrantedForUser(ComponentName listener, int userId, boolean granted) { public void setNotificationListenerAccessGrantedForUser(ComponentName listener, @CannotBeSpecialUser @UserIdInt int userId, boolean granted) { INotificationManager service = service(); try { service.setNotificationListenerAccessGrantedForUser(listener, userId, granted, true); Loading Loading @@ -2433,12 +2452,14 @@ public class NotificationManager { */ @SystemApi @RequiresPermission(android.Manifest.permission.MANAGE_NOTIFICATION_LISTENERS) @UserHandleAware(specialUsersAllowed = SpecialUser.DISALLOW_EVERY) public @NonNull List<ComponentName> getEnabledNotificationListeners() { return getEnabledNotificationListeners(mContext.getUserId()); } /** @hide */ public List<ComponentName> getEnabledNotificationListeners(int userId) { public List<ComponentName> getEnabledNotificationListeners( @CannotBeSpecialUser @UserIdInt int userId) { INotificationManager service = service(); try { return service.getEnabledNotificationListeners(userId); Loading Loading @@ -3275,6 +3296,7 @@ public class NotificationManager { * * @return An array of {@link StatusBarNotification}. */ @UserHandleAware(specialUsersAllowed = { SpecialUser.USER_ALL, SpecialUser.USER_CURRENT}) public StatusBarNotification[] getActiveNotifications() { final INotificationManager service = service(); final String pkg = mContext.getPackageName(); Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +21 −13 Original line number Diff line number Diff line Loading @@ -191,6 +191,9 @@ import android.annotation.MainThread; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SpecialUsers.CanBeALL; import android.annotation.SpecialUsers.CanBeCURRENT; import android.annotation.SpecialUsers.CannotBeSpecialUser; import android.annotation.UserIdInt; import android.annotation.WorkerThread; import android.app.ActivityManager; Loading Loading @@ -4215,7 +4218,8 @@ public class NotificationManagerService extends SystemService { @Override public void enqueueNotificationWithTag(String pkg, String opPkg, String tag, int id, Notification notification, int userId) throws RemoteException { Notification notification, @CanBeALL @CanBeCURRENT @UserIdInt int userId) throws RemoteException { enqueueNotificationInternal(pkg, opPkg, Binder.getCallingUid(), Binder.getCallingPid(), tag, id, notification, userId, /* byForegroundService= */ false, /* isAppProvided= */ true); Loading @@ -4223,7 +4227,7 @@ public class NotificationManagerService extends SystemService { @Override public void cancelNotificationWithTag(String pkg, String opPkg, String tag, int id, int userId) { @CanBeALL @CanBeCURRENT @UserIdInt int userId) { // Don't allow client applications to cancel foreground service notifs, user-initiated // job notifs, autobundled summaries, or notifs that have been replied to. int mustNotHaveFlags = isCallingUidSystem() ? 0 : Loading @@ -4238,7 +4242,8 @@ public class NotificationManagerService extends SystemService { } @Override public void cancelAllNotifications(String pkg, int userId) { public void cancelAllNotifications( String pkg, @CanBeALL @CanBeCURRENT @UserIdInt int userId) { checkCallerIsSystemOrSameApp(pkg); userId = ActivityManager.handleIncomingUser(Binder.getCallingPid(), Loading Loading @@ -4909,8 +4914,8 @@ public class NotificationManagerService extends SystemService { } @Override public NotificationChannel getNotificationChannel(String callingPkg, int userId, String targetPkg, String channelId) { public NotificationChannel getNotificationChannel(String callingPkg, @CannotBeSpecialUser @UserIdInt int userId, String targetPkg, String channelId) { return getConversationNotificationChannel( callingPkg, userId, targetPkg, channelId, true, null); } Loading Loading @@ -5221,7 +5226,7 @@ public class NotificationManagerService extends SystemService { @Override public ParceledListSlice<NotificationChannel> getNotificationChannels(String callingPkg, String targetPkg, int userId) { String targetPkg, @CannotBeSpecialUser @UserIdInt int userId) { if (canNotifyAsPackage(callingPkg, targetPkg, userId) || isCallingUidSystem()) { int targetUid = -1; Loading Loading @@ -5429,7 +5434,7 @@ public class NotificationManagerService extends SystemService { */ @Override public ParceledListSlice<StatusBarNotification> getAppActiveNotifications(String pkg, int incomingUserId) { @CanBeALL @CanBeCURRENT @UserIdInt int incomingUserId) { checkCallerIsSystemOrSameApp(pkg); int userId = ActivityManager.handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), incomingUserId, true, false, Loading Loading @@ -6854,7 +6859,8 @@ public class NotificationManagerService extends SystemService { } @Override public List<ComponentName> getEnabledNotificationListeners(int userId) { public List<ComponentName> getEnabledNotificationListeners( @CannotBeSpecialUser @UserIdInt int userId) { checkNotificationListenerAccess(); return mListeners.getAllowedComponents(userId); } Loading Loading @@ -6939,8 +6945,8 @@ public class NotificationManagerService extends SystemService { } @Override public void setNotificationListenerAccessGrantedForUser(ComponentName listener, int userId, boolean granted, boolean userSet) { public void setNotificationListenerAccessGrantedForUser(ComponentName listener, @CannotBeSpecialUser @UserIdInt int userId, boolean granted, boolean userSet) { Objects.requireNonNull(listener); if (UserHandle.getCallingUserId() != userId) { getContext().enforceCallingOrSelfPermission( Loading Loading @@ -8307,7 +8313,8 @@ public class NotificationManagerService extends SystemService { } void cancelNotificationInternal(String pkg, String opPkg, int callingUid, int callingPid, String tag, int id, int userId, int mustNotHaveFlags) { String tag, int id, @CanBeALL @CanBeCURRENT @UserIdInt int userId, int mustNotHaveFlags) { userId = ActivityManager.handleIncomingUser(callingPid, callingUid, userId, true, false, "cancelNotificationWithTag", pkg); Loading Loading @@ -8398,8 +8405,9 @@ 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, boolean isAppProvided) { final Notification notification, @CanBeALL @CanBeCURRENT @UserIdInt int incomingUserId, boolean postSilently, PostNotificationTracker tracker, boolean byForegroundService, boolean isAppProvided) { if (DBG) { Slog.v(TAG, "enqueueNotificationInternal: pkg=" + pkg + " id=" + id + " notification=" + notification); Loading