Merge "Validate checkInstallConstraints() installer package name" into udc-dev am: d359469b9b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23053819 Change-Id: Idbf85a57521de09e144c2bb65f0f551000fa28ef Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user