summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulia Reynolds <juliacr@google.com>2019-03-27 16:15:57 (GMT)
committerChristopher Dombroski <cdombroski@google.com>2019-04-09 22:27:46 (GMT)
commita2b2e377a0a63cbe9c8bfdfcab1167e55f36a59b (patch)
tree7ad855b74ab0daa8d9e88460b3c9a4db9c88373b
parentb5e7bbe5b8e1d120d3f13f6d15b7be16d4f2e132 (diff)
downloadframeworks_base-a2b2e377a0a63cbe9c8bfdfcab1167e55f36a59b.zip
frameworks_base-a2b2e377a0a63cbe9c8bfdfcab1167e55f36a59b.tar.gz
frameworks_base-a2b2e377a0a63cbe9c8bfdfcab1167e55f36a59b.tar.bz2
[RESTRICT AUTOMERGE]: Add cross user permission check - areNotificationsEnabledForPackage
Test: atest Fixes: 128599467 Change-Id: I13a0ca7590f8c4b44379730e0ee2088aba400c2a (cherry picked from commit 657d164136199126ae241848887de0230699cea0)
-rw-r--r--services/core/java/com/android/server/notification/NotificationManagerService.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index ee09e16..d4e5dfa 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -1413,6 +1413,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);
}