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

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

Merge "Fix usages of getCallingUserId()/Uid() in CdmService"

parents b57f5871 2562902d
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -406,9 +406,8 @@ public class CompanionDeviceManagerService extends SystemService {

        @Override
        public List<AssociationInfo> getAssociations(String packageName, int userId) {
            final int callingUid = getCallingUserId();
            if (!checkCallerCanManageAssociationsForPackage(getContext(), userId, packageName)) {
                throw new SecurityException("Caller (uid=" + callingUid + ") does not have "
                throw new SecurityException("Caller (uid=" + getCallingUid() + ") does not have "
                        + "permissions to get associations for u" + userId + "/" + packageName);
            }

+2 −2
Original line number Diff line number Diff line
@@ -154,14 +154,14 @@ final class PermissionsUtils {
    }

    static boolean checkCallerCanManageCompanionDevice(@NonNull Context context) {
        if (getCallingUserId() == SYSTEM_UID) return true;
        if (getCallingUid() == SYSTEM_UID) return true;

        return context.checkCallingPermission(MANAGE_COMPANION_DEVICES) == PERMISSION_GRANTED;
    }

    static void enforceCallerCanManagerCompanionDevice(@NonNull Context context,
            @Nullable String message) {
        if (getCallingUserId() == SYSTEM_UID) return;
        if (getCallingUid() == SYSTEM_UID) return;

        context.enforceCallingPermission(MANAGE_COMPANION_DEVICES, message);
    }