Add comments and slight refactor auto-RRO logic

Make it a bit clearer what this code is intended to do.

Bug: 127758779
Test: verify noop on presubmit targets
Change-Id: Ic405fc5d4601b9f0a91b4d24caa06f279267c51a
This commit is contained in:
Anton Hansson 2019-03-14 18:53:58 +00:00
parent c6bf520424
commit fd06b02b30
1 changed files with 18 additions and 23 deletions

View File

@ -116,34 +116,29 @@ package_resource_overlays := $(strip \
$(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR)))))
enforce_rro_enabled :=
ifneq ($(PRODUCT_ENFORCE_RRO_TARGETS),)
ifneq ($(package_resource_overlays),)
ifeq ($(PRODUCT_ENFORCE_RRO_TARGETS),*)
# * means all system APKs, so enable conditionally based on module path.
# Note that base_rules.mk has not yet been included, so it's likely that only
# one of LOCAL_MODULE_PATH and the LOCAL_X_MODULE flags has been set.
ifeq (,$(LOCAL_MODULE_PATH))
non_system_module := $(filter true,\
$(LOCAL_ODM_MODULE) \
$(LOCAL_OEM_MODULE) \
$(LOCAL_PRODUCT_MODULE) \
$(LOCAL_PRODUCT_SERVICES_MODULE) \
$(LOCAL_PROPRIETARY_MODULE) \
$(LOCAL_VENDOR_MODULE))
enforce_rro_enabled := $(if $(non_system_module),,true)
else ifneq ($(filter $(TARGET_OUT)/%,$(LOCAL_MODULE_PATH)),)
enforce_rro_enabled := true
endif
else ifneq (,$(filter $(LOCAL_PACKAGE_NAME), $(PRODUCT_ENFORCE_RRO_TARGETS)))
enforce_rro_enabled := true
endif
endif
ifdef enforce_rro_enabled
ifeq (,$(LOCAL_MODULE_PATH))
ifeq (true,$(LOCAL_PROPRIETARY_MODULE))
enforce_rro_enabled :=
else ifeq (true,$(LOCAL_OEM_MODULE))
enforce_rro_enabled :=
else ifeq (true,$(LOCAL_ODM_MODULE))
enforce_rro_enabled :=
else ifeq (true,$(LOCAL_PRODUCT_MODULE))
enforce_rro_enabled :=
else ifeq (true,$(LOCAL_PRODUCT_SERVICES_MODULE))
enforce_rro_enabled :=
endif
else ifeq ($(filter $(TARGET_OUT)/%,$(LOCAL_MODULE_PATH)),)
enforce_rro_enabled :=
endif
endif
endif
ifdef enforce_rro_enabled
ifneq ($(PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS),)
static_only_resource_overlays := $(filter $(addsuffix %,$(PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS)),$(package_resource_overlays))