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-10 17:24:32 (GMT)
commitbed6193b5954565f60afb5f5f9868d89991354d7 (patch)
tree1fa843b6b3635def34dda7c63521ed6a74a487d6
parent809231680f4abe13cddb1e0ef2ef2688ac5ee5f8 (diff)
downloadframeworks_base-bed6193b5954565f60afb5f5f9868d89991354d7.zip
frameworks_base-bed6193b5954565f60afb5f5f9868d89991354d7.tar.gz
frameworks_base-bed6193b5954565f60afb5f5f9868d89991354d7.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.java5
1 files changed, 5 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 c3f9dc9..8a7d600 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -1631,6 +1631,11 @@ 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 mRankingHelper.getImportance(pkg, uid) != IMPORTANCE_NONE;
}