From 8faf8fc06076cda933232204f643c35e244b0938 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 16 Jan 2019 15:15:52 -0800 Subject: Move hiddenapi to Soong Perform hiddenapi CSV generation and dex encoding for Soong modules in Soong. This fixes an issue where dexpreopting was happening on a different jar than was being installed. Bug: 122856783 Test: m checkbuild Test: no change out/target/common/obj/PACKAGING/hiddenapi-flags.csv Test: only ordering change to out/target/common/obj/PACKAGING/hiddenapi-greylist.csv Test: cts/tests/signature/runSignatureTests.sh Change-Id: I4fc481efc29e73cb2bdaacf672e86d5f6f0075ae --- java/java.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'java/java.go') diff --git a/java/java.go b/java/java.go index 2ac5a5b46..49095ca36 100644 --- a/java/java.go +++ b/java/java.go @@ -1172,12 +1172,25 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars ...android.Path j.implementationAndResourcesJar = implementationAndResourcesJar if ctx.Device() && (Bool(j.properties.Installable) || Bool(j.deviceProperties.Compile_dex)) { + // Dex compilation var dexOutputFile android.ModuleOutPath dexOutputFile = j.compileDex(ctx, flags, outputFile, jarName) if ctx.Failed() { return } + // Hidden API CSV generation and dex encoding + isBootJar := inList(ctx.ModuleName(), ctx.Config().BootJars()) + if isBootJar || inList(ctx.ModuleName(), ctx.Config().HiddenAPIExtraAppUsageJars()) { + // Derive the greylist from classes jar. + hiddenAPIGenerateCSV(ctx, j.implementationJarFile) + } + if isBootJar { + hiddenAPIJar := android.PathForModuleOut(ctx, "hiddenapi", jarName) + hiddenAPIEncodeDex(ctx, hiddenAPIJar, dexOutputFile) + dexOutputFile = hiddenAPIJar + } + // merge dex jar with resources if necessary if j.resourceJar != nil { jars := android.Paths{dexOutputFile, j.resourceJar} @@ -1189,6 +1202,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars ...android.Path j.dexJarFile = dexOutputFile + // Dexpreopting j.dexpreopter.isInstallable = Bool(j.properties.Installable) j.dexpreopter.uncompressedDex = j.deviceProperties.UncompressDex dexOutputFile = j.dexpreopt(ctx, dexOutputFile) -- cgit v1.2.3-59-g8ed1b