Merge changes from topic "am-3ca7326a-cbf1-4f97-a1b5-a4fdfac0fb47" into nyc-dr1-dev
* changes:
[automerger] [RESTRICT AUTOMERGE]: Add cross user permission check - areNotificationsEnabledForPackage am: a2b2e377a0
[RESTRICT AUTOMERGE]: Add cross user permission check - areNotificationsEnabledForPackage
This commit is contained in:
committed by
Android (Google) Code Review
commit
8bee19ca9c
@@ -1427,6 +1427,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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user