From 860b4f6f6587af294dedcd0e1d5b9b5d276c479c Mon Sep 17 00:00:00 2001 From: Achim Thesmann Date: Thu, 16 Feb 2023 16:37:36 -0800 Subject: [PATCH] Allow RemoteViews to start Activities via PI A remoteview shows an UI rendered by another app and allows starting that app's Activity. Since that App probably does not possess BAL permissions the App showing the RemoteView needs to grant its permissions. Bug: 269240329 Test: manual testing with feature enabled Change-Id: Ic2ec605631654cead5cb6cf47c4d0125b0765b7a (cherry picked from commit cbef1ced7523dddac75f07b7036e06b020feb063) --- core/java/android/widget/RemoteViews.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java index a339062677361..18874f7689295 100644 --- a/core/java/android/widget/RemoteViews.java +++ b/core/java/android/widget/RemoteViews.java @@ -6717,6 +6717,10 @@ public class RemoteViews implements Parcelable, Filter { Log.w(LOG_TAG, "getLaunchOptions: view.getDisplay() is null!", new Exception()); } + // If the user interacts with a visible element it is safe to assume they consent that + // something is going to start. + opts.setPendingIntentBackgroundActivityStartMode( + ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED); return Pair.create(intent, opts); } }