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

Commit 78d6e340 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "No direct Uri grants from system."

parents 76932df9 2dfe92c2
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -8103,7 +8103,12 @@ public class ActivityManagerService extends IActivityManager.Stub
        // Third...  does the caller itself have permission to access
        // Third...  does the caller itself have permission to access
        // this uri?
        // this uri?
        if (UserHandle.getAppId(callingUid) != Process.SYSTEM_UID) {
        final int callingAppId = UserHandle.getAppId(callingUid);
        if ((callingAppId == Process.SYSTEM_UID) || (callingAppId == Process.ROOT_UID)) {
            Slog.w(TAG, "For security reasons, the system cannot issue a Uri permission"
                    + " grant to " + grantUri + "; use startActivityAsCaller() instead");
            return -1;
        } else {
            if (!checkHoldingPermissionsLocked(pm, pi, grantUri, callingUid, modeFlags)) {
            if (!checkHoldingPermissionsLocked(pm, pi, grantUri, callingUid, modeFlags)) {
                // Require they hold a strong enough Uri permission
                // Require they hold a strong enough Uri permission
                if (!checkUriPermissionLocked(grantUri, callingUid, modeFlags)) {
                if (!checkUriPermissionLocked(grantUri, callingUid, modeFlags)) {