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

Commit 0ecb0c43 authored by Nicolas Prevot's avatar Nicolas Prevot Committed by Android (Google) Code Review
Browse files

Merge "Fix: always allow getProviderMimeType within the same user." into lmp-dev

parents 726f2fe3 c7c04890
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -9711,15 +9711,10 @@ public final class ActivityManagerService extends ActivityManagerNative
        long ident = 0;
        boolean clearedIdentity = false;
        userId = unsafeConvertIncomingUser(userId);
        if (UserHandle.getUserId(callingUid) != userId) {
            if (checkComponentPermission(INTERACT_ACROSS_USERS, callingPid,
                    callingUid, -1, true) == PackageManager.PERMISSION_GRANTED
                    || checkComponentPermission(INTERACT_ACROSS_USERS_FULL, callingPid,
                    callingUid, -1, true) == PackageManager.PERMISSION_GRANTED) {
        if (canClearIdentity(callingPid, callingUid, userId)) {
            clearedIdentity = true;
            ident = Binder.clearCallingIdentity();
        }
        }
        ContentProviderHolder holder = null;
        try {
            holder = getContentProviderExternalUnchecked(name, null, userId);
@@ -9746,6 +9741,19 @@ public final class ActivityManagerService extends ActivityManagerNative
        return null;
    }
    private boolean canClearIdentity(int callingPid, int callingUid, int userId) {
        if (UserHandle.getUserId(callingUid) == userId) {
            return true;
        }
        if (checkComponentPermission(INTERACT_ACROSS_USERS, callingPid,
                callingUid, -1, true) == PackageManager.PERMISSION_GRANTED
                || checkComponentPermission(INTERACT_ACROSS_USERS_FULL, callingPid,
                callingUid, -1, true) == PackageManager.PERMISSION_GRANTED) {
                return true;
        }
        return false;
    }
    // =========================================================
    // GLOBAL MANAGEMENT
    // =========================================================