summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2022-10-18 05:21:30 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-05-18 22:14:33 +0000
commit0c2215c1bdadaa96b54e78299624203a6b887f72 (patch)
tree6adfbad337bfe8922790291a9ba6a32b6919d46b
parent95de1c46f2bb03f07e9079b8d2a998b26ae773ed (diff)
downloadbase-0c2215c1bdadaa96b54e78299624203a6b887f72.tar.gz
Ensure that only SysUI can override pending intent launch flags
- Originally added in ag/5139951, this method ensured that activities launched from widgets are always started in a new task (if the activity is launched in the home task, the task is not brough forward with the recents transition). We can restrict this to only recents callers since this only applies to 1p launchers in gesture nav (both the gesture with 3p launchers and button nav in general will always start the home intent directly, which makes adding the NEW_TASK flag unnecessary). Bug: 243794108 Test: Ensure that the original bug b/112508020 still works (with the test app in the bug, swipe up still works after launching an activity from the widget, and fails without applying the override flags) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:c4d3106e347922610f8c554de3ae238175ed393e) Merged-In: Id53c6a2aa6da5933d488ca06a0bfc4ef89a4c343 Change-Id: Id53c6a2aa6da5933d488ca06a0bfc4ef89a4c343
-rw-r--r--services/core/java/com/android/server/am/PendingIntentRecord.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/am/PendingIntentRecord.java b/services/core/java/com/android/server/am/PendingIntentRecord.java
index bda60ff2172b..8624ee031a93 100644
--- a/services/core/java/com/android/server/am/PendingIntentRecord.java
+++ b/services/core/java/com/android/server/am/PendingIntentRecord.java
@@ -379,11 +379,16 @@ public final class PendingIntentRecord extends IIntentSender.Stub {
resolvedType = key.requestResolvedType;
}
- // Apply any launch flags from the ActivityOptions. This is to ensure that the caller
- // can specify a consistent launch mode even if the PendingIntent is immutable
+ // Apply any launch flags from the ActivityOptions. This is used only by SystemUI
+ // to ensure that we can launch the pending intent with a consistent launch mode even
+ // if the provided PendingIntent is immutable (ie. to force an activity to launch into
+ // a new task, or to launch multiple instances if supported by the app)
final ActivityOptions opts = ActivityOptions.fromBundle(options);
if (opts != null) {
- finalIntent.addFlags(opts.getPendingIntentLaunchFlags());
+ // TODO(b/254490217): Move this check into SafeActivityOptions
+ if (controller.mAtmInternal.isCallerRecents(Binder.getCallingUid())) {
+ finalIntent.addFlags(opts.getPendingIntentLaunchFlags());
+ }
}
// Extract options before clearing calling identity