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

Commit e45ca723 authored by Joanne Chung's avatar Joanne Chung Committed by Automerger Merge Worker
Browse files

Merge "Validate checkInstallConstraints() installer package name" into udc-dev am: d359469b

parents 07d71516 d359469b
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1316,6 +1316,11 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements

        final var snapshot = mPm.snapshotComputer();
        final int callingUid = Binder.getCallingUid();
        final var callingPackageName = snapshot.getNameForUid(callingUid);
        if (!TextUtils.equals(callingPackageName, installerPackageName)) {
            throw new SecurityException("The installerPackageName set by the caller doesn't match "
                    + "the caller's own package name.");
        }
        if (!PackageManagerServiceUtils.isSystemOrRootOrShell(callingUid)) {
            for (var packageName : packageNames) {
                var ps = snapshot.getPackageStateInternal(packageName);