Merge "Ensure that only SysUI can override pending intent launch flags" into qt-dev am: c741c6211c am: 41bf4e7cba am: 7adf19f3fa

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20219552

Change-Id: Ic7c18fc4fa02b79d3fad18653e4c2e9ad424ea12
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Winson Chung
2022-11-05 01:13:23 +00:00
committed by Automerger Merge Worker

View File

@@ -326,11 +326,16 @@ public final class PendingIntentRecord extends IIntentSender.Stub {
resolvedType = key.requestResolvedType; resolvedType = key.requestResolvedType;
} }
// Apply any launch flags from the ActivityOptions. This is to ensure that the caller // Apply any launch flags from the ActivityOptions. This is used only by SystemUI
// can specify a consistent launch mode even if the PendingIntent is immutable // 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); final ActivityOptions opts = ActivityOptions.fromBundle(options);
if (opts != null) { 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 // Extract options before clearing calling identity