Allow PRODUCT_COPY_FILES to copy raw APKs into system_other
Files in this partition aren't actually installed, so we don't need to
use the BUILD_PREBUILT logic for APKs.
Bug: 66960479
Test: try PRODUCT_COPY_FILES of an apk into system, errors
Test: try PRODUCT_COPY_FILES of an apk into system_other, accepted
Change-Id: Ie721d2b884c6badfbe0e46f55c265b770bed618b
diff --git a/core/Makefile b/core/Makefile
index 706b371..3073f91 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -12,9 +12,11 @@
# The filter part means "only eval the copy-one-file rule if this
# src:dest pair is the first one to match the same dest"
#$(1): the src:dest pair
+#$(2): the dest
define check-product-copy-files
-$(if $(filter %.apk, $(call word-colon, 2, $(1))),$(error \
- Prebuilt apk found in PRODUCT_COPY_FILES: $(1), use BUILD_PREBUILT instead!))
+$(if $(filter-out $(TARGET_COPY_OUT_SYSTEM_OTHER)/%,$(2)), \
+ $(if $(filter %.apk, $(2)),$(error \
+ Prebuilt apk found in PRODUCT_COPY_FILES: $(1), use BUILD_PREBUILT instead!)))
endef
# filter out the duplicate <source file>:<dest file> pairs.
unique_product_copy_files_pairs :=
@@ -26,7 +28,7 @@
$(foreach cf,$(unique_product_copy_files_pairs), \
$(eval _src := $(call word-colon,1,$(cf))) \
$(eval _dest := $(call word-colon,2,$(cf))) \
- $(call check-product-copy-files,$(cf)) \
+ $(call check-product-copy-files,$(cf),$(_dest)) \
$(if $(filter $(unique_product_copy_files_destinations),$(_dest)), \
$(eval product_copy_files_ignored += $(cf)), \
$(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \