diff options
| -rw-r--r-- | services/core/java/com/android/server/am/PendingIntentController.java | 15 | ||||
| -rw-r--r-- | services/core/java/com/android/server/am/PendingIntentRecord.java | 14 |
2 files changed, 28 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/am/PendingIntentController.java b/services/core/java/com/android/server/am/PendingIntentController.java index 7ee96aaca21d..a20623cd1ee9 100644 --- a/services/core/java/com/android/server/am/PendingIntentController.java +++ b/services/core/java/com/android/server/am/PendingIntentController.java @@ -26,6 +26,7 @@ import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NA import android.annotation.Nullable; import android.app.Activity; import android.app.ActivityManagerInternal; +import android.app.ActivityOptions; import android.app.AppGlobals; import android.app.PendingIntent; import android.app.PendingIntentStats; @@ -126,6 +127,18 @@ public class PendingIntentController { } } Bundle.setDefusable(bOptions, true); + ActivityOptions opts = ActivityOptions.fromBundle(bOptions); + if (opts != null && opts.getPendingIntentBackgroundActivityStartMode() + != ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED) { + Slog.wtf(TAG, "Resetting option setPendingIntentBackgroundActivityStartMode(" + + opts.getPendingIntentBackgroundActivityStartMode() + + ") to SYSTEM_DEFINED from the options provided by the pending " + + "intent creator (" + + packageName + + ") because this option is meant for the pending intent sender"); + opts.setPendingIntentBackgroundActivityStartMode( + ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED); + } final boolean noCreate = (flags & PendingIntent.FLAG_NO_CREATE) != 0; final boolean cancelCurrent = (flags & PendingIntent.FLAG_CANCEL_CURRENT) != 0; @@ -135,7 +148,7 @@ public class PendingIntentController { PendingIntentRecord.Key key = new PendingIntentRecord.Key(type, packageName, featureId, token, resultWho, requestCode, intents, resolvedTypes, flags, - SafeActivityOptions.fromBundle(bOptions), userId); + new SafeActivityOptions(opts), userId); WeakReference<PendingIntentRecord> ref; ref = mIntentSenderRecords.get(key); PendingIntentRecord rec = ref != null ? ref.get() : null; diff --git a/services/core/java/com/android/server/am/PendingIntentRecord.java b/services/core/java/com/android/server/am/PendingIntentRecord.java index 202d407651ad..a0e76f1d6af9 100644 --- a/services/core/java/com/android/server/am/PendingIntentRecord.java +++ b/services/core/java/com/android/server/am/PendingIntentRecord.java @@ -457,6 +457,20 @@ public final class PendingIntentRecord extends IIntentSender.Stub { // can specify a consistent launch mode even if the PendingIntent is immutable final ActivityOptions opts = ActivityOptions.fromBundle(options); if (opts != null) { + if (opts.getPendingIntentCreatorBackgroundActivityStartMode() + != ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED) { + Slog.wtf(TAG, + "Resetting option " + + "setPendingIntentCreatorBackgroundActivityStartMode(" + + opts.getPendingIntentCreatorBackgroundActivityStartMode() + + ") to SYSTEM_DEFINED from the options provided by the " + + "pending intent sender (" + + key.packageName + + ") because this option is meant for the pending intent " + + "creator"); + opts.setPendingIntentCreatorBackgroundActivityStartMode( + ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED); + } finalIntent.addFlags(opts.getPendingIntentLaunchFlags()); } |