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

Commit 194dc2cd authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix check creator token" into main

parents d64d10c2 e8d1338a
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -11672,6 +11672,7 @@ public class Intent implements Parcelable, Cloneable {
                Log.w(TAG, "Failure filling in extras", e);
            }
        }
        mCreatorTokenInfo = other.mCreatorTokenInfo;
        if (mayHaveCopiedUris && mContentUserHint == UserHandle.USER_CURRENT
                && other.mContentUserHint != UserHandle.USER_CURRENT) {
            mContentUserHint = other.mContentUserHint;
@@ -12224,6 +12225,13 @@ public class Intent implements Parcelable, Cloneable {
        mCreatorTokenInfo = null;
    }
    /** @hide */
    public void removeCreatorToken() {
        if (mCreatorTokenInfo != null) {
            mCreatorTokenInfo.mCreatorToken = null;
        }
    }
    /** @hide */
    public @Nullable IBinder getCreatorToken() {
        return mCreatorTokenInfo == null ? null : mCreatorTokenInfo.mCreatorToken;
@@ -12251,7 +12259,7 @@ public class Intent implements Parcelable, Cloneable {
    public void collectExtraIntentKeys() {
        if (!isPreventIntentRedirectEnabled()) return;
        if (mExtras != null && !mExtras.isParcelled() && !mExtras.isEmpty()) {
        if (mExtras != null && !mExtras.isEmpty()) {
            for (String key : mExtras.keySet()) {
                if (mExtras.get(key) instanceof Intent) {
                    if (mCreatorTokenInfo == null) {
+2 −0
Original line number Diff line number Diff line
@@ -5555,6 +5555,8 @@ public class ActivityManagerService extends IActivityManager.Stub
        if (target instanceof PendingIntentRecord) {
            final PendingIntentRecord originalRecord = (PendingIntentRecord) target;
            addCreatorToken(intent, originalRecord.getPackageName());
            // In multi-display scenarios, there can be background users who execute the
            // PendingIntent. In these scenarios, we don't want to use the foreground user as the
            // current user.
+1 −1
Original line number Diff line number Diff line
@@ -1275,8 +1275,8 @@ class ActivityStarter {
                        "Creator PermissionPolicyService.checkStartActivity Caused abortion.",
                        intent, intentCreatorUid, intentCreatorPackage, callingUid, callingPackage);
            }
            intent.removeCreatorTokenInfo();
        }
        intent.removeCreatorToken();

        // Merge the two options bundles, while realCallerOptions takes precedence.
        ActivityOptions checkedOptions = options != null
+0 −1
Original line number Diff line number Diff line
@@ -1228,7 +1228,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
            String callingFeatureId, Intent intent, String resolvedType, IBinder resultTo,
            String resultWho, int requestCode, int startFlags, ProfilerInfo profilerInfo,
            Bundle bOptions) {
        mAmInternal.addCreatorToken(intent, callingPackage);
        return startActivityAsUser(caller, callingPackage, callingFeatureId, intent, resolvedType,
                resultTo, resultWho, requestCode, startFlags, profilerInfo, bOptions,
                UserHandle.getCallingUserId());