Merge changes from topic "am-3ca7326a-cbf1-4f97-a1b5-a4fdfac0fb47" into nyc-mr1-dev

* changes:
  [automerger] [RESTRICT AUTOMERGE]: Add cross user permission check - areNotificationsEnabledForPackage am: a2b2e377a0 am: 00121902b0
  [automerger] [RESTRICT AUTOMERGE]: Add cross user permission check - areNotificationsEnabledForPackage am: a2b2e377a0
  [RESTRICT AUTOMERGE]: Add cross user permission check - areNotificationsEnabledForPackage
This commit is contained in:
TreeHugger Robot
2019-04-10 22:20:55 +00:00
committed by Android (Google) Code Review

View File

@@ -1435,6 +1435,12 @@ public class NotificationManagerService extends SystemService {
@Override
public boolean areNotificationsEnabledForPackage(String pkg, int uid) {
checkCallerIsSystemOrSameApp(pkg);
if (UserHandle.getCallingUserId() != UserHandle.getUserId(uid)) {
getContext().enforceCallingPermission(
android.Manifest.permission.INTERACT_ACROSS_USERS,
"canNotifyAsPackage for uid " + uid);
}
return (mAppOps.checkOpNoThrow(AppOpsManager.OP_POST_NOTIFICATION, uid, pkg)
== AppOpsManager.MODE_ALLOWED) && !isPackageSuspendedForUser(pkg, uid);
}