Loading services/core/java/com/android/server/notification/NotificationManagerService.java +15 −17 Original line number Original line Diff line number Diff line Loading @@ -2266,7 +2266,7 @@ public class NotificationManagerService extends SystemService { final int callingUid = Binder.getCallingUid(); final int callingUid = Binder.getCallingUid(); final boolean isSystemToast = isCallerSystemOrPhone() final boolean isSystemToast = isCallerSystemOrPhone() || PackageManagerService.PLATFORM_PACKAGE_NAME.equals(pkg); || PackageManagerService.PLATFORM_PACKAGE_NAME.equals(pkg); final boolean isPackageSuspended = isPackageSuspendedForUser(pkg, callingUid); final boolean isPackageSuspended = isPackagePaused(pkg); final boolean notificationsDisabledForPackage = !areNotificationsEnabledForPackage(pkg, final boolean notificationsDisabledForPackage = !areNotificationsEnabledForPackage(pkg, callingUid); callingUid); Loading Loading @@ -4120,17 +4120,7 @@ public class NotificationManagerService extends SystemService { Preconditions.checkNotNull(pkg); Preconditions.checkNotNull(pkg); checkCallerIsSameApp(pkg); checkCallerIsSameApp(pkg); boolean isPaused; return isPackagePausedOrSuspended(pkg, Binder.getCallingUid()); 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; } } private void verifyPrivilegedListener(INotificationListener token, UserHandle user, private void verifyPrivilegedListener(INotificationListener token, UserHandle user, Loading Loading @@ -5352,11 +5342,18 @@ public class NotificationManagerService extends SystemService { } } @GuardedBy("mNotificationLock") @GuardedBy("mNotificationLock") private boolean isPackageSuspendedLocked(NotificationRecord r) { boolean isPackagePausedOrSuspended(String pkg, int uid) { final String pkg = r.sbn.getPackageName(); boolean isPaused; final int callingUid = r.sbn.getUid(); 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 { protected class PostNotificationRunnable implements Runnable { Loading Loading @@ -5389,7 +5386,8 @@ public class NotificationManagerService extends SystemService { return; return; } } final boolean isPackageSuspended = isPackageSuspendedLocked(r); final boolean isPackageSuspended = isPackagePausedOrSuspended(r.sbn.getPackageName(), r.getUid()); r.setHidden(isPackageSuspended); r.setHidden(isPackageSuspended); if (isPackageSuspended) { if (isPackageSuspended) { mUsageStats.registerSuspendedByAdmin(r); mUsageStats.registerSuspendedByAdmin(r); Loading Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +15 −17 Original line number Original line Diff line number Diff line Loading @@ -2266,7 +2266,7 @@ public class NotificationManagerService extends SystemService { final int callingUid = Binder.getCallingUid(); final int callingUid = Binder.getCallingUid(); final boolean isSystemToast = isCallerSystemOrPhone() final boolean isSystemToast = isCallerSystemOrPhone() || PackageManagerService.PLATFORM_PACKAGE_NAME.equals(pkg); || PackageManagerService.PLATFORM_PACKAGE_NAME.equals(pkg); final boolean isPackageSuspended = isPackageSuspendedForUser(pkg, callingUid); final boolean isPackageSuspended = isPackagePaused(pkg); final boolean notificationsDisabledForPackage = !areNotificationsEnabledForPackage(pkg, final boolean notificationsDisabledForPackage = !areNotificationsEnabledForPackage(pkg, callingUid); callingUid); Loading Loading @@ -4120,17 +4120,7 @@ public class NotificationManagerService extends SystemService { Preconditions.checkNotNull(pkg); Preconditions.checkNotNull(pkg); checkCallerIsSameApp(pkg); checkCallerIsSameApp(pkg); boolean isPaused; return isPackagePausedOrSuspended(pkg, Binder.getCallingUid()); 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; } } private void verifyPrivilegedListener(INotificationListener token, UserHandle user, private void verifyPrivilegedListener(INotificationListener token, UserHandle user, Loading Loading @@ -5352,11 +5342,18 @@ public class NotificationManagerService extends SystemService { } } @GuardedBy("mNotificationLock") @GuardedBy("mNotificationLock") private boolean isPackageSuspendedLocked(NotificationRecord r) { boolean isPackagePausedOrSuspended(String pkg, int uid) { final String pkg = r.sbn.getPackageName(); boolean isPaused; final int callingUid = r.sbn.getUid(); 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 { protected class PostNotificationRunnable implements Runnable { Loading Loading @@ -5389,7 +5386,8 @@ public class NotificationManagerService extends SystemService { return; return; } } final boolean isPackageSuspended = isPackageSuspendedLocked(r); final boolean isPackageSuspended = isPackagePausedOrSuspended(r.sbn.getPackageName(), r.getUid()); r.setHidden(isPackageSuspended); r.setHidden(isPackageSuspended); if (isPackageSuspended) { if (isPackageSuspended) { mUsageStats.registerSuspendedByAdmin(r); mUsageStats.registerSuspendedByAdmin(r); Loading