diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk index d3da8fe53b..b588c781c9 100644 --- a/target/product/runtime_libart.mk +++ b/target/product/runtime_libart.mk @@ -30,10 +30,43 @@ PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += com.android.runtime # ART APEX module. -# Note that this package includes the minimal boot classpath JARs (listed in -# ART_APEX_JARS), which should no longer be added directly to PRODUCT_PACKAGES. -PRODUCT_PACKAGES += com.android.art-autoselect -PRODUCT_HOST_PACKAGES += com.android.art-autoselect +# +# Select either release (com.android.art) or debug (com.android.art.debug) +# variant of the ART APEX. By default, "user" build variants contain the release +# module, while the "eng" build variant contain the debug module. However, if +# `PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD` is defined, it overrides the previous +# logic: +# - if `PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD` is set to `false`, the +# build will include the release module (whatever the build +# variant); +# - if `PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD` is set to `true`, the +# build will include the debug module (whatever the build variant). +# +# Note that the ART APEX package includes the minimal boot classpath JARs +# (listed in ART_APEX_JARS), which should no longer be added directly to +# PRODUCT_PACKAGES. + +art_target_include_debug_build := $(PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD) +ifneq (false,$(art_target_include_debug_build)) + ifneq (,$(filter eng,$(TARGET_BUILD_VARIANT))) + art_target_include_debug_build := true + endif +endif + +ifeq (true,$(art_target_include_debug_build)) + PRODUCT_PACKAGES += com.android.art.debug + apex_test_module := art-check-debug-apex-gen-fakebin +else + PRODUCT_PACKAGES += com.android.art + apex_test_module := art-check-release-apex-gen-fakebin +endif + +ifeq (true,$(SOONG_CONFIG_art_module_source_build) + PRODUCT_HOST_PACKAGES += $(apex_test_module) +endif + +art_target_include_debug_build := +apex_test_module := # Certificates. PRODUCT_PACKAGES += \