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

Commit c7c04890 authored by Nicolas Prevot's avatar Nicolas Prevot
Browse files

Fix: always allow getProviderMimeType within the same user.

Even if the ContentProvider is locked down.

BUG: 17428869
Change-Id: Id54edcd2589677973b7db538356943d23b250660
parent f8a52c06
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -9665,15 +9665,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);
@@ -9700,6 +9695,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
    // =========================================================