Add support for preopted app images

Enable iff WITH_DEXPREOPT_APP_IMAGE is true.

Test: Clean + build with the flag on and off. Tested Sailfish
booting.

Bug: 34927277

Change-Id: I9b74d1a5fc554803fddb29b6cb30a0f6efd80f8e
This commit is contained in:
Mathieu Chartier 2017-02-08 18:30:31 -08:00
parent d326af8253
commit e8ab2a71d7
4 changed files with 24 additions and 3 deletions

View file

@ -124,5 +124,6 @@ $(hide) ANDROID_LOG_TAGS="*:e" $(DEX2OAT) \
--abort-on-hard-verifier-error \
--no-inline-from=core-oj.jar \
$(PRIVATE_DEX_PREOPT_FLAGS) \
$(PRIVATE_ART_FILE_PREOPT_FLAGS) \
$(GLOBAL_DEXPREOPT_FLAGS)
endef

View file

@ -50,10 +50,14 @@ endif
built_odex :=
built_vdex :=
built_art :=
installed_odex :=
installed_vdex :=
installed_art :=
built_installed_odex :=
built_installed_vdex :=
built_installed_art :=
ifdef LOCAL_DEX_PREOPT
dexpreopt_boot_jar_module := $(filter $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE))
ifdef dexpreopt_boot_jar_module
@ -103,8 +107,10 @@ endif # boot jar
built_odex := $(strip $(built_odex))
built_vdex := $(strip $(built_vdex))
built_art := $(strip $(built_art))
installed_odex := $(strip $(installed_odex))
installed_vdex := $(strip $(installed_vdex))
installed_art := $(strip $(installed_art))
ifdef built_odex
ifndef LOCAL_DEX_PREOPT_FLAGS
@ -113,16 +119,18 @@ 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)
$(built_vdex): $(built_odex)
$(built_art): $(built_odex)
endif
# Add the installed_odex to the list of installed files for this module.
ALL_MODULES.$(my_register_name).INSTALLED += $(installed_odex)
ALL_MODULES.$(my_register_name).INSTALLED += $(installed_vdex)
ALL_MODULES.$(my_register_name).INSTALLED += $(installed_art)
ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_odex)
ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_vdex)
ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_art)
# Record dex-preopt config.
DEXPREOPT.$(LOCAL_MODULE).DEX_PREOPT := $(LOCAL_DEX_PREOPT)
@ -138,6 +146,6 @@ DEXPREOPT.MODULES.$(LOCAL_MODULE_CLASS) := $(sort \
# Make sure to install the .odex and .vdex when you run "make <module_name>"
$(my_all_targets): $(installed_odex) $(installed_vdex)
$(my_all_targets): $(installed_odex) $(installed_vdex) $(installed_art)
endif # LOCAL_DEX_PREOPT

View file

@ -289,7 +289,8 @@ _product_stash_var_list += \
_product_stash_var_list += \
DEFAULT_SYSTEM_DEV_CERTIFICATE \
WITH_DEXPREOPT \
WITH_DEXPREOPT_BOOT_IMG_ONLY
WITH_DEXPREOPT_BOOT_IMG_ONLY \
WITH_DEXPREOPT_APP_IMAGE
#
# Mark the variables in _product_stash_var_list as readonly

View file

@ -36,6 +36,17 @@ my_installed_odex := $(call get-odex-installed-file-path,$($(my_2nd_arch_prefix)
my_built_vdex := $(patsubst %.odex,%.vdex,$(my_built_odex))
my_installed_vdex := $(patsubst %.odex,%.vdex,$(my_installed_odex))
my_installed_art := $(patsubst %.odex,%.art,$(my_installed_odex))
ifeq (true,$(WITH_DEXPREOPT_APP_IMAGE))
my_built_art := $(patsubst %.odex,%.art,$(my_built_odex))
$(my_built_odex): PRIVATE_ART_FILE_PREOPT_FLAGS := --app-image-file=$(my_built_art) \
--image-format=lz4
$(eval $(call copy-one-file,$(my_built_art),$(my_installed_art)))
built_art += $(my_built_art)
installed_art += $(my_installed_art)
built_installed_art += $(my_built_art):$(my_installed_art)
endif
$(eval $(call copy-one-file,$(my_built_odex),$(my_installed_odex)))
$(eval $(call copy-one-file,$(my_built_vdex),$(my_installed_vdex)))