Add product property for preopting extracted APKs

The property is PRODUCT_ALWAYS_PREOPT_EXTRACTED_APK. If specified,
this preopts the APK with the default compile filter (quicken).

This will be used to quicken preopt of gmscore dynamite modules when
preopting is disabled. This fixes a possible RAM regression caused
by running out of the APK.

Bug: 65601274
Test: make and flash

(cherry picked from commit 0fbb836cf6)

Merged-In: Ibf0fa73ee7fafd9735e587baf19c4950a7da817a
Change-Id: Ibf0fa73ee7fafd9735e587baf19c4950a7da817a
This commit is contained in:
Mathieu Chartier 2017-09-15 13:40:48 -07:00
parent 58cd98dc47
commit 55eabd5511
4 changed files with 15 additions and 1 deletions

View File

@ -36,12 +36,16 @@ endif
# if WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY=true and module is not in boot class path skip
# Also preopt system server jars since selinux prevents system server from loading anything from
# /data. If we don't do this they will need to be extracted which is not favorable for RAM usage
# or performance.
# or performance. If my_preopt_for_extracted_apk is true, we ignore the only preopt boot image
# options.
ifneq (true,$(my_preopt_for_extracted_apk))
ifeq (true,$(WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY))
ifeq ($(filter $(PRODUCT_SYSTEM_SERVER_JARS) $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE)),)
LOCAL_DEX_PREOPT :=
endif
endif
endif
# if installing into system, and odex are being installed into system_other, don't strip
ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
ifeq ($(LOCAL_DEX_PREOPT),true)

View File

@ -269,6 +269,11 @@ $(my_extracted_apk): $(my_prebuilt_src_file)
my_prebuilt_src_file := $(my_extracted_apk)
my_extracted_apk :=
my_extract_apk :=
ifeq ($(PRODUCT_ALWAYS_PREOPT_EXTRACTED_APK),true)
# If the product property is set, always preopt for extracted modules to prevent executing out of
# the APK.
my_preopt_for_extracted_apk := true
endif
endif
rs_compatibility_jni_libs :=
@ -602,3 +607,4 @@ endif # JAVA_LIBRARIES
$(built_module) : $(LOCAL_ADDITIONAL_DEPENDENCIES)
my_prebuilt_src_file :=
my_preopt_for_extracted_apk :=

View File

@ -115,6 +115,7 @@ _product_var_list := \
PRODUCT_SYSTEM_PROPERTY_BLACKLIST \
PRODUCT_SYSTEM_SERVER_APPS \
PRODUCT_SYSTEM_SERVER_JARS \
PRODUCT_ALWAYS_PREOPT_EXTRACTED_APK \
PRODUCT_DEXPREOPT_SPEED_APPS \
PRODUCT_VBOOT_SIGNING_KEY \
PRODUCT_VBOOT_SIGNING_SUBKEY \

View File

@ -260,6 +260,9 @@ PRODUCT_SYSTEM_SERVER_JARS := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYS
PRODUCT_SYSTEM_SERVER_APPS := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_SERVER_APPS))
PRODUCT_DEXPREOPT_SPEED_APPS := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEXPREOPT_SPEED_APPS))
# All of the apps that we force preopt, this overrides WITH_DEXPREOPT.
PRODUCT_ALWAYS_PREOPT_EXTRACTED_APK := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ALWAYS_PREOPT_EXTRACTED_APK))
# Find the device that this product maps to.
TARGET_DEVICE := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEVICE)