Propagate ephemeral flag from adb install to PackageParser

This fixes the bug where adb install --ephemeral switch was not
propagated to PackageParser.collectCertificates.

Bug: 34060793
Test: Modified PackageParser.collectCertificates to print received flags, invoked adb install with and without --ephemeral
Change-Id: I562008e4275f7a40fd923022d80e2b42f6dc6e6f
This commit is contained in:
Alex Klyubin
2017-01-03 16:25:33 -08:00
parent 16ea7f7640
commit 58bfae414e

View File

@@ -703,8 +703,11 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
for (File addedFile : addedFiles) {
final ApkLite apk;
try {
apk = PackageParser.parseApkLite(
addedFile, PackageParser.PARSE_COLLECT_CERTIFICATES);
int flags = PackageParser.PARSE_COLLECT_CERTIFICATES;
if ((params.installFlags & PackageManager.INSTALL_EPHEMERAL) != 0) {
flags |= PackageParser.PARSE_IS_EPHEMERAL;
}
apk = PackageParser.parseApkLite(addedFile, flags);
} catch (PackageParserException e) {
throw PackageManagerException.from(e);
}