From 282065ab15b5c17ac4cb88760de38e4cb37ae192 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 17 May 2018 07:13:43 -0700 Subject: [PATCH] Don't always filter out --auto-add-overlay There are some cases where --auto-add-overlay is added for legitimite reasons, for example in RROs. Only filter it out from modules that were using --extra-packages for support library modules. Test: m FORCE_AAPT2=true java Change-Id: I165fa577f2204ecbc57e71f946db3f346568ad81 --- core/force_aapt2.mk | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/core/force_aapt2.mk b/core/force_aapt2.mk index 41bf710e8..690111600 100644 --- a/core/force_aapt2.mk +++ b/core/force_aapt2.mk @@ -30,12 +30,16 @@ ifeq ($(FORCE_AAPT2),true) frameworks/support/%,\ $(LOCAL_RESOURCE_DIR)) # Filter out unnecessary aapt flags - LOCAL_AAPT_FLAGS := $(subst --extra-packages=,--extra-packages$(space), \ - $(filter-out \ - --extra-packages=android.support.% \ - --extra-packages=androidx.% \ - --auto-add-overlay,\ - $(subst --extra-packages$(space),--extra-packages=,$(LOCAL_AAPT_FLAGS)))) + ifneq (,$(filter --extra-packages,$(LOCAL_AAPT_FLAGS))) + LOCAL_AAPT_FLAGS := $(subst --extra-packages=,--extra-packages$(space), \ + $(filter-out \ + --extra-packages=android.support.% \ + --extra-packages=androidx.%, \ + $(subst --extra-packages$(space),--extra-packages=,$(LOCAL_AAPT_FLAGS)))) + ifeq (,$(filter --extra-packages,$(LOCAL_AAPT_FLAGS))) + LOCAL_AAPT_FLAGS := $(filter-out --auto-add-overlay,$(LOCAL_AAPT_FLAGS)) + endif + endif # AAPT2 is pickier about missing resources. Support library may have references to resources # added in current, so always treat LOCAL_SDK_VERSION as LOCAL_SDK_RES_VERSION := current.