From b11fc29b13f3bdfb4cc334cea868fd70a047f9fa Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 13 Feb 2019 13:14:07 -0800 Subject: [PATCH] Fix resource overlay order for static libraries If a static library has static library dependencies then all resources need to be moved to an overlay to maintain the correct ordering so that a static library resource overlays the same resource in a dependency. Bug: 124108931 Test: m checkbuild Change-Id: I6be9a80c53e6247a6589272ab0e653a9a0ded814 --- core/static_java_library.mk | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/core/static_java_library.mk b/core/static_java_library.mk index cee7c9edff..ee759b9d8e 100644 --- a/core/static_java_library.mk +++ b/core/static_java_library.mk @@ -85,14 +85,22 @@ R_file_stamp := $(intermediates.COMMON)/src/R.stamp LOCAL_INTERMEDIATE_TARGETS += $(R_file_stamp) ifeq ($(LOCAL_USE_AAPT2),true) -# For library we treat all the resource equal with no overlay. -my_res_resources := $(all_resources) -my_overlay_resources := -# For libraries put everything in the COMMON intermediate directory. -my_res_package := $(intermediates.COMMON)/package-res.apk + ifneq ($(strip $(LOCAL_STATIC_ANDROID_LIBRARIES) $(LOCAL_STATIC_JAVA_AAR_LIBRARIES)),) + # If we are using static android libraries, every source file becomes an overlay. + # This is to emulate old AAPT behavior which simulated library support. + my_res_resources := + my_overlay_resources := $(all_resources) + else + # Otherwise, for a library we treat all the resource equal with no overlay. + my_res_resources := $(all_resources) + my_overlay_resources := + endif + # For libraries put everything in the COMMON intermediate directory. + my_res_package := $(intermediates.COMMON)/package-res.apk -LOCAL_INTERMEDIATE_TARGETS += $(my_res_package) + LOCAL_INTERMEDIATE_TARGETS += $(my_res_package) endif # LOCAL_USE_AAPT2 + endif # need_compile_res all_res_assets := $(all_resources)