Limit bypass staged installer API to system and shell only

Bug: 148664742
Test: manually check access the api inproperly throws
Change-Id: I568b9df87d30c8da6dd85f0310bf7af1d60b4ea3
This commit is contained in:
Jerry Chang
2020-04-21 23:25:16 +08:00
parent e23c8dd158
commit d9a3cf013c

View File

@@ -979,6 +979,9 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
@Override
public void bypassNextStagedInstallerCheck(boolean value) {
if (!isCalledBySystemOrShell(Binder.getCallingUid())) {
throw new SecurityException("Caller not allowed to bypass staged installer check");
}
mBypassNextStagedInstallerCheck = value;
}