From 6a90210c62a76925827fd65f5e7e96318eb9ac5a Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Fri, 23 Jun 2017 10:44:45 -0700 Subject: [PATCH] Add product system server compiler filter property The product only needs to specify PRODUCT_SYSTEM_SERVER_COMPILER_FILTER. This determines what compiler filter system server jars are compiled with. Test: update marlin device Test: make and look at services.odex Bug: 62356545 Change-Id: Id51726ae03576d7b4eb784b861158bb451c39deb --- core/dex_preopt_odex_install.mk | 28 +++++++++++++++++++--------- core/main.mk | 5 +++++ core/product.mk | 1 + core/product_config.mk | 3 +++ 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk index 9c543dde1..76d56c05b 100644 --- a/core/dex_preopt_odex_install.mk +++ b/core/dex_preopt_odex_install.mk @@ -175,18 +175,28 @@ LOCAL_DEX_PREOPT_FLAGS := $(PRODUCT_DEX_PREOPT_DEFAULT_FLAGS) endif endif +my_system_server_compiler_filter := $(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER) +ifeq (,$(my_system_server_compiler_filter)) +my_system_server_compiler_filter := speed +endif + ifeq (,$(filter --compiler-filter=%, $(LOCAL_DEX_PREOPT_FLAGS))) - ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS) $(PRODUCT_DEXPREOPT_SPEED_APPS) $(PRODUCT_SYSTEM_SERVER_APPS),$(LOCAL_MODULE))) - # Jars of system server, apps loaded into system server, and apps the product default to being - # compiled with the 'speed' compiler filter. - LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed + ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE))) + # Jars of system server, use the product option if it is set, speed otherwise. + LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=$(my_system_server_compiler_filter) else - ifeq (true,$(LOCAL_DEX_PREOPT_GENERATE_PROFILE)) - # For non system server jars, use speed-profile when we have a profile. - LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed-profile + ifneq (,$(filter $(PRODUCT_DEXPREOPT_SPEED_APPS) $(PRODUCT_SYSTEM_SERVER_APPS),$(LOCAL_MODULE))) + # Apps loaded into system server, and apps the product default to being compiled with the + # 'speed' compiler filter. + LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed else - # If no compiler filter is specified, default to 'quicken' to save on storage. - LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=quicken + ifeq (true,$(LOCAL_DEX_PREOPT_GENERATE_PROFILE)) + # For non system server jars, use speed-profile when we have a profile. + LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed-profile + else + # If no compiler filter is specified, default to 'quicken' to save on storage. + LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=quicken + endif endif endif endif diff --git a/core/main.mk b/core/main.mk index a70274c05..b30a70b23 100644 --- a/core/main.mk +++ b/core/main.mk @@ -227,6 +227,11 @@ ifdef TARGET_2ND_ARCH endif endif +# Add the system server compiler filter if they are specified for the product. +ifneq (,$(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER)) +ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.systemservercompilerfilter=$(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER) +endif + ## user/userdebug ## user_variant := $(filter user userdebug,$(TARGET_BUILD_VARIANT)) diff --git a/core/product.mk b/core/product.mk index fd22532ae..9314a36a5 100644 --- a/core/product.mk +++ b/core/product.mk @@ -124,6 +124,7 @@ _product_var_list := \ PRODUCT_DEX_PREOPT_DEFAULT_FLAGS \ PRODUCT_DEX_PREOPT_BOOT_FLAGS \ PRODUCT_DEX_PREOPT_PROFILE_DIR \ + PRODUCT_SYSTEM_SERVER_COMPILER_FILTER \ PRODUCT_SANITIZER_MODULE_CONFIGS \ PRODUCT_SYSTEM_BASE_FS_PATH \ PRODUCT_VENDOR_BASE_FS_PATH \ diff --git a/core/product_config.mk b/core/product_config.mk index 8b908daf3..c39b82250 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -383,6 +383,9 @@ PRODUCT_DEX_PREOPT_BOOT_FLAGS := \ PRODUCT_DEX_PREOPT_PROFILE_DIR := \ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_PROFILE_DIR)) +PRODUCT_SYSTEM_SERVER_COMPILER_FILTER := \ + $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_SERVER_COMPILER_FILTER)) + # Resolve and setup per-module dex-preopt configs. PRODUCT_DEX_PREOPT_MODULE_CONFIGS := \ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_MODULE_CONFIGS))