From acd7db8c7b61f0dd828a55785178fe14a4430911 Mon Sep 17 00:00:00 2001 From: Jeff Hamilton Date: Fri, 18 Jan 2019 15:12:21 -0500 Subject: Fake out ApplicationInfo for APEXs. This should be generated properly from the AndroidManifest, but for now this is helpful to proceed with APEX testing. Test: build Bug: 123086053 Change-Id: I0e7182e4924c0bc26cee9c9bed520acaffccf905 --- core/java/android/content/pm/PackageParser.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index 486edf085efc..b15647215dc7 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -8488,6 +8488,18 @@ public class PackageParser { public static PackageInfo generatePackageInfoFromApex(File apexFile, boolean collectCerts) throws PackageParserException { PackageInfo pi = new PackageInfo(); + + // TODO(b/123086053) properly fill in the ApplicationInfo with data from AndroidManifest + // Add ApplicationInfo to the PackageInfo. + ApplicationInfo ai = new ApplicationInfo(); + ai.sourceDir = apexFile.getPath(); + ai.flags = ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_INSTALLED; + ai.enabled = true; + ai.targetSdkVersion = 28; + ai.targetSandboxVersion = 0; + pi.applicationInfo = ai; + + // TODO(b/123052859): We should avoid these repeated calls to parseApkLite each time // we want to generate information for APEX modules. PackageParser.ApkLite apk = PackageParser.parseApkLite(apexFile, -- cgit v1.2.3-59-g8ed1b