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

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

Merge "TCMS: Trust the package name for requests by the system."

parents 4f77f313 1dd34cac
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -425,9 +425,12 @@ public final class TextClassificationManagerService extends ITextClassifierServi
        if (packageName == null) return;

        try {
            final int uid = context.getPackageManager()
            final int packageUid = context.getPackageManager()
                    .getPackageUidAsUser(packageName, UserHandle.getCallingUserId());
            Preconditions.checkArgument(Binder.getCallingUid() == uid);
            final int callingUid = Binder.getCallingUid();
            Preconditions.checkArgument(callingUid == packageUid
                    // Trust the system process:
                    || callingUid == android.os.Process.SYSTEM_UID);
        } catch (Exception e) {
            throw new RemoteException(
                    String.format("Invalid package: name=%s, error=%s", packageName, e));