diff options
-rw-r--r-- | core/clear_vars.mk | 1 | ||||
-rw-r--r-- | core/dex_preopt_libart.mk | 3 | ||||
-rw-r--r-- | core/dex_preopt_libart_boot.mk | 3 | ||||
-rw-r--r-- | core/dex_preopt_odex_install.mk | 15 | ||||
-rw-r--r-- | core/product.mk | 19 | ||||
-rw-r--r-- | core/product_config.mk | 18 |
6 files changed, 54 insertions, 5 deletions
diff --git a/core/clear_vars.mk b/core/clear_vars.mk index f23c4a6..92b3fc4 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -123,6 +123,7 @@ LOCAL_RENDERSCRIPT_SKIP_INSTALL:= LOCAL_RENDERSCRIPT_TARGET_API:= LOCAL_DEX_PREOPT:= # '',true,false,nostripping LOCAL_DEX_PREOPT_IMAGE_LOCATION:= +LOCAL_DEX_PREOPT_FLAGS:= LOCAL_PROTOC_OPTIMIZE_TYPE:= # lite(default),micro,nano,full LOCAL_PROTOC_FLAGS:= LOCAL_PROTO_JAVA_OUTPUT_PARAMS:= diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk index 5af2be2..4e43a86 100644 --- a/core/dex_preopt_libart.mk +++ b/core/dex_preopt_libart.mk @@ -91,5 +91,6 @@ $(hide) $(DEX2OATD) \ --android-root=$(PRODUCT_OUT)/system \ --instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \ --instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \ - --include-patch-information --runtime-arg -Xnorelocate --no-include-debug-symbols + --include-patch-information --runtime-arg -Xnorelocate --no-include-debug-symbols \ + $(PRIVATE_DEX_PREOPT_FLAGS) endef diff --git a/core/dex_preopt_libart_boot.mk b/core/dex_preopt_libart_boot.mk index fe4c5a4..620b464 100644 --- a/core/dex_preopt_libart_boot.mk +++ b/core/dex_preopt_libart_boot.mk @@ -53,4 +53,5 @@ $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGE --image=$@ --base=$(LIBART_IMG_TARGET_BASE_ADDRESS) \ --instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \ --instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \ - --android-root=$(PRODUCT_OUT)/system --include-patch-information --runtime-arg -Xnorelocate --no-include-debug-symbols + --android-root=$(PRODUCT_OUT)/system --include-patch-information --runtime-arg -Xnorelocate --no-include-debug-symbols \ + $(PRODUCT_DEX_PREOPT_BOOT_FLAGS) diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk index 741f9a3..90ae08f 100644 --- a/core/dex_preopt_odex_install.mk +++ b/core/dex_preopt_odex_install.mk @@ -11,7 +11,12 @@ else # WITH_DEXPREOPT=true ifndef LOCAL_DEX_PREOPT # LOCAL_DEX_PREOPT undefined ifneq ($(filter $(TARGET_OUT)/%,$(my_module_path)),) # Installed to system.img. ifeq (,$(LOCAL_APK_LIBRARIES)) # LOCAL_APK_LIBRARIES empty - LOCAL_DEX_PREOPT := $(DEX_PREOPT_DEFAULT) + # If we have product-specific config for this module? + ifeq (disable,$(DEXPREOPT.$(TARGET_PRODUCT).$(LOCAL_MODULE).CONFIG)) + LOCAL_DEX_PREOPT := false + else + LOCAL_DEX_PREOPT := $(DEX_PREOPT_DEFAULT) + endif else # LOCAL_APK_LIBRARIES not empty LOCAL_DEX_PREOPT := nostripping endif # LOCAL_APK_LIBRARIES not empty @@ -94,6 +99,14 @@ endif # libart endif # boot jar ifdef built_odex +ifndef LOCAL_DEX_PREOPT_FLAGS +LOCAL_DEX_PREOPT_FLAGS := $(DEXPREOPT.$(TARGET_PRODUCT).$(LOCAL_MODULE).CONFIG) +ifndef LOCAL_DEX_PREOPT_FLAGS +LOCAL_DEX_PREOPT_FLAGS := $(PRODUCT_DEX_PREOPT_DEFAULT_FLAGS) +endif +endif +$(built_odex): PRIVATE_DEX_PREOPT_FLAGS := $(LOCAL_DEX_PREOPT_FLAGS) + # Use pattern rule - we may have multiple installed odex files. # Ugly syntax - See the definition get-odex-file-path. $(installed_odex) : $(dir $(LOCAL_INSTALLED_MODULE))%$(notdir $(word 1,$(installed_odex))) \ diff --git a/core/product.mk b/core/product.mk index 0075acd..ed906cb 100644 --- a/core/product.mk +++ b/core/product.mk @@ -100,14 +100,18 @@ _product_var_list := \ PRODUCT_FACTORY_BUNDLE_MODULES \ PRODUCT_RUNTIMES \ PRODUCT_BOOT_JARS \ - PRODUCT_DEX_PREOPT_IMAGE_IN_DATA \ PRODUCT_SUPPORTS_VERITY \ PRODUCT_OEM_PROPERTIES \ PRODUCT_SYSTEM_PROPERTY_BLACKLIST \ PRODUCT_SYSTEM_SERVER_JARS \ PRODUCT_VERITY_SIGNING_KEY \ PRODUCT_SYSTEM_VERITY_PARTITION \ - PRODUCT_VENDOR_VERITY_PARTITION + PRODUCT_VENDOR_VERITY_PARTITION \ + PRODUCT_DEX_PREOPT_IMAGE_IN_DATA \ + PRODUCT_DEX_PREOPT_MODULE_CONFIGS \ + PRODUCT_DEX_PREOPT_DEFAULT_FLAGS \ + PRODUCT_DEX_PREOPT_BOOT_FLAGS \ + define dump-product $(info ==== $(1) ====)\ @@ -299,3 +303,14 @@ endef define add-to-product-copy-files-if-exists $(if $(wildcard $(word 1,$(subst :, ,$(1)))),$(1)) endef + +# whitespace placeholder when we record module's dex-preopt config. +_PDPMC_SP_PLACE_HOLDER := |@SP@| +# Set up dex-preopt config for a module. +# $(1) list of module names +# $(2) the modules' dex-preopt config +define add-product-dex-preopt-module-config +$(eval _c := $(subst $(space),$(_PDPMC_SP_PLACE_HOLDER),$(strip $(2))))\ +$(eval PRODUCT_DEX_PREOPT_MODULE_CONFIGS += \ + $(foreach m,$(1),$(m)=$(_c))) +endef diff --git a/core/product_config.mk b/core/product_config.mk index 32e351c..d4ba364 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -416,3 +416,21 @@ PRODUCT_EXTRA_RECOVERY_KEYS := $(sort \ # If there is no room in /system for the image, place it in /data PRODUCT_DEX_PREOPT_IMAGE_IN_DATA := \ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_IMAGE_IN_DATA)) + +PRODUCT_DEX_PREOPT_DEFAULT_FLAGS := \ + $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_DEFAULT_FLAGS)) +PRODUCT_DEX_PREOPT_BOOT_FLAGS := \ + $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_BOOT_FLAGS)) +# Resolve and setup per-module dex-preopot configs. +PRODUCT_DEX_PREOPT_MODULE_CONFIGS := \ + $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_MODULE_CONFIGS)) +# If a module has multiple setups, the first takes precedence. +_pdpmc_modules := +$(foreach c,$(PRODUCT_DEX_PREOPT_MODULE_CONFIGS),\ + $(eval m := $(firstword $(subst =,$(space),$(c))))\ + $(if $(filter $(_pdpmc_modules),$(m)),,\ + $(eval _pdpmc_modules += $(m))\ + $(eval cf := $(patsubst $(m)=%,%,$(c)))\ + $(eval cf := $(subst $(_PDPMC_SP_PLACE_HOLDER),$(space),$(cf)))\ + $(eval DEXPREOPT.$(TARGET_PRODUCT).$(m).CONFIG := $(cf)))) +_pdpmc_modules := |