diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk index 2b2800bf6..d462a85ee 100644 --- a/core/dex_preopt_odex_install.mk +++ b/core/dex_preopt_odex_install.mk @@ -279,19 +279,39 @@ $(my_built_dm): $(my_copied_vdex) $(ZIPTIME) $(eval $(call copy-one-file,$(my_built_dm),$(my_installed_dm))) endif -# PRODUCT_SYSTEM_SERVER_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO. -my_system_server_debug_info := $(PRODUCT_SYSTEM_SERVER_DEBUG_INFO) -ifeq (,$(filter eng, $(TARGET_BUILD_VARIANT))) -# Only enable for non-eng builds. -ifeq (,$(my_system_server_debug_info)) -my_system_server_debug_info := true -endif +# By default, emit debug info. +my_dexpreopt_debug_info := true +# If the global setting suppresses mini-debug-info, disable it. +ifeq (false,$(WITH_DEXPREOPT_DEBUG_INFO)) + my_dexpreopt_debug_info := false endif -ifeq (true, $(my_system_server_debug_info)) - ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE))) - LOCAL_DEX_PREOPT_FLAGS += --generate-mini-debug-info +# PRODUCT_SYSTEM_SERVER_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO. +# PRODUCT_OTHER_JAVA_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO. +ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE))) + ifeq (true,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO)) + my_dexpreopt_debug_info := true + else ifeq (false,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO)) + my_dexpreopt_debug_info := false endif +else + ifeq (true,$(PRODUCT_OTHER_JAVA_DEBUG_INFO)) + my_dexpreopt_debug_info := true + else ifeq (false,$(PRODUCT_OTHER_JAVA_DEBUG_INFO)) + my_dexpreopt_debug_info := false + endif +endif + +# Never enable on eng. +ifeq (eng,$(filter eng, $(TARGET_BUILD_VARIANT))) +my_dexpreopt_debug_info := false +endif + +# Add dex2oat flag for debug-info/no-debug-info. +ifeq (true,$(my_dexpreopt_debug_info)) + LOCAL_DEX_PREOPT_FLAGS += --generate-mini-debug-info +else ifeq (false,$(my_dexpreopt_debug_info)) + LOCAL_DEX_PREOPT_FLAGS += --no-generate-mini-debug-info endif # Set the compiler reason to 'prebuilt' to identify the oat files produced diff --git a/core/product.mk b/core/product.mk index 19ede82dd..8e1fb9526 100644 --- a/core/product.mk +++ b/core/product.mk @@ -128,6 +128,7 @@ _product_var_list := \ PRODUCT_VENDOR_VERITY_PARTITION \ PRODUCT_PRODUCT_VERITY_PARTITION \ PRODUCT_SYSTEM_SERVER_DEBUG_INFO \ + PRODUCT_OTHER_JAVA_DEBUG_INFO \ PRODUCT_DEX_PREOPT_MODULE_CONFIGS \ PRODUCT_DEX_PREOPT_DEFAULT_COMPILER_FILTER \ PRODUCT_DEX_PREOPT_DEFAULT_FLAGS \ diff --git a/core/product_config.mk b/core/product_config.mk index 2620adb10..9406812ab 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -413,6 +413,8 @@ PRODUCT_SYSTEM_SERVER_COMPILER_FILTER := \ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_SERVER_COMPILER_FILTER)) PRODUCT_SYSTEM_SERVER_DEBUG_INFO := \ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_SERVER_DEBUG_INFO)) +PRODUCT_OTHER_JAVA_DEBUG_INFO := \ + $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OTHER_JAVA_DEBUG_INFO)) # Resolve and setup per-module dex-preopt configs. PRODUCT_DEX_PREOPT_MODULE_CONFIGS := \