Allow merging product_services into /product
Allow devices to specify TARGET_COPY_OUT_PRODUCT_SERVICES := product,
which in effect treats all product_services modules the same as product
modules.
Do not generate license and build props for product_services when
this settings is enabled.
Bug: 113098451
Test: boot downstream product
Change-Id: Id51230b969900bebcf19d0138dfd6187dfce25b1
diff --git a/core/Makefile b/core/Makefile
index 0bbaf12..72733f8 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -580,7 +580,12 @@
$(hide) build/make/tools/post_process_props.py $@
# -----------------------------------------------------------------
-# product_services build.prop
+# product_services build.prop (unless it's merged into /product)
+ifdef MERGE_PRODUCT_SERVICES_INTO_PRODUCT
+ ifneq (,$(PRODUCT_PRODUCT_SERVICES_PROPERTIES))
+ $(error PRODUCT_PRODUCT_SERVICES_PROPERTIES is not supported in this build.)
+ endif
+else
INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT_SERVICES)/build.prop
ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET)
@@ -588,7 +593,6 @@
$(call collapse-pairs, $(PRODUCT_PRODUCT_SERVICES_PROPERTIES))
FINAL_PRODUCT_SERVICES_PROPERTIES := $(call uniq-pairs-by-first-component, \
$(FINAL_PRODUCT_SERVICES_PROPERTIES),=)
-
$(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH)
@echo Target product_services buildinfo: $@
@mkdir -p $(dir $@)
@@ -602,6 +606,7 @@
$(hide) $(foreach line,$(FINAL_PRODUCT_SERVICES_PROPERTIES), \
echo "$(line)" >> $@;)
$(hide) build/make/tools/post_process_props.py $@
+endif # MERGE_PRODUCT_SERVICES_INTO_PRODUCT
# ----------------------------------------------------------------
@@ -1156,8 +1161,13 @@
$(copy-file-to-target)
$(installed_product_notice_xml_gz): $(target_product_notice_file_xml_gz)
$(copy-file-to-target)
+
+# No notice file for product_services if its contents are merged into /product.
+# The notices will be part of the /product notice file.
+ifndef MERGE_PRODUCT_SERVICES_INTO_PRODUCT
$(installed_product_services_notice_xml_gz): $(target_product_services_notice_file_xml_gz)
$(copy-file-to-target)
+endif
# if we've been run my mm, mmm, etc, don't reinstall this every time
ifeq ($(ONE_SHOT_MAKEFILE),)
diff --git a/core/envsetup.mk b/core/envsetup.mk
index bd632bf..17448f1 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -444,11 +444,16 @@
###########################################
# Now we can substitute with the real value of TARGET_COPY_OUT_PRODUCT_SERVICES
+MERGE_PRODUCT_SERVICES_INTO_PRODUCT :=
ifeq ($(TARGET_COPY_OUT_PRODUCT_SERVICES),$(_product_services_path_placeholder))
TARGET_COPY_OUT_PRODUCT_SERVICES := system/product_services
+else ifeq ($(TARGET_COPY_OUT_PRODUCT),$(TARGET_COPY_OUT_PRODUCT_SERVICES))
+ MERGE_PRODUCT_SERVICES_INTO_PRODUCT := true
else ifeq ($(filter product_services system/product_services,$(TARGET_COPY_OUT_PRODUCT_SERVICES)),)
- $(error TARGET_COPY_OUT_PRODUCT_SERVICES must be either 'product_services' or 'system/product_services', seeing '$(TARGET_COPY_OUT_PRODUCT_SERVICES)'.)
+ $(error TARGET_COPY_OUT_PRODUCT_SERVICES must be either 'product_services',\
+ '$(TARGET_COPY_OUT_PRODUCT)' or 'system/product_services', seeing '$(TARGET_COPY_OUT_PRODUCT_SERVICES)'.)
endif
+.KATI_READONLY := MERGE_PRODUCT_SERVICES_INTO_PRODUCT
PRODUCT_COPY_FILES := $(subst $(_product_services_path_placeholder),$(TARGET_COPY_OUT_PRODUCT_SERVICES),$(PRODUCT_COPY_FILES))
BOARD_USES_PRODUCT_SERVICESIMAGE :=