Merge "Fix: APEX gets .jar.jar suffix when TARGET_FLATTEN_APEX is true"
diff --git a/java/droiddoc.go b/java/droiddoc.go
index 055eb07..0d2842a 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -72,7 +72,7 @@
`mkdir -p "$outDir" "$srcJarDir" "$stubsDir" && ` +
`${config.ZipSyncCmd} -d $srcJarDir -l $srcJarDir/list -f "*.java" $srcJars && ` +
`${config.JavaCmd} -jar ${config.MetalavaJar} -encoding UTF-8 -source $javaVersion @$out.rsp @$srcJarDir/list ` +
- `$bootclasspathArgs $classpathArgs $sourcepathArgs --no-banner --color --quiet ` +
+ `$bootclasspathArgs $classpathArgs $sourcepathArgs --no-banner --color --quiet --format=v2 ` +
`$opts && ` +
`${config.SoongZipCmd} -write_if_changed -jar -o $out -C $stubsDir -D $stubsDir`,
CommandDeps: []string{
@@ -93,7 +93,7 @@
Command: `( rm -rf "$srcJarDir" && mkdir -p "$srcJarDir" && ` +
`${config.ZipSyncCmd} -d $srcJarDir -l $srcJarDir/list -f "*.java" $srcJars && ` +
`${config.JavaCmd} -jar ${config.MetalavaJar} -encoding UTF-8 -source $javaVersion @$out.rsp @$srcJarDir/list ` +
- `$bootclasspathArgs $classpathArgs $sourcepathArgs --no-banner --color --quiet ` +
+ `$bootclasspathArgs $classpathArgs $sourcepathArgs --no-banner --color --quiet --format=v2 ` +
`$opts && touch $out ) || ` +
`( echo -e "$msg" ; exit 38 )`,
CommandDeps: []string{
diff --git a/java/hiddenapi.go b/java/hiddenapi.go
index de72e7c..29f23b1 100644
--- a/java/hiddenapi.go
+++ b/java/hiddenapi.go
@@ -68,18 +68,27 @@
` echo "--input-dex=$${INPUT_DEX}"; ` +
` echo "--output-dex=$tmpDir/dex-output/$$(basename $${INPUT_DEX})"; ` +
`done | xargs ${config.HiddenAPI} encode --api-flags=$flags && ` +
- `${config.SoongZipCmd} -o $tmpDir/dex.jar -C $tmpDir/dex-output -f "$tmpDir/dex-output/classes*.dex" && ` +
+ `${config.SoongZipCmd} $soongZipFlags -o $tmpDir/dex.jar -C $tmpDir/dex-output -f "$tmpDir/dex-output/classes*.dex" && ` +
`${config.MergeZipsCmd} -D -zipToNotStrip $tmpDir/dex.jar -stripFile "classes*.dex" $out $tmpDir/dex.jar $in`,
CommandDeps: []string{
"${config.HiddenAPI}",
"${config.SoongZipCmd}",
"${config.MergeZipsCmd}",
},
-}, "flags", "tmpDir")
+}, "flags", "tmpDir", "soongZipFlags")
-func hiddenAPIEncodeDex(ctx android.ModuleContext, output android.WritablePath, dexInput android.WritablePath) {
+func hiddenAPIEncodeDex(ctx android.ModuleContext, output android.WritablePath, dexInput android.WritablePath,
+ uncompressDex bool) {
+
flags := &bootImagePath{ctx.Config().HiddenAPIFlags()}
+ // 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 := ""
+ if uncompressDex {
+ soongZipFlags = "-L 0"
+ }
+
ctx.Build(pctx, android.BuildParams{
Rule: hiddenAPIEncodeDexRule,
Description: "hiddenapi encode dex",
@@ -87,8 +96,9 @@
Output: output,
Implicit: flags,
Args: map[string]string{
- "flags": flags.String(),
- "tmpDir": android.PathForModuleOut(ctx, "hiddenapi", "dex").String(),
+ "flags": flags.String(),
+ "tmpDir": android.PathForModuleOut(ctx, "hiddenapi", "dex").String(),
+ "soongZipFlags": soongZipFlags,
},
})
diff --git a/java/java.go b/java/java.go
index 209d0a7..9c4bd86 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1188,7 +1188,7 @@
}
if isBootJar {
hiddenAPIJar := android.PathForModuleOut(ctx, "hiddenapi", jarName)
- hiddenAPIEncodeDex(ctx, hiddenAPIJar, dexOutputFile)
+ hiddenAPIEncodeDex(ctx, hiddenAPIJar, dexOutputFile, j.deviceProperties.UncompressDex)
dexOutputFile = hiddenAPIJar
}
}
diff --git a/ui/build/paths/config.go b/ui/build/paths/config.go
index 5344e3f..531c5d5 100644
--- a/ui/build/paths/config.go
+++ b/ui/build/paths/config.go
@@ -90,6 +90,7 @@
"grep": Allowed,
"gzip": Allowed,
"hexdump": Allowed,
+ "hostname": Allowed,
"jar": Allowed,
"java": Allowed,
"javap": Allowed,
@@ -97,9 +98,6 @@
"m4": Allowed,
"openssl": Allowed,
"patch": Allowed,
- "pgrep": Allowed,
- "pkill": Allowed,
- "ps": Allowed,
"pstree": Allowed,
"python": Allowed,
"python2.7": Allowed,
@@ -112,7 +110,6 @@
"timeout": Allowed,
"tr": Allowed,
"unzip": Allowed,
- "which": Allowed,
"xz": Allowed,
"zip": Allowed,
"zipinfo": Allowed,
@@ -145,7 +142,6 @@
"expr": Toybox,
"head": Toybox,
"getconf": Toybox,
- "hostname": Toybox,
"id": Toybox,
"ln": Toybox,
"ls": Toybox,
@@ -155,6 +151,9 @@
"mv": Toybox,
"od": Toybox,
"paste": Toybox,
+ "pgrep": Toybox,
+ "pkill": Toybox,
+ "ps": Toybox,
"pwd": Toybox,
"readlink": Toybox,
"rm": Toybox,
@@ -175,6 +174,7 @@
"unix2dos": Toybox,
"wc": Toybox,
"whoami": Toybox,
+ "which": Toybox,
"xargs": Toybox,
"xxd": Toybox,
}