Always do zipalign with uncompressDex.
Also preserve the alignment with hiddenapi.
Test: conscrypt apex has its conscrypt.jar zipaligned.
Change-Id: I43cc0eadb9548c3d8055e12c077fb7bbe1935fe6
diff --git a/java/hiddenapi.go b/java/hiddenapi.go
index 6a603cf..a06a666 100644
--- a/java/hiddenapi.go
+++ b/java/hiddenapi.go
@@ -85,23 +85,31 @@
// The encode dex rule requires unzipping and rezipping the classes.dex files, ensure that if it was uncompressed
// in the input it stays uncompressed in the output.
soongZipFlags := ""
+ tmpOutput := output
+ tmpDir := android.PathForModuleOut(ctx, "hiddenapi", "dex")
if uncompressDex {
soongZipFlags = "-L 0"
+ tmpOutput = android.PathForModuleOut(ctx, "hiddenapi", "unaligned", "unaligned.jar")
+ tmpDir = android.PathForModuleOut(ctx, "hiddenapi", "unaligned")
}
ctx.Build(pctx, android.BuildParams{
Rule: hiddenAPIEncodeDexRule,
Description: "hiddenapi encode dex",
Input: dexInput,
- Output: output,
+ Output: tmpOutput,
Implicit: flags,
Args: map[string]string{
"flags": flags.String(),
- "tmpDir": android.PathForModuleOut(ctx, "hiddenapi", "dex").String(),
+ "tmpDir": tmpDir.String(),
"soongZipFlags": soongZipFlags,
},
})
+ if uncompressDex {
+ TransformZipAlign(ctx, output, tmpOutput)
+ }
+
hiddenAPISaveDexInputs(ctx, dexInput)
}