Loading services/core/java/com/android/server/notification/NotificationManagerService.java +15 −17 Original line number Diff line number Diff line Loading @@ -2256,7 +2256,7 @@ public class NotificationManagerService extends SystemService { final int callingUid = Binder.getCallingUid(); final boolean isSystemToast = isCallerSystemOrPhone() || PackageManagerService.PLATFORM_PACKAGE_NAME.equals(pkg); final boolean isPackageSuspended = isPackageSuspendedForUser(pkg, callingUid); final boolean isPackageSuspended = isPackagePaused(pkg); final boolean notificationsDisabledForPackage = !areNotificationsEnabledForPackage(pkg, callingUid); Loading Loading @@ -4104,17 +4104,7 @@ public class NotificationManagerService extends SystemService { Preconditions.checkNotNull(pkg); checkCallerIsSameApp(pkg); boolean isPaused; final PackageManagerInternal pmi = LocalServices.getService( PackageManagerInternal.class); int flags = pmi.getDistractingPackageRestrictions( pkg, Binder.getCallingUserHandle().getIdentifier()); isPaused = ((flags & PackageManager.RESTRICTION_HIDE_NOTIFICATIONS) != 0); isPaused |= isPackageSuspendedForUser(pkg, Binder.getCallingUid()); return isPaused; return isPackagePausedOrSuspended(pkg, Binder.getCallingUid()); } private void verifyPrivilegedListener(INotificationListener token, UserHandle user, Loading Loading @@ -5375,11 +5365,18 @@ public class NotificationManagerService extends SystemService { } @GuardedBy("mNotificationLock") private boolean isPackageSuspendedLocked(NotificationRecord r) { final String pkg = r.sbn.getPackageName(); final int callingUid = r.sbn.getUid(); boolean isPackagePausedOrSuspended(String pkg, int uid) { boolean isPaused; final PackageManagerInternal pmi = LocalServices.getService( PackageManagerInternal.class); int flags = pmi.getDistractingPackageRestrictions( pkg, Binder.getCallingUserHandle().getIdentifier()); isPaused = ((flags & PackageManager.RESTRICTION_HIDE_NOTIFICATIONS) != 0); return isPackageSuspendedForUser(pkg, callingUid); isPaused |= isPackageSuspendedForUser(pkg, uid); return isPaused; } protected class PostNotificationRunnable implements Runnable { Loading Loading @@ -5412,7 +5409,8 @@ public class NotificationManagerService extends SystemService { return; } final boolean isPackageSuspended = isPackageSuspendedLocked(r); final boolean isPackageSuspended = isPackagePausedOrSuspended(r.sbn.getPackageName(), r.getUid()); r.setHidden(isPackageSuspended); if (isPackageSuspended) { mUsageStats.registerSuspendedByAdmin(r); Loading Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +15 −17 Original line number Diff line number Diff line Loading @@ -2256,7 +2256,7 @@ public class NotificationManagerService extends SystemService { final int callingUid = Binder.getCallingUid(); final boolean isSystemToast = isCallerSystemOrPhone() || PackageManagerService.PLATFORM_PACKAGE_NAME.equals(pkg); final boolean isPackageSuspended = isPackageSuspendedForUser(pkg, callingUid); final boolean isPackageSuspended = isPackagePaused(pkg); final boolean notificationsDisabledForPackage = !areNotificationsEnabledForPackage(pkg, callingUid); Loading Loading @@ -4104,17 +4104,7 @@ public class NotificationManagerService extends SystemService { Preconditions.checkNotNull(pkg); checkCallerIsSameApp(pkg); boolean isPaused; final PackageManagerInternal pmi = LocalServices.getService( PackageManagerInternal.class); int flags = pmi.getDistractingPackageRestrictions( pkg, Binder.getCallingUserHandle().getIdentifier()); isPaused = ((flags & PackageManager.RESTRICTION_HIDE_NOTIFICATIONS) != 0); isPaused |= isPackageSuspendedForUser(pkg, Binder.getCallingUid()); return isPaused; return isPackagePausedOrSuspended(pkg, Binder.getCallingUid()); } private void verifyPrivilegedListener(INotificationListener token, UserHandle user, Loading Loading @@ -5375,11 +5365,18 @@ public class NotificationManagerService extends SystemService { } @GuardedBy("mNotificationLock") private boolean isPackageSuspendedLocked(NotificationRecord r) { final String pkg = r.sbn.getPackageName(); final int callingUid = r.sbn.getUid(); boolean isPackagePausedOrSuspended(String pkg, int uid) { boolean isPaused; final PackageManagerInternal pmi = LocalServices.getService( PackageManagerInternal.class); int flags = pmi.getDistractingPackageRestrictions( pkg, Binder.getCallingUserHandle().getIdentifier()); isPaused = ((flags & PackageManager.RESTRICTION_HIDE_NOTIFICATIONS) != 0); return isPackageSuspendedForUser(pkg, callingUid); isPaused |= isPackageSuspendedForUser(pkg, uid); return isPaused; } protected class PostNotificationRunnable implements Runnable { Loading Loading @@ -5412,7 +5409,8 @@ public class NotificationManagerService extends SystemService { return; } final boolean isPackageSuspended = isPackageSuspendedLocked(r); final boolean isPackageSuspended = isPackagePausedOrSuspended(r.sbn.getPackageName(), r.getUid()); r.setHidden(isPackageSuspended); if (isPackageSuspended) { mUsageStats.registerSuspendedByAdmin(r); Loading