From 391263ceb44bd490baad3474d409fc9c920cec5e Mon Sep 17 00:00:00 2001 From: Michael Groover Date: Mon, 4 Apr 2022 22:25:27 +0000 Subject: [PATCH] Revert "Only allow root/system UIDs to send broadcast to unexported receiver" This reverts commit 6ea76aa7e52e3fe8d7a1386c88e7df3431553077. Reason for revert: b/228082755 surfaced additional receivers that were registering for system broadcasts that are sent from UIDs other than root / system with the RECEIVER_NOT_EXPORTED flag. Reverting this to audit the remaining receivers that are registering for system broadcasts and using this flag. Fixes: b/228082755 Change-Id: I1e8b01f02e980f8305bcb1462ed929c84bc0d39f --- .../core/java/com/android/server/am/BroadcastQueue.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/am/BroadcastQueue.java b/services/core/java/com/android/server/am/BroadcastQueue.java index 6ab18d532ac04..ea63c080cf68a 100644 --- a/services/core/java/com/android/server/am/BroadcastQueue.java +++ b/services/core/java/com/android/server/am/BroadcastQueue.java @@ -869,9 +869,9 @@ public final class BroadcastQueue { // Ensure that broadcasts are only sent to other apps if they are explicitly marked as // exported, or are System level broadcasts - if (!skip && !filter.exported && mService.checkComponentPermission(null, r.callingPid, - r.callingUid, filter.receiverList.uid, filter.exported) - != PackageManager.PERMISSION_GRANTED) { + if (!skip && !filter.exported && !Process.isCoreUid(r.callingUid) + && filter.receiverList.uid != r.callingUid) { + Slog.w(TAG, "Exported Denial: sending " + r.intent.toString() + ", action: " + r.intent.getAction()