From cbca1139e8c106a43051c084bf0c530d39995dae Mon Sep 17 00:00:00 2001 From: Dario Freni Date: Tue, 28 Aug 2018 18:04:03 +0100 Subject: [PATCH] Include /product_services software in NOTICE. Bug: 111179267 Test: flashed a module with NOTICE file on a devices and checked the Legal information webview. Change-Id: I6e52dee0ea23f05ea73d7cc747c2db1c1525f4b2 --- core/Makefile | 31 ++++++++++++++++++++++++++++--- tools/generate-notice-files.py | 6 ++++-- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/core/Makefile b/core/Makefile index 429672c74..8bb905e08 100644 --- a/core/Makefile +++ b/core/Makefile @@ -949,10 +949,11 @@ $(2) $(3): PRIVATE_DIR := $(5) $(2) : $(3) $(3) : $(6) $(BUILD_SYSTEM)/Makefile build/make/tools/generate-notice-files.py build/make/tools/generate-notice-files.py --text-output $(2) \ - $(if $(filter $(1),xml_excluded_vendor_product),-e vendor$(comma)product --xml-output, \ + $(if $(filter $(1),xml_excluded_extra_partitions),-e vendor$(comma)product$(comma)product_services --xml-output, \ $(if $(filter $(1),xml_vendor),-i vendor --xml-output, \ $(if $(filter $(1),xml_product),-i product --xml-output, \ - --html-output))) $(3) \ + $(if $(filter $(1),xml_product_services),-i product_services --xml-output, \ + --html-output)))) $(3) \ -t $$(PRIVATE_MESSAGE) -s $$(PRIVATE_DIR)/src notice_files: $(2) $(3) endef @@ -983,6 +984,11 @@ target_product_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.txt target_product_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.xml target_product_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.xml.gz installed_product_notice_xml_gz := $(TARGET_OUT_PRODUCT)/etc/NOTICE.xml.gz + +target_product_services_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT_SERVICES.txt +target_product_services_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT_SERVICES.xml +target_product_services_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT_SERVICES.xml.gz +installed_product_services_notice_xml_gz := $(TARGET_OUT_PRODUCT_SERVICES)/etc/NOTICE.xml.gz endif ifndef TARGET_BUILD_APPS @@ -991,7 +997,7 @@ winpthreads_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/winpthreads.txt pdk_fusion_notice_files := $(filter $(TARGET_OUT_NOTICE_FILES)/%, $(ALL_PDK_FUSION_FILES)) ifdef target_vendor_notice_file_xml_gz -$(eval $(call combine-notice-files, xml_excluded_vendor_product, \ +$(eval $(call combine-notice-files, xml_excluded_extra_partitions, \ $(target_notice_file_txt), \ $(target_notice_file_html_or_xml), \ "Notices for files contained in the filesystem images in this directory:", \ @@ -1011,6 +1017,14 @@ $(eval $(call combine-notice-files, xml_product, \ $(TARGET_OUT_NOTICE_FILES), \ $(target_notice_file_html_or_xml))) endif +ifdef target_product_services_notice_file_txt +$(eval $(call combine-notice-files, xml_product_services, \ + $(target_product_services_notice_file_txt), \ + $(target_product_services_notice_file_xml), \ + "Notices for files contained in the product_services filesystem image in this directory:", \ + $(TARGET_OUT_NOTICE_FILES), \ + $(target_notice_file_html_or_xml))) +endif else $(eval $(call combine-notice-files, html, \ $(target_notice_file_txt), \ @@ -1054,6 +1068,14 @@ $(installed_product_notice_xml_gz): $(target_product_notice_file_xml_gz) $(copy-file-to-target) endif +ifdef target_product_services_notice_file_xml_gz +# Install the product html file at /product_services/etc/NOTICE.xml.gz. +$(target_product_services_notice_file_xml_gz): $(target_product_services_notice_file_xml) | $(MINIGZIP) + $(hide) $(MINIGZIP) -9 < $< > $@ +$(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),) ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz) @@ -1063,6 +1085,9 @@ ifeq ($(ONE_SHOT_MAKEFILE),) ifdef target_product_notice_file_xml_gz ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_notice_xml_gz) endif + ifdef target_product_services_notice_file_xml_gz + ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_services_notice_xml_gz) + endif endif endif # TARGET_BUILD_APPS diff --git a/tools/generate-notice-files.py b/tools/generate-notice-files.py index b754174a9..49011b20f 100755 --- a/tools/generate-notice-files.py +++ b/tools/generate-notice-files.py @@ -238,12 +238,14 @@ def main(argv): if len(included_subdirs) > 0: matched = False for subdir in included_subdirs: - if root.startswith(input_dir + '/' + subdir): + if (root == (input_dir + '/' + subdir) or + root.startswith(input_dir + '/' + subdir + '/')): matched = True break elif len(excluded_subdirs) > 0: for subdir in excluded_subdirs: - if root.startswith(input_dir + '/' + subdir): + if (root == (input_dir + '/' + subdir) or + root.startswith(input_dir + '/' + subdir + '/')): matched = False break if matched and file.endswith(".txt"):