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.

(cherry picked from commit 6a90210c62)

Test: update marlin device
Test: make and look at services.odex

Bug: 62356545

Merged-In: Id51726ae03576d7b4eb784b861158bb451c39deb
Change-Id: Id51726ae03576d7b4eb784b861158bb451c39deb
This commit is contained in:
Mathieu Chartier 2017-06-23 10:44:45 -07:00 committed by Andreas Gampe
parent abcf66b538
commit 6228ec2d07
4 changed files with 28 additions and 9 deletions

View File

@ -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

View File

@ -214,6 +214,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))

View File

@ -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 \

View File

@ -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))