From 3ebb323fe45abb58d1e7586e5fec987cd6a7869f Mon Sep 17 00:00:00 2001 From: Robin Lee Date: Thu, 8 Apr 2021 20:32:40 +0200 Subject: [PATCH] Add permission check for TvPipNotification Bug: 174493596 Change-Id: I110a8db90557eaf72fd4a6c3fe18c1b179bb27fd --- .../wm/shell/pip/tv/TvPipNotificationController.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipNotificationController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipNotificationController.java index a47483144fefc..dd7e29451ffc3 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipNotificationController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/TvPipNotificationController.java @@ -50,6 +50,7 @@ public class TvPipNotificationController { // Referenced in com.android.systemui.util.NotificationChannels. public static final String NOTIFICATION_CHANNEL = "TVPIP"; private static final String NOTIFICATION_TAG = "TvPip"; + private static final String SYSTEMUI_PERMISSION = "com.android.systemui.permission.SELF"; private static final String ACTION_SHOW_PIP_MENU = "com.android.wm.shell.pip.tv.notification.action.SHOW_PIP_MENU"; @@ -207,7 +208,8 @@ public class TvPipNotificationController { } private static PendingIntent createPendingIntent(Context context, String action) { - return PendingIntent.getBroadcast(context, 0, new Intent(action), + return PendingIntent.getBroadcast(context, 0, + new Intent(action).setPackage(context.getPackageName()), PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE); } @@ -223,7 +225,7 @@ public class TvPipNotificationController { void register() { if (mRegistered) return; - mContext.registerReceiverForAllUsers(this, mIntentFilter, null /* permission */, + mContext.registerReceiverForAllUsers(this, mIntentFilter, SYSTEMUI_PERMISSION, mMainHandler); mRegistered = true; }