Build java_sdk_library modules when UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true
java_sdk_library modules are usually disabled in favor of prebuilts
when TARGET_BUILD_APPS is set. Keep them enabled when
UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true, which is used by some unbundled
builds built from a full source tree like mainline modules.
Bug: 123183568
Test: m TARGET_PRODUCT=mainline_modules_arm UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true TARGET_BUILD_APPS=com.android.media
Change-Id: Ifa940769e467ca4b7ad3b95106e184c00680d2ae
diff --git a/java/sdk_library.go b/java/sdk_library.go
index d33149b..ca3131c 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -396,7 +396,9 @@
props.Sdk_version = proptools.StringPtr(module.sdkVersion(apiScope))
props.Libs = module.sdkLibraryProperties.Stub_only_libs
// Unbundled apps will use the prebult one from /prebuilts/sdk
- props.Product_variables.Unbundled_build.Enabled = proptools.BoolPtr(false)
+ if mctx.Config().UnbundledBuildPrebuiltSdks() {
+ props.Product_variables.Unbundled_build.Enabled = proptools.BoolPtr(false)
+ }
props.Product_variables.Pdk.Enabled = proptools.BoolPtr(false)
props.No_standard_libs = module.Library.Module.properties.No_standard_libs
props.System_modules = module.Library.Module.deviceProperties.System_modules
@@ -596,7 +598,7 @@
// to satisfy SdkLibraryDependency interface
func (module *sdkLibrary) HeaderJars(ctx android.BaseContext, sdkVersion string) android.Paths {
// This module is just a wrapper for the stubs.
- if ctx.Config().UnbundledBuild() {
+ if ctx.Config().UnbundledBuildPrebuiltSdks() {
return module.PrebuiltJars(ctx, sdkVersion)
} else {
if strings.HasPrefix(sdkVersion, "system_") {
@@ -612,7 +614,7 @@
// to satisfy SdkLibraryDependency interface
func (module *sdkLibrary) ImplementationJars(ctx android.BaseContext, sdkVersion string) android.Paths {
// This module is just a wrapper for the stubs.
- if ctx.Config().UnbundledBuild() {
+ if ctx.Config().UnbundledBuildPrebuiltSdks() {
return module.PrebuiltJars(ctx, sdkVersion)
} else {
if strings.HasPrefix(sdkVersion, "system_") {