summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulia Reynolds <juliacr@google.com>2019-03-27 12:15:57 -0400
committerGreg Wroblewski <musashi@google.com>2019-04-15 12:17:10 -0700
commit6b375cae36047140ea6d6bcfb7ba4f0bc53a90ca (patch)
tree06458c0bf62f641eb7479ca74083ea3c95ab73ca
parent65b5375649c0f14574c87a95f86c36f389083fe6 (diff)
downloadbase-6b375cae36047140ea6d6bcfb7ba4f0bc53a90ca.tar.gz
[RESTRICT_AUTOMERGE]: Add cross user permission check - areNotificationsEnabledForPackage
Test: atest Fixes: 128599467 Change-Id: I13a0ca7590f8c4b44379730e0ee2088aba400c2a (cherry picked from commit 657d164136199126ae241848887de0230699cea0) (cherry picked from commit bed6193b5954565f60afb5f5f9868d89991354d7)
-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 566e5f52625e..4baec056f639 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -1767,6 +1767,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;
}