Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 37ca7ff0 authored by Nan Wu's avatar Nan Wu Committed by Android (Google) Code Review
Browse files

Merge "Prevent PI creator to set...

Merge "Prevent PI creator to set pendingIntentBackgroundActiivtyLaunchAllowedByPermission to true" into main
parents ae22150d b91b842b
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -146,6 +146,21 @@ public class PendingIntentController {
                        ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_SYSTEM_DEFINED);
            }

            if (opts != null && opts.isPendingIntentBackgroundActivityLaunchAllowedByPermission()) {
                Slog.wtf(TAG,
                        "Resetting option pendingIntentBackgroundActivityLaunchAllowedByPermission"
                                + " which is set by the pending intent creator ("
                                + packageName
                                + ") because this option is meant for the pending intent sender");
                if (CompatChanges.isChangeEnabled(PendingIntent.PENDING_INTENT_OPTIONS_CHECK,
                        callingUid)) {
                    throw new IllegalArgumentException(
                            "pendingIntentBackgroundActivityLaunchAllowedByPermission "
                                    + "can not be set by creator of a PendingIntent");
                }
                opts.setPendingIntentBackgroundActivityLaunchAllowedByPermission(false);
            }

            final boolean noCreate = (flags & PendingIntent.FLAG_NO_CREATE) != 0;
            final boolean cancelCurrent = (flags & PendingIntent.FLAG_CANCEL_CURRENT) != 0;
            final boolean updateCurrent = (flags & PendingIntent.FLAG_UPDATE_CURRENT) != 0;