Don't dexpreopt when compile_dex but not installable
Modules shouldn't be dexpreopted and possibly stripped when
compile_dex is set but installable is not set. This matches the
previous behavior when the dexpreopt rules were in Make.
Bug: 121317615
Test: dexpreopt_test.go
Change-Id: I6f80b7b37a990c475b91aa5d98a19a3baa85eb1b
diff --git a/java/dexpreopt.go b/java/dexpreopt.go
index de9c5f3..1dc3e9f 100644
--- a/java/dexpreopt.go
+++ b/java/dexpreopt.go
@@ -28,10 +28,11 @@
type dexpreopter struct {
dexpreoptProperties DexpreoptProperties
- installPath android.OutputPath
- isPrivApp bool
- isSDKLibrary bool
- isTest bool
+ installPath android.OutputPath
+ isPrivApp bool
+ isSDKLibrary bool
+ isTest bool
+ isInstallable bool
builtInstalled []string
}
@@ -74,6 +75,10 @@
return true
}
+ if !d.isInstallable {
+ return true
+ }
+
// TODO: contains no java code
return false