Support excluding overlays when enforcing RRO
PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS will be used to specify overlays
to be excluded from enforcing RRO.
The excluded overlays will be applied into the original package.
Bug: 63600240
Bug: 65001751
Test: succeeded building with
PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS := \
vendor/google/google_overlay/static_only \
vendor/google/nexus_overlay/common/static_only
and confirmed that config_webview_packages existed in framework-res.apk
with the overlayed value, but not in framework-res__auto_generated_rro.apk.
Change-Id: I0bfb44fc7726710bb78d9100404bc6dd29d06a73
diff --git a/core/package_internal.mk b/core/package_internal.mk
index a626dde..11138db 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -122,7 +122,18 @@
endif
endif
-ifndef enforce_rro_enabled
+ifdef enforce_rro_enabled
+ ifneq ($(PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS),)
+ static_only_resource_overlays := $(filter $(addsuffix %,$(PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS)),$(package_resource_overlays))
+ ifneq ($(static_only_resource_overlays),)
+ package_resource_overlays := $(filter-out $(static_only_resource_overlays),$(package_resource_overlays))
+ LOCAL_RESOURCE_DIR := $(static_only_resource_overlays) $(LOCAL_RESOURCE_DIR)
+ ifeq ($(package_resource_overlays),)
+ enforce_rro_enabled :=
+ endif
+ endif
+ endif
+else
LOCAL_RESOURCE_DIR := $(package_resource_overlays) $(LOCAL_RESOURCE_DIR)
endif