Don't build hiddenapi flags or encode dex for unbundled builds
Builds with TARGET_BUILD_APPS shouldn't build the hiddenapi flags
or encode dex files even if frameworks/base exists.
Bug: 133343287
Test: mainline modules build
Change-Id: I0647451420fd09bb680808b35e1ad3b8f514ba46
diff --git a/java/hiddenapi_singleton.go b/java/hiddenapi_singleton.go
index 9627dc6..b1ddab4 100644
--- a/java/hiddenapi_singleton.go
+++ b/java/hiddenapi_singleton.go
@@ -61,7 +61,7 @@
stubFlagsRule(ctx)
// These rules depend on files located in frameworks/base, skip them if running in a tree that doesn't have them.
- if ctx.Config().FrameworksBaseDirExists(ctx) {
+ if ctx.Config().FrameworksBaseDirExists(ctx) && !ctx.Config().UnbundledBuild() {
h.flags = flagsRule(ctx)
h.metadata = metadataRule(ctx)
} else {
diff --git a/java/java.go b/java/java.go
index 4483083..8dbdfb6 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1301,9 +1301,11 @@
return
}
- // Hidden API CSV generation and dex encoding
- dexOutputFile = j.hiddenAPI.hiddenAPI(ctx, dexOutputFile, j.implementationJarFile,
- j.deviceProperties.UncompressDex)
+ if !ctx.Config().UnbundledBuild() {
+ // Hidden API CSV generation and dex encoding
+ dexOutputFile = j.hiddenAPI.hiddenAPI(ctx, dexOutputFile, j.implementationJarFile,
+ j.deviceProperties.UncompressDex)
+ }
// merge dex jar with resources if necessary
if j.resourceJar != nil {