From 1b2242895ea1538b094a54be3100880f92bd2bb2 Mon Sep 17 00:00:00 2001 From: Jaekyun Seok Date: Thu, 30 Mar 2017 11:25:02 +0900 Subject: [PATCH] Use product-based inclusive rule for enforcing RRO Board-based rule can cause unexpected regression because build-time overlays are different among products. So each product should be tested with its own product-based rule considering its build-time overlays before applying enforcing RRO. Additionally RRO conversion is mandatory only for overlays of which target is included in AOSP system image and is critical for CTS/VTS tests with AOSP system image. So inclusive rule is more suitable instead of exclusive rule to avoid unexpected regression due to unnecessary RRO conversion. Note that we still support conversion for all the overlays by specifying PRODUCT_ENFORCE_RRO_TARGETS as "*". Test: building succeeded and tested with auto-generated RROs. Bug: 36231603 Change-Id: I8e1d701d4f78b818c89ef3e7638110105370c5bc (cherry picked from commit 2a209997e8b4eee2b4571d569b1995f29b8e111d) --- core/main.mk | 4 ++-- core/package_internal.mk | 10 ++++++---- core/product.mk | 1 + core/product_config.mk | 4 ++++ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/core/main.mk b/core/main.mk index 8200a4c4d..63f1bf58e 100644 --- a/core/main.mk +++ b/core/main.mk @@ -497,7 +497,7 @@ ADDITIONAL_DEFAULT_PROPERTIES := $(strip $(ADDITIONAL_DEFAULT_PROPERTIES)) ADDITIONAL_BUILD_PROPERTIES := $(strip $(ADDITIONAL_BUILD_PROPERTIES)) .KATI_READONLY := ADDITIONAL_BUILD_PROPERTIES -ifeq ($(BOARD_ENFORCE_RRO),true) +ifneq ($(PRODUCT_ENFORCE_RRO_TARGETS),) ENFORCE_RRO_SOURCES := endif @@ -571,7 +571,7 @@ endif # ONE_SHOT_MAKEFILE # Enforce to generate all RRO packages for modules having resource # overlays. # ------------------------------------------------------------------- -ifeq ($(BOARD_ENFORCE_RRO),true) +ifneq ($(PRODUCT_ENFORCE_RRO_TARGETS),) $(call generate_all_enforce_rro_packages) endif diff --git a/core/package_internal.mk b/core/package_internal.mk index f68a388e8..312fd9df8 100644 --- a/core/package_internal.mk +++ b/core/package_internal.mk @@ -101,9 +101,11 @@ package_resource_overlays := $(strip \ $(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR))))) enforce_rro_enabled := -ifeq ($(BOARD_ENFORCE_RRO),true) - ifeq (,$(filter $(LOCAL_PACKAGE_NAME), $(BOARD_ENFORCE_RRO_EXEMPT_SOURCES))) - ifneq ($(package_resource_overlays),) +ifneq ($(PRODUCT_ENFORCE_RRO_TARGETS),) + ifneq ($(package_resource_overlays),) + ifeq ($(PRODUCT_ENFORCE_RRO_TARGETS),*) + enforce_rro_enabled := true + else ifneq (,$(filter $(LOCAL_PACKAGE_NAME), $(PRODUCT_ENFORCE_RRO_TARGETS))) enforce_rro_enabled := true endif endif @@ -693,4 +695,4 @@ $(call append_enforce_rro_sources, \ $(enforce_rro_use_res_lib), \ $(package_resource_overlays) \ ) -endif # enforce_rro_enabled \ No newline at end of file +endif # enforce_rro_enabled diff --git a/core/product.mk b/core/product.mk index fffd7c8ff..3d201689b 100644 --- a/core/product.mk +++ b/core/product.mk @@ -94,6 +94,7 @@ _product_var_list := \ PRODUCT_EXTRA_RECOVERY_KEYS \ PRODUCT_PACKAGE_OVERLAYS \ DEVICE_PACKAGE_OVERLAYS \ + PRODUCT_ENFORCE_RRO_TARGETS \ PRODUCT_SDK_ATREE_FILES \ PRODUCT_SDK_ADDON_NAME \ PRODUCT_SDK_ADDON_COPY_FILES \ diff --git a/core/product_config.mk b/core/product_config.mk index 7a2d9cbdd..8246c141f 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -424,3 +424,7 @@ PRODUCT_ART_USE_READ_BARRIER := \ # Whether the product is an Android Things variant. PRODUCT_IOT := \ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_IOT)) + +# Package list to apply enforcing RRO. +PRODUCT_ENFORCE_RRO_TARGETS := \ + $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ENFORCE_RRO_TARGETS))