From 78262f7082ccb80c7ebd462fb7ecdf4b66a1430f Mon Sep 17 00:00:00 2001 From: Miranda Kephart Date: Wed, 16 Feb 2022 12:34:35 -0500 Subject: [PATCH] Set package name explicitly when sending copy intent We broadcast an intent when starting the copy overlay, which is received by the screenshot process so it knows to dismiss itself. This causes a warning since sending non-protected broadcasts is dangerous. Setting the package name explicitly lets ActivityManagerService determine that the broadcast is safe since it is only sent within SystemUI. Bug: 219958007 Fix: 219958007 Test: manual (observed that error message no longer displayed when copying something to the clipboard) Change-Id: I1072bf7ebac9d8c761af01a5d888941f8ef24b79 --- .../clipboardoverlay/ClipboardOverlayController.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/clipboardoverlay/ClipboardOverlayController.java b/packages/SystemUI/src/com/android/systemui/clipboardoverlay/ClipboardOverlayController.java index a17ddc89818de..a5279eb3604ba 100644 --- a/packages/SystemUI/src/com/android/systemui/clipboardoverlay/ClipboardOverlayController.java +++ b/packages/SystemUI/src/com/android/systemui/clipboardoverlay/ClipboardOverlayController.java @@ -219,7 +219,10 @@ public class ClipboardOverlayController { SELF_PERMISSION, null); monitorOutsideTouches(); - mContext.sendBroadcast(new Intent(COPY_OVERLAY_ACTION), SELF_PERMISSION); + Intent copyIntent = new Intent(COPY_OVERLAY_ACTION); + // Set package name so the system knows it's safe + copyIntent.setPackage(mContext.getPackageName()); + mContext.sendBroadcast(copyIntent, SELF_PERMISSION); } void setClipData(ClipData clipData, String clipSource) {