From 418258cee9d8b97dcff17653de562e465957d360 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Mon, 28 Aug 2017 14:19:35 -0700 Subject: [PATCH] Allow system server jars for WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY Renamed WITH_DEXPREOPT_BOOT_IMG_ONLY to WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY and changed the behavior accordingly. 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. Test: make and flash and look at system server maps Bug: 65122284 Bug: 62356545 Change-Id: I49f2a23337fdd2bc2e628b683d26a0c135b2aabe --- core/dex_preopt.mk | 6 +++--- core/dex_preopt_odex_install.mk | 9 ++++++--- core/product.mk | 2 +- target/board/generic/BoardConfig.mk | 2 +- target/board/generic_arm64/BoardConfig.mk | 2 +- target/board/generic_mips/BoardConfig.mk | 2 +- target/board/generic_mips64/BoardConfig.mk | 2 +- target/board/generic_x86/BoardConfig.mk | 2 +- target/board/generic_x86_64/BoardConfig.mk | 2 +- target/board/generic_x86_arm/BoardConfig.mk | 2 +- 10 files changed, 17 insertions(+), 14 deletions(-) diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk index 0606c83bc9..8e496a78ac 100644 --- a/core/dex_preopt.mk +++ b/core/dex_preopt.mk @@ -30,10 +30,10 @@ install-on-system-other = $(filter-out $(PRODUCT_DEXPREOPT_SPEED_APPS) $(PRODUCT # Conditional to building on linux, as dex2oat currently does not work on darwin. ifeq ($(HOST_OS),linux) WITH_DEXPREOPT ?= true -# For an eng build only pre-opt the boot image. This gives reasonable performance and still -# allows a simple workflow: building in frameworks/base and syncing. +# For an eng build only pre-opt the boot image and system server. This gives reasonable performance +# and still allows a simple workflow: building in frameworks/base and syncing. ifeq (eng,$(TARGET_BUILD_VARIANT)) - WITH_DEXPREOPT_BOOT_IMG_ONLY ?= true + WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY ?= true endif # Add mini-debug-info to the boot classpath unless explicitly asked not to. ifneq (false,$(WITH_DEXPREOPT_DEBUG_INFO)) diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk index 136def470a..c30ddff425 100644 --- a/core/dex_preopt_odex_install.mk +++ b/core/dex_preopt_odex_install.mk @@ -33,9 +33,12 @@ endif ifeq (,$(strip $(built_dex)$(my_prebuilt_src_file))) # contains no java code LOCAL_DEX_PREOPT := endif -# if WITH_DEXPREOPT_BOOT_IMG_ONLY=true and module is not in boot class path skip -ifeq (true,$(WITH_DEXPREOPT_BOOT_IMG_ONLY)) -ifeq ($(filter $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE)),) +# 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. +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 diff --git a/core/product.mk b/core/product.mk index 6722526c80..8f7db19efd 100644 --- a/core/product.mk +++ b/core/product.mk @@ -302,7 +302,7 @@ _product_stash_var_list += \ _product_stash_var_list += \ DEFAULT_SYSTEM_DEV_CERTIFICATE \ WITH_DEXPREOPT \ - WITH_DEXPREOPT_BOOT_IMG_ONLY \ + WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY \ WITH_DEXPREOPT_APP_IMAGE # diff --git a/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk index 8bb3ed0d90..331f082196 100644 --- a/target/board/generic/BoardConfig.mk +++ b/target/board/generic/BoardConfig.mk @@ -34,7 +34,7 @@ USE_CAMERA_STUB := true ifeq ($(HOST_OS),linux) ifeq ($(WITH_DEXPREOPT),) WITH_DEXPREOPT := true - WITH_DEXPREOPT_BOOT_IMG_ONLY := false + WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY := false endif endif diff --git a/target/board/generic_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk index a7a8943efb..46c8865a4f 100644 --- a/target/board/generic_arm64/BoardConfig.mk +++ b/target/board/generic_arm64/BoardConfig.mk @@ -65,7 +65,7 @@ USE_CAMERA_STUB := true ifeq ($(HOST_OS),linux) ifeq ($(WITH_DEXPREOPT),) WITH_DEXPREOPT := true - WITH_DEXPREOPT_BOOT_IMG_ONLY := false + WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY := false endif endif diff --git a/target/board/generic_mips/BoardConfig.mk b/target/board/generic_mips/BoardConfig.mk index a9e46b42a3..fb66d21f89 100644 --- a/target/board/generic_mips/BoardConfig.mk +++ b/target/board/generic_mips/BoardConfig.mk @@ -42,7 +42,7 @@ USE_CAMERA_STUB := true ifeq ($(HOST_OS),linux) ifeq ($(WITH_DEXPREOPT),) WITH_DEXPREOPT := true - WITH_DEXPREOPT_BOOT_IMG_ONLY := false + WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY := false endif endif diff --git a/target/board/generic_mips64/BoardConfig.mk b/target/board/generic_mips64/BoardConfig.mk index 6cb6c11a57..67bb51f715 100644 --- a/target/board/generic_mips64/BoardConfig.mk +++ b/target/board/generic_mips64/BoardConfig.mk @@ -57,7 +57,7 @@ USE_CAMERA_STUB := true ifeq ($(HOST_OS),linux) ifeq ($(WITH_DEXPREOPT),) WITH_DEXPREOPT := true - WITH_DEXPREOPT_BOOT_IMG_ONLY := false + WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY := false endif endif diff --git a/target/board/generic_x86/BoardConfig.mk b/target/board/generic_x86/BoardConfig.mk index bb2166b536..000a9a310e 100644 --- a/target/board/generic_x86/BoardConfig.mk +++ b/target/board/generic_x86/BoardConfig.mk @@ -22,7 +22,7 @@ USE_CAMERA_STUB := true # of an SDK AVD. Note that this operation only works on Linux for now ifeq ($(HOST_OS),linux) WITH_DEXPREOPT ?= true -WITH_DEXPREOPT_BOOT_IMG_ONLY ?= false +WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY ?= false endif TARGET_USES_HWC2 := true diff --git a/target/board/generic_x86_64/BoardConfig.mk b/target/board/generic_x86_64/BoardConfig.mk index b49a10ca01..883dd2e5c4 100755 --- a/target/board/generic_x86_64/BoardConfig.mk +++ b/target/board/generic_x86_64/BoardConfig.mk @@ -28,7 +28,7 @@ USE_CAMERA_STUB := true # of an SDK AVD. Note that this operation only works on Linux for now ifeq ($(HOST_OS),linux) WITH_DEXPREOPT ?= true -WITH_DEXPREOPT_BOOT_IMG_ONLY ?= false +WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY ?= false endif TARGET_USES_HWC2 := true diff --git a/target/board/generic_x86_arm/BoardConfig.mk b/target/board/generic_x86_arm/BoardConfig.mk index 4555f1f07f..131c0014ff 100644 --- a/target/board/generic_x86_arm/BoardConfig.mk +++ b/target/board/generic_x86_arm/BoardConfig.mk @@ -39,7 +39,7 @@ USE_CAMERA_STUB := true ifeq ($(HOST_OS),linux) ifeq ($(WITH_DEXPREOPT),) WITH_DEXPREOPT := true - WITH_DEXPREOPT_BOOT_IMG_ONLY := false + WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY := false endif endif