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

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

Merge "Avoid using UserHandle.isSameApp() in package check" into main

parents 696cc850 46ed73f7
Loading
Loading
Loading
Loading
+21 −23
Original line number Diff line number Diff line
@@ -5590,15 +5590,16 @@ public class ActivityManagerService extends IActivityManager.Stub
            // security checking for it above.
            userId = UserHandle.USER_CURRENT;
        }
        try {
        if (owningUid != 0 && owningUid != SYSTEM_UID) {
                final int uid = AppGlobals.getPackageManager().getPackageUid(packageName,
                        MATCH_DEBUG_TRIAGED_MISSING, UserHandle.getUserId(owningUid));
                if (!UserHandle.isSameApp(owningUid, uid)) {
            if (!getPackageManagerInternal().isSameApp(
                    packageName,
                    MATCH_DEBUG_TRIAGED_MISSING,
                    owningUid,
                    UserHandle.getUserId(owningUid))) {
                String msg = "Permission Denial: getIntentSender() from pid="
                        + Binder.getCallingPid()
                        + ", uid=" + owningUid
                            + ", (need uid=" + uid + ")"
                        + " is not allowed to send as package " + packageName;
                Slog.w(TAG, msg);
                throw new SecurityException(msg);
@@ -5613,9 +5614,6 @@ public class ActivityManagerService extends IActivityManager.Stub
        return mPendingIntentController.getIntentSender(type, packageName, featureId,
                owningUid, userId, token, resultWho, requestCode, intents, resolvedTypes,
                flags, bOptions);
        } catch (RemoteException e) {
            throw new SecurityException(e);
        }
    }
    @Override