Don't install java libraries that are already in an apex.
This need to have -hostdex rules not look at the installFile.
In the near future, all -hostdex files come from jars that are in an apex.
bug: 119868597
Test: m
Change-Id: I4423626c5ced5d098ddd97c122fbfced54f817fc
diff --git a/java/java.go b/java/java.go
index 9c4bd86..7e82c59 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1395,7 +1395,7 @@
j.deviceProperties.UncompressDex = j.shouldUncompressDex(ctx)
j.compile(ctx)
- if Bool(j.properties.Installable) || ctx.Host() {
+ if (Bool(j.properties.Installable) || ctx.Host()) && !android.DirectlyInAnyApex(ctx, ctx.ModuleName()) {
if j.deviceProperties.UncompressDex {
alignedOutputFile := android.PathForModuleOut(ctx, "aligned", ctx.ModuleName()+".jar")
TransformZipAlign(ctx, alignedOutputFile, j.outputFile)