Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bed6193b authored by Julia Reynolds's avatar Julia Reynolds Committed by Christopher Dombroski
Browse files

[RESTRICT_AUTOMERGE]: Add cross user permission check - areNotificationsEnabledForPackage

Test: atest
Fixes: 128599467
Change-Id: I13a0ca7590f8c4b44379730e0ee2088aba400c2a
(cherry picked from commit 657d1641)
parent 80923168
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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;
        }