Merge "Pass --force-determinism to prebuilts."
diff --git a/core/Makefile b/core/Makefile
index 0a99376..7a8ba1f 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -653,13 +653,14 @@
.PHONY: notice_files
-# Create the rule to combine the files into text and html forms
-# $(1) - Plain text output file
-# $(2) - HTML output file
-# $(3) - File title
-# $(4) - Directory to use. Notice files are all $(4)/src. Other
+# Create the rule to combine the files into text and html/xml forms
+# $(1) - xml_excluded_vendor|xml_vendor|html
+# $(2) - Plain text output file
+# $(3) - HTML/XML output file
+# $(4) - File title
+# $(5) - Directory to use. Notice files are all $(4)/src. Other
# directories in there will be used for scratch
-# $(5) - Dependencies for the output files
+# $(6) - Dependencies for the output files
#
# The algorithm here is that we go collect a hash for each of the notice
# files and write the names of the files that match that hash. Then
@@ -673,12 +674,16 @@
# original notice files instead of making rules to copy them somwehere.
# Then we could traverse that without quite as much bash drama.
define combine-notice-files
-$(1) $(2): PRIVATE_MESSAGE := $(3)
-$(1) $(2): PRIVATE_DIR := $(4)
-$(1) : $(2)
-$(2) : $(5) $(BUILD_SYSTEM)/Makefile build/tools/generate-notice-files.py
- build/tools/generate-notice-files.py $(1) $(2) $$(PRIVATE_MESSAGE) $$(PRIVATE_DIR)/src
-notice_files: $(1) $(2)
+$(2) $(3): PRIVATE_MESSAGE := $(4)
+$(2) $(3): PRIVATE_DIR := $(5)
+$(2) : $(3)
+$(3) : $(6) $(BUILD_SYSTEM)/Makefile build/tools/generate-notice-files.py
+ build/tools/generate-notice-files.py --text-output $(2) \
+ $(if $(filter $(1),xml_excluded_vendor),-e vendor --xml-output, \
+ $(if $(filter $(1),xml_vendor),-i vendor --xml-output, \
+ --html-output)) $(3) \
+ -t $$(PRIVATE_MESSAGE) -s $$(PRIVATE_DIR)/src
+notice_files: $(2) $(3)
endef
# TODO These intermediate NOTICE.txt/NOTICE.html files should go into
@@ -686,24 +691,51 @@
# the src subdirectory.
target_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE.txt
-target_notice_file_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html
-target_notice_file_html_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz
+target_notice_file_html_or_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html
+target_notice_file_html_or_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz
+installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt
tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html
+ifeq ($(PRODUCT_FULL_TREBLE),true)
+target_notice_file_html_or_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml
+target_notice_file_html_or_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml.gz
+installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.xml.gz
+
+target_vendor_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.txt
+target_vendor_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml
+target_vendor_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml.gz
+installed_vendor_notice_xml_gz := $(TARGET_OUT_VENDOR)/etc/NOTICE.xml.gz
+endif
+
ifndef TARGET_BUILD_APPS
kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt
winpthreads_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/winpthreads.txt
pdk_fusion_notice_files := $(filter $(TARGET_OUT_NOTICE_FILES)/%, $(ALL_PDK_FUSION_FILES))
-$(eval $(call combine-notice-files, \
+ifdef target_vendor_notice_file_xml_gz
+$(eval $(call combine-notice-files, xml_excluded_vendor, \
$(target_notice_file_txt), \
- $(target_notice_file_html), \
+ $(target_notice_file_html_or_xml), \
"Notices for files contained in the filesystem images in this directory:", \
$(TARGET_OUT_NOTICE_FILES), \
$(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)))
+$(eval $(call combine-notice-files, xml_vendor, \
+ $(target_vendor_notice_file_txt), \
+ $(target_vendor_notice_file_xml), \
+ "Notices for files contained in the vendor filesystem image in this directory:", \
+ $(TARGET_OUT_NOTICE_FILES), \
+ $(target_notice_file_html_or_xml)))
+else
+$(eval $(call combine-notice-files, html, \
+ $(target_notice_file_txt), \
+ $(target_notice_file_html_or_xml), \
+ "Notices for files contained in the filesystem images in this directory:", \
+ $(TARGET_OUT_NOTICE_FILES), \
+ $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)))
+endif
-$(eval $(call combine-notice-files, \
+$(eval $(call combine-notice-files, html, \
$(tools_notice_file_txt), \
$(tools_notice_file_html), \
"Notices for files contained in the tools directory:", \
@@ -716,15 +748,25 @@
# the module processing has already been done -- in fact, we used the
# fact that all that has been done to get the list of modules that we
# need notice files for.
-$(target_notice_file_html_gz): $(target_notice_file_html) | $(MINIGZIP)
+$(target_notice_file_html_or_xml_gz): $(target_notice_file_html_or_xml) | $(MINIGZIP)
$(hide) $(MINIGZIP) -9 < $< > $@
-installed_notice_html_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
-$(installed_notice_html_gz): $(target_notice_file_html_gz)
+$(installed_notice_html_or_xml_gz): $(target_notice_file_html_or_xml_gz)
$(copy-file-to-target)
+ifdef target_vendor_notice_file_xml_gz
+# Install the vendor html file at /vendor/etc/NOTICE.xml.gz.
+$(target_vendor_notice_file_xml_gz): $(target_vendor_notice_file_xml) | $(MINIGZIP)
+ $(hide) $(MINIGZIP) -9 < $< > $@
+$(installed_vendor_notice_xml_gz): $(target_vendor_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_gz)
+ ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
+ ifdef target_vendor_notice_file_xml_gz
+ ALL_DEFAULT_INSTALLED_MODULES += $(installed_vendor_notice_xml_gz)
+ endif
endif
endif # TARGET_BUILD_APPS
@@ -1112,6 +1154,9 @@
ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
$(INSTALLED_BOOTIMAGE_TARGET) : $(VBOOT_SIGNER)
endif
+ifeq (true,$(BOARD_AVB_ENABLE))
+$(INSTALLED_BOOTIMAGE_TARGET) : $(AVBTOOL)
+endif
$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
$(INSTALLED_RAMDISK_TARGET) \
$(INTERNAL_RECOVERYIMAGE_FILES) \
@@ -1690,6 +1735,26 @@
endif
# -----------------------------------------------------------------
+# dtbo image
+ifdef BOARD_PREBUILT_DTBOIMAGE
+INSTALLED_DTBOIMAGE_TARGET := $(PRODUCT_OUT)/dtbo.img
+
+ifeq ($(BOARD_AVB_ENABLE),true)
+$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE) $(AVBTOOL)
+ cp $(BOARD_PREBUILT_DTBOIMAGE) $@
+ $(AVBTOOL) add_hash_footer \
+ --image $@ \
+ --partition_size $(BOARD_DTBOIMG_PARTITION_SIZE) \
+ --partition_name dtbo $(INTERNAL_AVB_SIGNING_ARGS) \
+ $(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)
+else
+$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
+ cp $(BOARD_PREBUILT_DTBOIMAGE) $@
+endif
+
+endif
+
+# -----------------------------------------------------------------
# vbmeta image
ifeq ($(BOARD_AVB_ENABLE),true)
@@ -1704,6 +1769,11 @@
--include_descriptors_from_image $(INSTALLED_VENDORIMAGE_TARGET)
endif
+ifdef INSTALLED_DTBOIMAGE_TARGET
+INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
+ --include_descriptors_from_image $(INSTALLED_DTBOIMAGE_TARGET)
+endif
+
ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += --setup_rootfs_from_kernel $(BUILT_SYSTEMIMAGE)
endif
@@ -1740,7 +1810,7 @@
endef
INSTALLED_VBMETAIMAGE_TARGET := $(BUILT_VBMETAIMAGE_TARGET)
-$(INSTALLED_VBMETAIMAGE_TARGET): $(AVBTOOL) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_SYSTEMIMAGE) $(INSTALLED_VENDORIMAGE_TARGET)
+$(INSTALLED_VBMETAIMAGE_TARGET): $(AVBTOOL) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_SYSTEMIMAGE) $(INSTALLED_VENDORIMAGE_TARGET) $(INSTALLED_DTBOIMAGE_TARGET)
$(build-vbmetaimage-target)
.PHONY: vbmetaimage-nodeps
@@ -1980,6 +2050,7 @@
$(INSTALLED_USERDATAIMAGE_TARGET) \
$(INSTALLED_CACHEIMAGE_TARGET) \
$(INSTALLED_VENDORIMAGE_TARGET) \
+ $(INSTALLED_DTBOIMAGE_TARGET) \
$(INTERNAL_SYSTEMOTHERIMAGE_FILES) \
$(INSTALLED_ANDROID_INFO_TXT_TARGET) \
$(INSTALLED_KERNEL_TARGET) \
@@ -2252,6 +2323,10 @@
$(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
+ifeq ($(AB_OTA_UPDATER),true)
+$(INTERNAL_OTA_PACKAGE_TARGET): $(BRILLO_UPDATE_PAYLOAD)
+endif
+
$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
build/tools/releasetools/ota_from_target_files
@echo "Package OTA: $@"
diff --git a/core/binary.mk b/core/binary.mk
index 44a84aa..8a238ba 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -1814,10 +1814,11 @@
$(SOONG_CONV.$(LOCAL_MODULE).PROBLEMS) $(my_soong_problems)
SOONG_CONV.$(LOCAL_MODULE).DEPS := \
$(SOONG_CONV.$(LOCAL_MODULE).DEPS) \
- $(my_static_libraries) \
- $(my_whole_static_libraries) \
- $(my_shared_libraries) \
- $(my_system_shared_libraries)
+ $(filter-out $($(LOCAL_2ND_ARCH_VAR_PREFIX)UBSAN_RUNTIME_LIBRARY),\
+ $(my_static_libraries) \
+ $(my_whole_static_libraries) \
+ $(my_shared_libraries) \
+ $(my_system_shared_libraries))
SOONG_CONV := $(SOONG_CONV) $(LOCAL_MODULE)
endif
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index a4751fd..0f38b80 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -104,7 +104,7 @@
LOCAL_JACK_CLASSPATH:=
LOCAL_JACK_COVERAGE_EXCLUDE_FILTER:=
LOCAL_JACK_COVERAGE_INCLUDE_FILTER:=
-# '' (ie disabled), disabled, full, incremental
+# '' (ie disabled), disabled, full, incremental, javac_frontend
LOCAL_JACK_ENABLED:=$(DEFAULT_JACK_ENABLED)
LOCAL_JACK_FLAGS:=
LOCAL_JACK_PLUGIN:=
diff --git a/core/config.mk b/core/config.mk
index 884be1e..583909d 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -634,6 +634,7 @@
FUTILITY := $(HOST_OUT_EXECUTABLES)/futility-host
VBOOT_SIGNER := prebuilts/misc/scripts/vboot_signer/vboot_signer.sh
FEC := $(HOST_OUT_EXECUTABLES)/fec
+BRILLO_UPDATE_PAYLOAD := $(HOST_OUT_EXECUTABLES)/brillo_update_payload
DEXDUMP := $(HOST_OUT_EXECUTABLES)/dexdump2$(BUILD_EXECUTABLE_SUFFIX)
PROFMAN := $(HOST_OUT_EXECUTABLES)/profman
diff --git a/core/configure_local_jack.mk b/core/configure_local_jack.mk
index 2270c88..f8049a3 100644
--- a/core/configure_local_jack.mk
+++ b/core/configure_local_jack.mk
@@ -18,18 +18,23 @@
LOCAL_JACK_ENABLED := $(ANDROID_FORCE_JACK_ENABLED)
endif
+ifneq ($(ANDROID_COMPILE_WITH_JACK),true)
+LOCAL_JACK_ENABLED :=
+endif
+
LOCAL_JACK_ENABLED := $(strip $(LOCAL_JACK_ENABLED))
LOCAL_MODULE := $(strip $(LOCAL_MODULE))
-ifneq ($(LOCAL_JACK_ENABLED),full)
-ifneq ($(LOCAL_JACK_ENABLED),incremental)
+valid_jack_enabled_values := full incremental javac_frontend disabled
+
ifdef LOCAL_JACK_ENABLED
-ifneq ($(LOCAL_JACK_ENABLED),disabled)
-$(error $(LOCAL_PATH): invalid LOCAL_JACK_ENABLED "$(LOCAL_JACK_ENABLED)" for $(LOCAL_MODULE))
-endif
-endif
-LOCAL_JACK_ENABLED :=
-endif
+ ifneq ($(LOCAL_JACK_ENABLED),$(filter $(firstword $(LOCAL_JACK_ENABLED)),$(valid_jack_enabled_values)))
+ $(error $(LOCAL_PATH): invalid LOCAL_JACK_ENABLED "$(LOCAL_JACK_ENABLED)" for $(LOCAL_MODULE))
+ endif
+
+ ifeq ($(LOCAL_JACK_ENABLED),disabled)
+ LOCAL_JACK_ENABLED :=
+ endif
endif
ifdef $(LOCAL_MODULE).JACK_VERSION
diff --git a/core/definitions.mk b/core/definitions.mk
index e058bc1..10d26c4 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1017,12 +1017,15 @@
$(hide) echo >> $2
endef
+# b/37755219
+RS_CC_ASAN_OPTIONS := ASAN_OPTIONS=detect_leaks=0:detect_container_overflow=0
+
define transform-renderscripts-to-java-and-bc
@echo "RenderScript: $(PRIVATE_MODULE) <= $(PRIVATE_RS_SOURCE_FILES)"
$(hide) rm -rf $(PRIVATE_RS_OUTPUT_DIR)
$(hide) mkdir -p $(PRIVATE_RS_OUTPUT_DIR)/res/raw
$(hide) mkdir -p $(PRIVATE_RS_OUTPUT_DIR)/src
-$(hide) $(PRIVATE_RS_CC) \
+$(hide) $(RS_CC_ASAN_OPTIONS) $(PRIVATE_RS_CC) \
-o $(PRIVATE_RS_OUTPUT_DIR)/res/raw \
-p $(PRIVATE_RS_OUTPUT_DIR)/src \
-d $(PRIVATE_RS_OUTPUT_DIR) \
@@ -1058,7 +1061,7 @@
@echo "RenderScript: $(PRIVATE_MODULE) <= $(PRIVATE_RS_SOURCE_FILES)"
$(hide) rm -rf $(PRIVATE_RS_OUTPUT_DIR)
$(hide) mkdir -p $(PRIVATE_RS_OUTPUT_DIR)/
-$(hide) $(PRIVATE_RS_CC) \
+$(hide) $(RS_CC_ASAN_OPTIONS) $(PRIVATE_RS_CC) \
-o $(PRIVATE_RS_OUTPUT_DIR)/ \
-d $(PRIVATE_RS_OUTPUT_DIR) \
-a $@ -MD \
@@ -2000,6 +2003,9 @@
APPS_DEFAULT_VERSION_NAME := $(PLATFORM_VERSION)
endif
+# b/37750224
+AAPT_ASAN_OPTIONS := ASAN_OPTIONS=detect_leaks=0
+
# TODO: Right now we generate the asset resources twice, first as part
# of generating the Java classes, then at the end when packaging the final
# assets. This should be changed to do one of two things: (1) Don't generate
@@ -2014,7 +2020,7 @@
define create-resource-java-files
@mkdir -p $(PRIVATE_SOURCE_INTERMEDIATES_DIR)
@mkdir -p $(dir $(PRIVATE_RESOURCE_PUBLICS_OUTPUT))
-$(hide) $(AAPT) package $(PRIVATE_AAPT_FLAGS) -m \
+$(hide) $(AAPT_ASAN_OPTIONS) $(AAPT) package $(PRIVATE_AAPT_FLAGS) -m \
$(eval # PRIVATE_PRODUCT_AAPT_CONFIG is intentionally missing-- see comment.) \
$(addprefix -J , $(PRIVATE_SOURCE_INTERMEDIATES_DIR)) \
$(addprefix -M , $(PRIVATE_ANDROID_MANIFEST)) \
@@ -2262,9 +2268,10 @@
$(hide) mkdir -p $(PRIVATE_JACK_INTERMEDIATES_DIR)
$(if $(PRIVATE_JACK_INCREMENTAL_DIR),$(hide) mkdir -p $(PRIVATE_JACK_INCREMENTAL_DIR))
$(call dump-words-to-file,$(PRIVATE_JAVA_SOURCES),$(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list)
-$(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
- find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list; \
-fi
+$(if $(PRIVATE_SOURCE_INTERMEDIATES_DIR), \
+ $(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
+ find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list; \
+ fi)
$(if $(PRIVATE_HAS_PROTO_SOURCES), \
$(hide) find $(PRIVATE_PROTO_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list )
$(if $(PRIVATE_HAS_RS_SOURCES), \
@@ -2281,6 +2288,10 @@
$(hide) $(call add-java-resources-to,$@.res.tmp.zip)
$(hide) unzip -qo $@.res.tmp.zip -d $@.res.tmp
$(hide) rm $@.res.tmp.zip)
+$(if $(PRIVATE_JACK_IMPORT_JAR),
+ $(hide) mkdir -p $@.tmpjill.res
+ $(hide) unzip -qo $(PRIVATE_JACK_IMPORT_JAR) -d $@.tmpjill.res
+ $(hide) find $@.tmpjill.res -iname "*.class" -delete)
$(hide) if [ -s $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq ] ; then \
export tmpEcjArg="@$(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq"; \
else \
@@ -2293,6 +2304,8 @@
-D jack.dex.optimize="false") \
$(if $(PRIVATE_RMTYPEDEFS), \
-D jack.android.remove-typedef="true") \
+ $(if $(PRIVATE_JACK_IMPORT_JAR), \
+ --import $(PRIVATE_JACK_IMPORT_JAR) --import-resource $@.tmpjill.res) \
$(addprefix --classpath ,$(strip \
$(call normalize-path-list,$(PRIVATE_JACK_SHARED_LIBRARIES)))) \
$(addprefix --import ,$(call reverse-list,$(PRIVATE_STATIC_JACK_LIBRARIES))) \
@@ -2387,13 +2400,16 @@
fi
endef
+# b/37756495
+IJAR_ASAN_OPTIONS := ASAN_OPTIONS=detect_leaks=0
+
## Rule to create a table of contents from a .jar file.
## Must be called with $(eval).
# $(1): A .jar file
define _transform-jar-to-toc
$1.toc: $1 | $(IJAR)
@echo Generating TOC: $$@
- $(hide) $(IJAR) $$< $$@.tmp
+ $(hide) $(IJAR_ASAN_OPTIONS) $(IJAR) $$< $$@.tmp
$$(call commit-change-for-toc,$$@)
endef
@@ -2590,7 +2606,7 @@
#values; applications can override these by explicitly stating
#them in their manifest.
define add-assets-to-package
-$(hide) $(AAPT) package -u $(PRIVATE_AAPT_FLAGS) \
+$(hide) $(AAPT_ASAN_OPTIONS) $(AAPT) package -u $(PRIVATE_AAPT_FLAGS) \
$(addprefix -c , $(PRIVATE_PRODUCT_AAPT_CONFIG)) \
$(addprefix --preferred-density , $(PRIVATE_PRODUCT_AAPT_PREF_CONFIG)) \
$(addprefix -M , $(PRIVATE_ANDROID_MANIFEST)) \
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index b107ded..f940c72 100644
--- a/core/dex_preopt.mk
+++ b/core/dex_preopt.mk
@@ -23,6 +23,9 @@
# being used). To bundle everything one should set this to '%'
SYSTEM_OTHER_ODEX_FILTER ?= app/% priv-app/%
+# Method returning whether the install path $(1) should be for system_other.
+install-on-system-other = $(filter-out $(PRODUCT_SYSTEM_SERVER_APPS),$(basename $(notdir $(filter $(foreach f,$(SYSTEM_OTHER_ODEX_FILTER),$(TARGET_OUT)/$(f)),$(1)))))
+
# The default values for pre-opting: always preopt PIC.
# Conditional to building on linux, as dex2oat currently does not work on darwin.
ifeq ($(HOST_OS),linux)
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
index dee2758..9db5dbf 100644
--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -61,7 +61,7 @@
# $(2): the full install path (including file name) of the corresponding .apk.
ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
define get-odex-installed-file-path
-$(if $(filter $(foreach f,$(SYSTEM_OTHER_ODEX_FILTER),$(TARGET_OUT)/$(f)),$(2)),
+$(if $(call install-on-system-other, $(2)),
$(call get-odex-file-path,$(1),$(patsubst $(TARGET_OUT)/%,$(TARGET_OUT_SYSTEM_OTHER)/%,$(2))),
$(call get-odex-file-path,$(1),$(2)))
endef
diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk
index 68c46f5..a3fb410 100644
--- a/core/dex_preopt_odex_install.mk
+++ b/core/dex_preopt_odex_install.mk
@@ -42,7 +42,7 @@
# if installing into system, and odex are being installed into system_other, don't strip
ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
ifeq ($(LOCAL_DEX_PREOPT),true)
-ifneq ($(filter $(foreach f,$(SYSTEM_OTHER_ODEX_FILTER),$(TARGET_OUT)/$(f)),$(my_module_path)),)
+ifneq ($(call install-on-system-other, $(my_module_path)),)
LOCAL_DEX_PREOPT := nostripping
endif
endif
@@ -151,6 +151,18 @@
LOCAL_DEX_PREOPT_FLAGS := $(PRODUCT_DEX_PREOPT_DEFAULT_FLAGS)
endif
endif
+
+ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS) $(PRODUCT_SYSTEM_SERVER_APPS),$(LOCAL_MODULE)))
+ # Jars of system server, and apps loaded into system server should be
+ # compiled with the 'speed' compiler filter.
+ LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed
+else
+ # If no compiler filter is specified, default to 'quicken' to save on storage.
+ ifeq (,$(filter --compiler-filter=%, $(LOCAL_DEX_PREOPT_FLAGS)))
+ LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=quicken
+ endif
+endif
+
$(built_odex): PRIVATE_DEX_PREOPT_FLAGS := $(LOCAL_DEX_PREOPT_FLAGS)
$(built_vdex): $(built_odex)
$(built_art): $(built_odex)
diff --git a/core/install_jni_libs.mk b/core/install_jni_libs.mk
index 625a8a2..35f4f55 100644
--- a/core/install_jni_libs.mk
+++ b/core/install_jni_libs.mk
@@ -18,9 +18,19 @@
ifneq ($(filter tests samples, $(LOCAL_MODULE_TAGS)),)
my_embed_jni := true
endif
-ifeq ($(filter $(TARGET_OUT)/% $(TARGET_OUT_VENDOR)/% $(TARGET_OUT_OEM)/%, $(my_module_path)),)
-# If this app isn't to be installed to system partitions.
-my_embed_jni := true
+ifneq ($(BOARD_VNDK_VERSION),)
+ ifeq ($(filter $(TARGET_OUT)/%, $(my_module_path)),)
+ # If this app isn't to be installed to the system partition, and the device
+ # is fully treble-ized then jni libs are embedded, Otherwise, access to the
+ # directory where the lib is installed to (usually /vendor/lib) needs to be
+ # allowed for system processes, which is a Treble violation.
+ my_embed_jni := true
+ endif
+else
+ ifeq ($(filter $(TARGET_OUT)/% $(TARGET_OUT_VENDOR)/% $(TARGET_OUT_OEM)/%, $(my_module_path)),)
+ # If this app isn't to be installed to system, vendor, or oem partitions.
+ my_embed_jni := true
+ endif
endif
jni_shared_libraries :=
diff --git a/core/java.mk b/core/java.mk
index 78c8ba3..ed05484 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -340,13 +340,13 @@
ifndef LOCAL_CHECKED_MODULE
ifdef full_classes_jar
ifdef LOCAL_JACK_ENABLED
-LOCAL_CHECKED_MODULE := $(jack_check_timestamp)
-else
-ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
+ifeq ($(LOCAL_JACK_ENABLED),javac_frontend)
LOCAL_CHECKED_MODULE := $(full_classes_compiled_jar)
else
-LOCAL_CHECKED_MODULE := $(built_dex)
+LOCAL_CHECKED_MODULE := $(jack_check_timestamp)
endif
+else
+LOCAL_CHECKED_MODULE := $(full_classes_compiled_jar)
endif
endif
endif
@@ -659,6 +659,8 @@
$(hide) rm -f $(dir $@)/classes*.dex
$(hide) cp -fp $(dir $<)/classes*.dex $(dir $@)
+java-dex: $(built_dex)
+
endif # !LOCAL_IS_STATIC_JAVA_LIBRARY
findbugs_xml := $(intermediates.COMMON)/findbugs.xml
@@ -774,6 +776,26 @@
$(built_dex_intermediate): PRIVATE_JACK_COVERAGE_OPTIONS :=
endif
+# Compiling with javac to jar, then converting jar to dex with jack
+ifeq ($(LOCAL_JACK_ENABLED),javac_frontend)
+
+# PRIVATE_EXTRA_JAR_ARGS and source files were already handled during javac
+$(built_dex_intermediate): PRIVATE_EXTRA_JAR_ARGS :=
+$(built_dex_intermediate): PRIVATE_JAVA_SOURCES :=
+$(built_dex_intermediate): PRIVATE_SOURCE_INTERMEDIATES_DIR :=
+$(built_dex_intermediate): PRIVATE_HAS_PROTO_SOURCES :=
+$(built_dex_intermediate): PRIVATE_HAS_RS_SOURCES :=
+
+# Incremental compilation is not supported when mixing javac and jack
+$(built_dex_intermediate): PRIVATE_JACK_INCREMENTAL_DIR :=
+
+# Pass output of javac to jack
+$(built_dex_intermediate): PRIVATE_JACK_IMPORT_JAR := $(full_classes_compiled_jar)
+$(built_dex_intermediate): $(full_classes_compiled_jar)
+else # LOCAL_JACK_ENABLED != javac_frontend
+$(built_dex_intermediate): PRIVATE_JACK_IMPORT_JAR :=
+endif # LOCAL_JACK_ENABLED != javac_frontend
+
$(built_dex_intermediate): PRIVATE_JACK_PLUGIN_PATH := $(LOCAL_JACK_PLUGIN_PATH)
$(built_dex_intermediate): PRIVATE_JACK_PLUGIN := $(LOCAL_JACK_PLUGIN)
$(built_dex_intermediate): $(jack_all_deps) $(LOCAL_JACK_PLUGIN_PATH) | setup-jack-server
diff --git a/core/main.mk b/core/main.mk
index 4715a11..6089cec 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -329,8 +329,8 @@
# Boolean variable determining if Treble is fully enabled
PRODUCT_FULL_TREBLE := false
-ifeq ($(PRODUCT_FULL_TREBLE_OVERRIDE),true)
- PRODUCT_FULL_TREBLE := true
+ifneq ($(PRODUCT_FULL_TREBLE_OVERRIDE),)
+ PRODUCT_FULL_TREBLE := $(PRODUCT_FULL_TREBLE_OVERRIDE)
else ifeq ($(PRODUCT_SHIPPING_API_LEVEL),)
#$(warning no product shipping level defined)
else ifneq ($(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),26),)
@@ -453,8 +453,8 @@
ADDITIONAL_BUILD_PROPERTIES += net.bt.name=Android
-# enable vm tracing in files for now to help track
-# the cause of ANRs in the content process
+# Sets the location that the runtime dumps stack traces to when signalled
+# with SIGQUIT. Stack trace dumping is turned on for all android builds.
ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.stack-trace-file=/data/anr/traces.txt
# ------------------------------------------------------------
@@ -1171,9 +1171,9 @@
droid_targets: apps_only
# Combine the NOTICE files for a apps_only build
-$(eval $(call combine-notice-files, \
+$(eval $(call combine-notice-files, html, \
$(target_notice_file_txt), \
- $(target_notice_file_html), \
+ $(target_notice_file_html_or_xml), \
"Notices for files for apps:", \
$(TARGET_OUT_NOTICE_FILES), \
$(apps_only_installed_files)))
@@ -1236,7 +1236,7 @@
# umbrella targets to assit engineers in verifying builds
.PHONY: java native target host java-host java-target native-host native-target \
java-host-tests java-target-tests native-host-tests native-target-tests \
- java-tests native-tests host-tests target-tests tests
+ java-tests native-tests host-tests target-tests tests java-dex
# some synonyms
.PHONY: host-java target-java host-native target-native \
target-java-tests target-native-tests
diff --git a/core/package_internal.mk b/core/package_internal.mk
index e512211..f9f8e35 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -367,8 +367,23 @@
ifeq ($(need_compile_res),true)
ifdef LOCAL_USE_AAPT2
my_compiled_res_base_dir := $(intermediates)/flat-res
+renderscript_target_api :=
+ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API))
+renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API)
+else
+ifneq (,$(LOCAL_SDK_VERSION))
+# Set target-api for LOCAL_SDK_VERSIONs other than current.
+ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
+renderscript_target_api := $(LOCAL_SDK_VERSION)
+endif
+endif # LOCAL_SDK_VERSION is set
+endif # LOCAL_RENDERSCRIPT_TARGET_API is set
+ifneq (,$(renderscript_target_api))
+ifneq ($(call math_gt_or_eq,$(renderscript_target_api),21),true)
my_generated_res_dirs := $(rs_generated_res_dir)
my_generated_res_dirs_deps := $(RenderScript_file_stamp)
+endif # renderscript_target_api < 21
+endif # renderscript_target_api is set
# Add AAPT2 link specific flags.
$(my_res_package): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --no-static-lib-packages
include $(BUILD_SYSTEM)/aapt2.mk
diff --git a/core/product.mk b/core/product.mk
index 3d20168..1e5a30e 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -112,6 +112,7 @@
PRODUCT_SUPPORTS_VERITY_FEC \
PRODUCT_OEM_PROPERTIES \
PRODUCT_SYSTEM_PROPERTY_BLACKLIST \
+ PRODUCT_SYSTEM_SERVER_APPS \
PRODUCT_SYSTEM_SERVER_JARS \
PRODUCT_VBOOT_SIGNING_KEY \
PRODUCT_VBOOT_SIGNING_SUBKEY \
diff --git a/core/product_config.mk b/core/product_config.mk
index 8246c14..57b7669 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -268,6 +268,7 @@
# A list of module names of BOOTCLASSPATH (jar files)
PRODUCT_BOOT_JARS := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_BOOT_JARS))
PRODUCT_SYSTEM_SERVER_JARS := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_SERVER_JARS))
+PRODUCT_SYSTEM_SERVER_APPS := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_SERVER_APPS))
# Find the device that this product maps to.
TARGET_DEVICE := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEVICE)
diff --git a/core/soong_config.mk b/core/soong_config.mk
index 0184598..0a2208b 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -78,6 +78,8 @@
echo ' "CrossHostSecondaryArch": "$(HOST_CROSS_2ND_ARCH)",'; \
echo ' "Safestack": $(if $(filter true,$(USE_SAFESTACK)),true,false),'; \
echo ' "EnableCFI": $(if $(filter false,$(ENABLE_CFI)),false,true),'; \
+ echo ' "Device_uses_hwc2": $(if $(filter true,$(TARGET_USES_HWC2)),true,false),'; \
+ echo ' "Override_rs_driver": "$(OVERRIDE_RS_DRIVER)",'; \
echo ''; \
echo ' "ArtUseReadBarrier": $(if $(filter false,$(PRODUCT_ART_USE_READ_BARRIER)),false,true),'; \
echo ''; \
diff --git a/core/static_java_library.mk b/core/static_java_library.mk
index bf72a82..a8b0103 100644
--- a/core/static_java_library.mk
+++ b/core/static_java_library.mk
@@ -149,8 +149,23 @@
ifdef LOCAL_USE_AAPT2
# One more level with name res so we can zip up the flat resources that can be linked by apps.
my_compiled_res_base_dir := $(intermediates.COMMON)/flat-res/res
+renderscript_target_api :=
+ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API))
+renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API)
+else
+ifneq (,$(LOCAL_SDK_VERSION))
+# Set target-api for LOCAL_SDK_VERSIONs other than current.
+ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
+renderscript_target_api := $(LOCAL_SDK_VERSION)
+endif
+endif # LOCAL_SDK_VERSION is set
+endif # LOCAL_RENDERSCRIPT_TARGET_API is set
+ifneq (,$(renderscript_target_api))
+ifneq ($(call math_gt_or_eq,$(renderscript_target_api),21),true)
my_generated_res_dirs := $(rs_generated_res_dir)
my_generated_res_dirs_deps := $(RenderScript_file_stamp)
+endif # renderscript_target_api < 21
+endif # renderscript_target_api is set
include $(BUILD_SYSTEM)/aapt2.mk
$(my_res_package) : $(framework_res_package_export_deps)
else
diff --git a/core/tasks/device-tests.mk b/core/tasks/device-tests.mk
index 084353b..b1b936a 100644
--- a/core/tasks/device-tests.mk
+++ b/core/tasks/device-tests.mk
@@ -17,7 +17,7 @@
device-tests-zip := $(PRODUCT_OUT)/device-tests.zip
$(device-tests-zip): $(COMPATIBILITY.device-tests.FILES) $(SOONG_ZIP)
- echo $(COMPATIBILITY.device-tests.FILES) > $@.list
+ echo $(sort $(COMPATIBILITY.device-tests.FILES)) > $@.list
sed -i -e 's/\s\+/\n/g' $@.list
grep $(HOST_OUT_TESTCASES) $@.list > $@-host.list || true
grep $(TARGET_OUT_TESTCASES) $@.list > $@-target.list || true
diff --git a/core/tasks/general-tests.mk b/core/tasks/general-tests.mk
index 9629bfa..763dd51 100644
--- a/core/tasks/general-tests.mk
+++ b/core/tasks/general-tests.mk
@@ -16,7 +16,7 @@
general-tests-zip := $(PRODUCT_OUT)/general-tests.zip
$(general-tests-zip): $(COMPATIBILITY.general-tests.FILES) $(SOONG_ZIP)
- echo $(COMPATIBILITY.general-tests.FILES) > $@.list
+ echo $(sort $(COMPATIBILITY.general-tests.FILES)) > $@.list
sed -i -e 's/\s\+/\n/g' $@.list
grep $(HOST_OUT_TESTCASES) $@.list > $@-host.list || true
grep $(TARGET_OUT_TESTCASES) $@.list > $@-target.list || true
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index ba07200..5a89fc9 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -49,6 +49,12 @@
ifndef TARGET_PLATFORM_VERSION
TARGET_PLATFORM_VERSION := $(DEFAULT_PLATFORM_VERSION)
+else ifeq ($(TARGET_PLATFORM_VERSION),OPR1)
+ # HACK: lunch currently sets TARGET_PLATFORM_VERSION to
+ # DEFAULT_PLATFORM_VERSION, which causes unnecessary pain
+ # when the old DEFAULT_PLATFORM_VERSION becomes invalid.
+ # For now, silently upgrade OPR1 to the current default.
+ TARGET_PLATFORM_VERSION := $(DEFAULT_PLATFORM_VERSION)
endif
ifeq (,$(filter $(ALLOWED_VERSIONS), $(TARGET_PLATFORM_VERSION)))
diff --git a/envsetup.sh b/envsetup.sh
index 03fdf89..a31b9d8 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -608,7 +608,11 @@
export TARGET_PRODUCT=$(get_build_var TARGET_PRODUCT)
export TARGET_BUILD_VARIANT=$(get_build_var TARGET_BUILD_VARIANT)
- export TARGET_PLATFORM_VERSION=$(get_build_var TARGET_PLATFORM_VERSION)
+ if [ -n "$version" ]; then
+ export TARGET_PLATFORM_VERSION=$(get_build_var TARGET_PLATFORM_VERSION)
+ else
+ unset TARGET_PLATFORM_VERSION
+ fi
export TARGET_BUILD_TYPE=release
echo
diff --git a/target/product/base.mk b/target/product/base.mk
index 2eb20aa..a671203 100644
--- a/target/product/base.mk
+++ b/target/product/base.mk
@@ -131,7 +131,8 @@
# Packages included only for eng or userdebug builds, previously debug tagged
PRODUCT_PACKAGES_DEBUG := \
- perfprofd
+ perfprofd \
+ sqlite3
PRODUCT_COPY_FILES := $(call add-to-product-copy-files-if-exists,\
frameworks/base/preloaded-classes:system/etc/preloaded-classes)
diff --git a/target/product/core.mk b/target/product/core.mk
index c4c7cab..72a7e8d 100644
--- a/target/product/core.mk
+++ b/target/product/core.mk
@@ -61,4 +61,11 @@
VpnDialogs \
MmsService
+# The set of packages whose code can be loaded by the system server.
+PRODUCT_SYSTEM_SERVER_APPS += \
+ FusedLocation \
+ InputDevices \
+ KeyChain \
+ Telecom \
+
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_base.mk)
diff --git a/target/product/core_minimal.mk b/target/product/core_minimal.mk
index 701a69c..1cde844 100644
--- a/target/product/core_minimal.mk
+++ b/target/product/core_minimal.mk
@@ -110,6 +110,11 @@
ethernet-service \
wifi-service
+# The set of packages whose code can be loaded by the system server.
+PRODUCT_SYSTEM_SERVER_APPS += \
+ SettingsProvider \
+ WallpaperBackup
+
# Adoptable external storage supports both ext4 and f2fs
PRODUCT_PACKAGES += \
e2fsck \
@@ -128,27 +133,6 @@
PRODUCT_COPY_FILES += \
system/core/rootdir/etc/ld.config.txt:system/etc/ld.config.txt
-# Different dexopt types for different package update/install times.
-# On eng builds, make "boot" reasons do pure JIT for faster turnaround.
-ifeq (eng,$(TARGET_BUILD_VARIANT))
- PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
- pm.dexopt.first-boot=verify-at-runtime \
- pm.dexopt.boot=verify-at-runtime
-else
- PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
- pm.dexopt.first-boot=interpret-only \
- pm.dexopt.boot=verify-profile
-endif
-PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
- pm.dexopt.install=interpret-only \
- pm.dexopt.bg-dexopt=speed-profile \
- pm.dexopt.ab-ota=speed-profile \
- pm.dexopt.nsys-library=speed \
- pm.dexopt.shared-apk=speed \
- pm.dexopt.forced-dexopt=speed \
- pm.dexopt.core-app=speed
-
-
# Enable boot.oat filtering of compiled classes to reduce boot.oat size. b/28026683
PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\
frameworks/base/compiled-classes-phone:system/etc/compiled-classes)
diff --git a/target/product/core_tiny.mk b/target/product/core_tiny.mk
index ef8794d..2fb450d 100644
--- a/target/product/core_tiny.mk
+++ b/target/product/core_tiny.mk
@@ -105,6 +105,13 @@
services \
wifi-service
+# The set of packages whose code can be loaded by the system server.
+PRODUCT_SYSTEM_SERVER_APPS += \
+ FusedLocation \
+ InputDevices \
+ SettingsProvider \
+ WallpaperBackup \
+
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
ro.zygote=zygote32
PRODUCT_COPY_FILES += \
@@ -113,26 +120,6 @@
PRODUCT_PROPERTY_OVERRIDES += \
ro.carrier=unknown
-# Different dexopt types for different package update/install times.
-# On eng builds, make "boot" reasons do pure JIT for faster turnaround.
-ifeq (eng,$(TARGET_BUILD_VARIANT))
- PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
- pm.dexopt.first-boot=verify-at-runtime \
- pm.dexopt.boot=verify-at-runtime
-else
- PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
- pm.dexopt.first-boot=interpret-only \
- pm.dexopt.boot=verify-profile
-endif
-PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
- pm.dexopt.install=interpret-only \
- pm.dexopt.bg-dexopt=speed-profile \
- pm.dexopt.ab-ota=speed-profile \
- pm.dexopt.nsys-library=speed \
- pm.dexopt.shared-apk=speed \
- pm.dexopt.forced-dexopt=speed \
- pm.dexopt.core-app=speed
-
$(call inherit-product, $(SRC_TARGET_DIR)/product/runtime_libart.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/base.mk)
$(call inherit-product-if-exists, frameworks/base/data/fonts/fonts.mk)
diff --git a/target/product/product_launched_with_n_mr1.mk b/target/product/product_launched_with_n_mr1.mk
new file mode 100644
index 0000000..65d4d3f
--- /dev/null
+++ b/target/product/product_launched_with_n_mr1.mk
@@ -0,0 +1,2 @@
+#PRODUCT_SHIPPING_API_LEVEL indicates the first api level, device has been commercially launced on.
+PRODUCT_SHIPPING_API_LEVEL := 25
diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk
index fb52d67..ffdd904 100644
--- a/target/product/runtime_libart.mk
+++ b/target/product/runtime_libart.mk
@@ -82,3 +82,24 @@
dalvik.vm.usejitprofiles=true \
dalvik.vm.dexopt.secondary=true \
dalvik.vm.appimageformat=lz4
+
+# Different dexopt types for different package update/install times.
+# On eng builds, make "boot" reasons only extract for faster turnaround.
+ifeq (eng,$(TARGET_BUILD_VARIANT))
+ PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
+ pm.dexopt.first-boot=extract \
+ pm.dexopt.boot=extract
+else
+ PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
+ pm.dexopt.first-boot=quicken \
+ pm.dexopt.boot=verify
+endif
+
+PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
+ pm.dexopt.install=quicken \
+ pm.dexopt.bg-dexopt=speed-profile \
+ pm.dexopt.ab-ota=speed-profile \
+ pm.dexopt.nsys-library=speed \
+ pm.dexopt.shared-apk=speed \
+ pm.dexopt.forced-dexopt=speed \
+ pm.dexopt.core-app=speed
diff --git a/tests/envsetup_tests.sh b/tests/envsetup_tests.sh
index 4aae255..abdcd56 100755
--- a/tests/envsetup_tests.sh
+++ b/tests/envsetup_tests.sh
@@ -19,8 +19,9 @@
valid_version=PPR1
# lunch tests
-check_lunch "aosp_arm64" "aosp_arm64" "eng" "$default_version"
-check_lunch "aosp_arm64-userdebug" "aosp_arm64" "userdebug" "$default_version"
+check_lunch "aosp_arm64" "aosp_arm64" "eng" ""
+check_lunch "aosp_arm64-userdebug" "aosp_arm64" "userdebug" ""
+check_lunch "aosp_arm64-userdebug-$default_version" "aosp_arm64" "userdebug" "$default_version"
check_lunch "aosp_arm64-userdebug-$valid_version" "aosp_arm64" "userdebug" "$valid_version"
check_lunch "abc" "" "" ""
check_lunch "aosp_arm64-abc" "" "" ""
diff --git a/tools/fs_config/Android.mk b/tools/fs_config/Android.mk
index 65f8a08..dcd41aa 100644
--- a/tools/fs_config/Android.mk
+++ b/tools/fs_config/Android.mk
@@ -113,6 +113,11 @@
include $(BUILD_HOST_EXECUTABLE)
fs_config_generate_bin := $(LOCAL_INSTALLED_MODULE)
+# List of all supported vendor, oem and odm Partitions
+fs_config_generate_extra_partition_list := $(strip \
+ $(if $(BOARD_USES_VENDORIMAGE)$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),vendor) \
+ $(if $(BOARD_USES_OEMIMAGE)$(BOARD_OEMIMAGE_FILE_SYSTEM_TYPE),oem) \
+ $(if $(BOARD_USES_ODMIMAGE)$(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE),odm))
##################################
# Generate the system/etc/fs_config_dirs binary file for the target
@@ -121,10 +126,13 @@
LOCAL_MODULE := fs_config_dirs
LOCAL_MODULE_CLASS := ETC
+LOCAL_REQUIRED_MODULES := $(foreach t,$(fs_config_generate_extra_partition_list),$(LOCAL_MODULE)_$(t))
include $(BUILD_SYSTEM)/base_rules.mk
$(LOCAL_BUILT_MODULE): $(fs_config_generate_bin)
@mkdir -p $(dir $@)
- $< -D -o $@
+ $< -D $(if $(fs_config_generate_extra_partition_list), \
+ -P '$(subst $(space),$(comma),$(addprefix -,$(fs_config_generate_extra_partition_list)))') \
+ -o $@
##################################
# Generate the system/etc/fs_config_files binary file for the target
@@ -133,10 +141,112 @@
LOCAL_MODULE := fs_config_files
LOCAL_MODULE_CLASS := ETC
+LOCAL_REQUIRED_MODULES := $(foreach t,$(fs_config_generate_extra_partition_list),$(LOCAL_MODULE)_$(t))
include $(BUILD_SYSTEM)/base_rules.mk
$(LOCAL_BUILT_MODULE): $(fs_config_generate_bin)
@mkdir -p $(dir $@)
- $< -F -o $@
+ $< -F $(if $(fs_config_generate_extra_partition_list), \
+ -P '$(subst $(space),$(comma),$(addprefix -,$(fs_config_generate_extra_partition_list)))') \
+ -o $@
+
+ifneq ($(filter vendor,$(fs_config_generate_extra_partition_list)),)
+##################################
+# Generate the vendor/etc/fs_config_dirs binary file for the target
+# Add fs_config_dirs or fs_config_dirs_vendor to PRODUCT_PACKAGES in
+# the device make file to enable.
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := fs_config_dirs_vendor
+LOCAL_MODULE_CLASS := ETC
+LOCAL_INSTALLED_MODULE_STEM := fs_config_dirs
+LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc
+include $(BUILD_SYSTEM)/base_rules.mk
+$(LOCAL_BUILT_MODULE): $(fs_config_generate_bin)
+ @mkdir -p $(dir $@)
+ $< -D -P vendor -o $@
+
+##################################
+# Generate the vendor/etc/fs_config_files binary file for the target
+# Add fs_config_files or fs_config_files_vendor to PRODUCT_PACKAGES in
+# the device make file to enable
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := fs_config_files_vendor
+LOCAL_MODULE_CLASS := ETC
+LOCAL_INSTALLED_MODULE_STEM := fs_config_files
+LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc
+include $(BUILD_SYSTEM)/base_rules.mk
+$(LOCAL_BUILT_MODULE): $(fs_config_generate_bin)
+ @mkdir -p $(dir $@)
+ $< -F -P vendor -o $@
+
+endif
+
+ifneq ($(filter oem,$(fs_config_generate_extra_partition_list)),)
+##################################
+# Generate the oem/etc/fs_config_dirs binary file for the target
+# Add fs_config_dirs or fs_config_dirs_oem to PRODUCT_PACKAGES in
+# the device make file to enable
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := fs_config_dirs_oem
+LOCAL_MODULE_CLASS := ETC
+LOCAL_INSTALLED_MODULE_STEM := fs_config_dirs
+LOCAL_MODULE_PATH := $(TARGET_OUT_OEM)/etc
+include $(BUILD_SYSTEM)/base_rules.mk
+$(LOCAL_BUILT_MODULE): $(fs_config_generate_bin)
+ @mkdir -p $(dir $@)
+ $< -D -P oem -o $@
+
+##################################
+# Generate the oem/etc/fs_config_files binary file for the target
+# Add fs_config_files or fs_config_files_oem to PRODUCT_PACKAGES in
+# the device make file to enable
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := fs_config_files_oem
+LOCAL_MODULE_CLASS := ETC
+LOCAL_INSTALLED_MODULE_STEM := fs_config_files
+LOCAL_MODULE_PATH := $(TARGET_OUT_OEM)/etc
+include $(BUILD_SYSTEM)/base_rules.mk
+$(LOCAL_BUILT_MODULE): $(fs_config_generate_bin)
+ @mkdir -p $(dir $@)
+ $< -F -P oem -o $@
+
+endif
+
+ifneq ($(filter odm,$(fs_config_generate_extra_partition_list)),)
+##################################
+# Generate the odm/etc/fs_config_dirs binary file for the target
+# Add fs_config_dirs or fs_config_dirs_odm to PRODUCT_PACKAGES in
+# the device make file to enable
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := fs_config_dirs_odm
+LOCAL_MODULE_CLASS := ETC
+LOCAL_INSTALLED_MODULE_STEM := fs_config_dirs
+LOCAL_MODULE_PATH := $(TARGET_OUT_ODM)/etc
+include $(BUILD_SYSTEM)/base_rules.mk
+$(LOCAL_BUILT_MODULE): $(fs_config_generate_bin)
+ @mkdir -p $(dir $@)
+ $< -D -P odm -o $@
+
+##################################
+# Generate the odm/etc/fs_config_files binary file for the target
+# Add fs_config_files of fs_config_files_odm to PRODUCT_PACKAGES in
+# the device make file to enable
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := fs_config_files_odm
+LOCAL_MODULE_CLASS := ETC
+LOCAL_INSTALLED_MODULE_STEM := fs_config_files
+LOCAL_MODULE_PATH := $(TARGET_OUT_ODM)/etc
+include $(BUILD_SYSTEM)/base_rules.mk
+$(LOCAL_BUILT_MODULE): $(fs_config_generate_bin)
+ @mkdir -p $(dir $@)
+ $< -F -P odm -o $@
+
+endif
# The newer passwd/group targets are only generated if you
# use the new TARGET_FS_CONFIG_GEN method.
@@ -195,3 +305,36 @@
my_fs_config_h :=
fs_config_generate_bin :=
my_gen_oem_aid :=
+
+# -----------------------------------------------------------------------------
+# Unit tests.
+# -----------------------------------------------------------------------------
+
+test_c_flags := \
+ -fstack-protector-all \
+ -g \
+ -Wall \
+ -Wextra \
+ -Werror \
+ -fno-builtin \
+ -DANDROID_FILESYSTEM_CONFIG='"android_filesystem_config_test_data.h"'
+
+##################################
+# test executable
+include $(CLEAR_VARS)
+LOCAL_MODULE := fs_config_generate_test
+LOCAL_SRC_FILES := fs_config_generate.c
+LOCAL_SHARED_LIBRARIES := libcutils
+LOCAL_CFLAGS := $(test_c_flags)
+LOCAL_MODULE_RELATIVE_PATH := fs_config-unit-tests
+LOCAL_GTEST := false
+include $(BUILD_HOST_NATIVE_TEST)
+
+##################################
+# gTest tool
+include $(CLEAR_VARS)
+LOCAL_MODULE := fs_config-unit-tests
+LOCAL_CFLAGS += $(test_c_flags) -DHOST
+LOCAL_SHARED_LIBRARIES := liblog libcutils libbase
+LOCAL_SRC_FILES := fs_config_test.cpp
+include $(BUILD_HOST_NATIVE_TEST)
diff --git a/tools/fs_config/README b/tools/fs_config/README
index 9919131..5af407f 100644
--- a/tools/fs_config/README
+++ b/tools/fs_config/README
@@ -156,9 +156,28 @@
${OUT} directory are used in the final stages when building the filesystem
images to set the file and directory properties.
+For systems with separate partition images, such as vendor or oem,
+fs_config_generate can be instructed to filter the specific file references
+to land in each partition's etc/fs_config_dirs or etc/fs_config_files
+locations. The filter can be instructed to blacklist a partition's data by
+providing the comma separated minus sign prefixed partition names. The filter
+can be instructed to whitelist partition data by providing the partition name.
+
+For example:
+- For system.img, but not vendor, oem or odm file references:
+ -P -vendor,-oem,-odm
+ This makes sure the results only contain content associated with the
+ system, and not vendor, oem or odm, blacklisting their content.
+- For vendor.img file references: -P vendor
+- For oem.img file references: -P oem
+- For odm.img file references: -P odm
+
fs_config_generate --help reports:
Generate binary content for fs_config_dirs (-D) and fs_config_files (-F)
-from device-specific android_filesystem_config.h override
+from device-specific android_filesystem_config.h override. Filter based
+on a comma separated partition list (-P) whitelist or prefixed by a
+minus blacklist. Partitions are identified as path references to
+<partition>/ or system/<partition>
-Usage: fs_config_generate -D|-F [-o output-file]
+Usage: fs_config_generate -D|-F [-P list] [-o output-file]
diff --git a/tools/fs_config/android_filesystem_config_test_data.h b/tools/fs_config/android_filesystem_config_test_data.h
new file mode 100644
index 0000000..07bc8e5
--- /dev/null
+++ b/tools/fs_config/android_filesystem_config_test_data.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <private/android_filesystem_config.h>
+
+/* Test Data */
+
+#undef NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_DIRS
+#undef NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_FILES
+
+static const struct fs_path_config android_device_dirs[] = {
+ {00555, AID_ROOT, AID_SYSTEM, 0, "system/etc"},
+ {00555, AID_ROOT, AID_SYSTEM, 0, "vendor/etc"},
+ {00555, AID_ROOT, AID_SYSTEM, 0, "oem/etc"},
+ {00555, AID_ROOT, AID_SYSTEM, 0, "odm/etc"},
+ {00755, AID_SYSTEM, AID_ROOT, 0, "system/oem/etc"},
+ {00755, AID_SYSTEM, AID_ROOT, 0, "system/odm/etc"},
+ {00755, AID_SYSTEM, AID_ROOT, 0, "system/vendor/etc"},
+ {00755, AID_SYSTEM, AID_ROOT, 0, "data/misc"},
+ {00755, AID_SYSTEM, AID_ROOT, 0, "oem/data/misc"},
+ {00755, AID_SYSTEM, AID_ROOT, 0, "odm/data/misc"},
+ {00755, AID_SYSTEM, AID_ROOT, 0, "vendor/data/misc"},
+ {00555, AID_SYSTEM, AID_ROOT, 0, "etc"},
+};
+
+static const struct fs_path_config android_device_files[] = {
+ {00444, AID_ROOT, AID_SYSTEM, 0, "system/etc/fs_config_dirs"},
+ {00444, AID_ROOT, AID_SYSTEM, 0, "vendor/etc/fs_config_dirs"},
+ {00444, AID_ROOT, AID_SYSTEM, 0, "oem/etc/fs_config_dirs"},
+ {00444, AID_ROOT, AID_SYSTEM, 0, "odm/etc/fs_config_dirs"},
+ {00444, AID_ROOT, AID_SYSTEM, 0, "system/etc/fs_config_files"},
+ {00444, AID_ROOT, AID_SYSTEM, 0, "vendor/etc/fs_config_files"},
+ {00444, AID_ROOT, AID_SYSTEM, 0, "oem/etc/fs_config_files"},
+ {00444, AID_ROOT, AID_SYSTEM, 0, "odm/etc/fs_config_files"},
+ {00644, AID_SYSTEM, AID_ROOT, 0, "system/vendor/etc/fs_config_dirs"},
+ {00644, AID_SYSTEM, AID_ROOT, 0, "system/oem/etc/fs_config_dirs"},
+ {00644, AID_SYSTEM, AID_ROOT, 0, "system/odm/etc/fs_config_dirs"},
+ {00644, AID_SYSTEM, AID_ROOT, 0, "system/vendor/etc/fs_config_files"},
+ {00644, AID_SYSTEM, AID_ROOT, 0, "system/oem/etc/fs_config_files"},
+ {00644, AID_SYSTEM, AID_ROOT, 0, "system/odm/etc/fs_config_files"},
+ {00644, AID_SYSTEM, AID_ROOT, 0, "etc/fs_config_files"},
+ {00666, AID_ROOT, AID_SYSTEM, 0, "data/misc/oem"},
+};
diff --git a/tools/fs_config/fs_config_generate.c b/tools/fs_config/fs_config_generate.c
index c06213f..cb7ff9d 100644
--- a/tools/fs_config/fs_config_generate.c
+++ b/tools/fs_config/fs_config_generate.c
@@ -14,9 +14,11 @@
* limitations under the License.
*/
+#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include <private/android_filesystem_config.h>
@@ -28,38 +30,57 @@
* the binary format used in the /system/etc/fs_config_dirs and
* the /system/etc/fs_config_files to be used by the runtimes.
*/
+#ifdef ANDROID_FILESYSTEM_CONFIG
+#include ANDROID_FILESYSTEM_CONFIG
+#else
#include "android_filesystem_config.h"
+#endif
#ifdef NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_DIRS
- static const struct fs_path_config android_device_dirs[] = {
-};
+static const struct fs_path_config android_device_dirs[] = { };
#endif
#ifdef NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_FILES
static const struct fs_path_config android_device_files[] = {
#ifdef NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_DIRS
- { 0, AID_ROOT, AID_ROOT, 0, "system/etc/fs_config_dirs" },
+ {0000, AID_ROOT, AID_ROOT, 0, "system/etc/fs_config_dirs"},
+ {0000, AID_ROOT, AID_ROOT, 0, "vendor/etc/fs_config_dirs"},
+ {0000, AID_ROOT, AID_ROOT, 0, "oem/etc/fs_config_dirs"},
+ {0000, AID_ROOT, AID_ROOT, 0, "odm/etc/fs_config_dirs"},
#endif
- { 0, AID_ROOT, AID_ROOT, 0, "system/etc/fs_config_files" },
+ {0000, AID_ROOT, AID_ROOT, 0, "system/etc/fs_config_files"},
+ {0000, AID_ROOT, AID_ROOT, 0, "vendor/etc/fs_config_files"},
+ {0000, AID_ROOT, AID_ROOT, 0, "oem/etc/fs_config_files"},
+ {0000, AID_ROOT, AID_ROOT, 0, "odm/etc/fs_config_files"},
};
#endif
static void usage() {
fprintf(stderr,
"Generate binary content for fs_config_dirs (-D) and fs_config_files (-F)\n"
- "from device-specific android_filesystem_config.h override\n\n"
- "Usage: fs_config_generate -D|-F [-o output-file]\n");
+ "from device-specific android_filesystem_config.h override. Filter based\n"
+ "on a comma separated partition list (-P) whitelist or prefixed by a\n"
+ "minus blacklist. Partitions are identified as path references to\n"
+ "<partition>/ or system/<partition>/\n\n"
+ "Usage: fs_config_generate -D|-F [-P list] [-o output-file]\n");
}
-int main(int argc, char** argv) {
- const struct fs_path_config *pc;
- const struct fs_path_config *end;
- bool dir = false, file = false;
- FILE *fp = stdout;
- int opt;
+/* If tool switches to C++, use android-base/macros.h array_size() */
+#ifndef ARRAY_SIZE /* popular macro */
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#endif
- while((opt = getopt(argc, argv, "DFho:")) != -1) {
- switch(opt) {
+int main(int argc, char** argv) {
+ const struct fs_path_config* pc;
+ const struct fs_path_config* end;
+ bool dir = false, file = false;
+ const char* partitions = NULL;
+ FILE* fp = stdout;
+ int opt;
+ static const char optstring[] = "DFP:ho:";
+
+ while ((opt = getopt(argc, argv, optstring)) != -1) {
+ switch (opt) {
case 'D':
if (file) {
fprintf(stderr, "Must specify only -D or -F\n");
@@ -76,6 +97,30 @@
}
file = true;
break;
+ case 'P':
+ if (partitions) {
+ fprintf(stderr, "Specify only one partition list\n");
+ usage();
+ exit(EXIT_FAILURE);
+ }
+ while (*optarg && isspace(*optarg)) ++optarg;
+ if (!optarg[0]) {
+ fprintf(stderr, "Partition list empty\n");
+ usage();
+ exit(EXIT_FAILURE);
+ }
+ if (!optarg[1]) {
+ fprintf(stderr, "Partition list too short \"%s\"\n", optarg);
+ usage();
+ exit(EXIT_FAILURE);
+ }
+ if ((optarg[0] == '-') && strchr(optstring, optarg[1]) && !optarg[2]) {
+ fprintf(stderr, "Partition list is a flag \"%s\"\n", optarg);
+ usage();
+ exit(EXIT_FAILURE);
+ }
+ partitions = optarg;
+ break;
case 'o':
if (fp != stdout) {
fprintf(stderr, "Specify only one output file\n");
@@ -97,6 +142,12 @@
}
}
+ if (optind < argc) {
+ fprintf(stderr, "Unknown non-argument \"%s\"\n", argv[optind]);
+ usage();
+ exit(EXIT_FAILURE);
+ }
+
if (!file && !dir) {
fprintf(stderr, "Must specify either -F or -D\n");
usage();
@@ -105,19 +156,64 @@
if (dir) {
pc = android_device_dirs;
- end = &android_device_dirs[sizeof(android_device_dirs) / sizeof(android_device_dirs[0])];
+ end = &android_device_dirs[ARRAY_SIZE(android_device_dirs)];
} else {
pc = android_device_files;
- end = &android_device_files[sizeof(android_device_files) / sizeof(android_device_files[0])];
+ end = &android_device_files[ARRAY_SIZE(android_device_files)];
}
- for(; (pc < end) && pc->prefix; pc++) {
+ for (; (pc < end) && pc->prefix; pc++) {
+ bool submit;
char buffer[512];
ssize_t len = fs_config_generate(buffer, sizeof(buffer), pc);
if (len < 0) {
fprintf(stderr, "Entry too large\n");
exit(EXIT_FAILURE);
}
- if (fwrite(buffer, 1, len, fp) != (size_t)len) {
+ submit = true;
+ if (partitions) {
+ char* partitions_copy = strdup(partitions);
+ char* arg = partitions_copy;
+ char* sv = NULL; /* Do not leave uninitialized, NULL is known safe. */
+ /* Deal with case all iterated partitions are blacklists with no match */
+ bool all_blacklist_but_no_match = true;
+ submit = false;
+
+ if (!partitions_copy) {
+ fprintf(stderr, "Failed to allocate a copy of %s\n", partitions);
+ exit(EXIT_FAILURE);
+ }
+ /* iterate through (officially) comma separated list of partitions */
+ while (!!(arg = strtok_r(arg, ",:; \t\n\r\f", &sv))) {
+ static const char system[] = "system/";
+ size_t plen;
+ bool blacklist = false;
+ if (*arg == '-') {
+ blacklist = true;
+ ++arg;
+ } else {
+ all_blacklist_but_no_match = false;
+ }
+ plen = strlen(arg);
+ /* deal with evil callers */
+ while (arg[plen - 1] == '/') {
+ --plen;
+ }
+ /* check if we have <partition>/ or /system/<partition>/ */
+ if ((!strncmp(pc->prefix, arg, plen) && (pc->prefix[plen] == '/')) ||
+ (!strncmp(pc->prefix, system, strlen(system)) &&
+ !strncmp(pc->prefix + strlen(system), arg, plen) &&
+ (pc->prefix[strlen(system) + plen] == '/'))) {
+ all_blacklist_but_no_match = false;
+ /* we have a match !!! */
+ if (!blacklist) submit = true;
+ break;
+ }
+ arg = NULL;
+ }
+ free(partitions_copy);
+ if (all_blacklist_but_no_match) submit = true;
+ }
+ if (submit && (fwrite(buffer, 1, len, fp) != (size_t)len)) {
fprintf(stderr, "Write failure\n");
exit(EXIT_FAILURE);
}
diff --git a/tools/fs_config/fs_config_test.cpp b/tools/fs_config/fs_config_test.cpp
new file mode 100644
index 0000000..f95a4ca
--- /dev/null
+++ b/tools/fs_config/fs_config_test.cpp
@@ -0,0 +1,223 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <sys/cdefs.h>
+
+#include <string>
+#include <vector>
+
+#include <android-base/file.h>
+#include <android-base/macros.h>
+#include <android-base/strings.h>
+#include <android-base/stringprintf.h>
+#include <gtest/gtest.h>
+#include <private/android_filesystem_config.h>
+#include <private/fs_config.h>
+
+#include "android_filesystem_config_test_data.h"
+
+// must run test in the test directory
+const static char fs_config_generate_command[] = "./fs_config_generate_test";
+
+static std::string popenToString(std::string command) {
+ std::string ret;
+
+ FILE* fp = popen(command.c_str(), "r");
+ if (fp) {
+ if (!android::base::ReadFdToString(fileno(fp), &ret)) ret = "";
+ pclose(fp);
+ }
+ return ret;
+}
+
+static void confirm(std::string&& data, const fs_path_config* config,
+ ssize_t num_config) {
+ const struct fs_path_config_from_file* pc =
+ reinterpret_cast<const fs_path_config_from_file*>(data.c_str());
+ size_t len = data.size();
+
+ ASSERT_TRUE(config != NULL);
+ ASSERT_LT(0, num_config);
+
+ while (len > 0) {
+ uint16_t host_len = pc->len;
+ if (host_len > len) break;
+
+ EXPECT_EQ(config->mode, pc->mode);
+ EXPECT_EQ(config->uid, pc->uid);
+ EXPECT_EQ(config->gid, pc->gid);
+ EXPECT_EQ(config->capabilities, pc->capabilities);
+ EXPECT_STREQ(config->prefix, pc->prefix);
+
+ EXPECT_LT(0, num_config);
+ --num_config;
+ if (num_config >= 0) ++config;
+ pc = reinterpret_cast<const fs_path_config_from_file*>(
+ reinterpret_cast<const char*>(pc) + host_len);
+ len -= host_len;
+ }
+ EXPECT_EQ(0, num_config);
+}
+
+/* See local android_filesystem_config.h for test data */
+
+TEST(fs_conf_test, dirs) {
+ confirm(popenToString(
+ android::base::StringPrintf("%s -D", fs_config_generate_command)),
+ android_device_dirs, arraysize(android_device_dirs));
+}
+
+TEST(fs_conf_test, files) {
+ confirm(popenToString(
+ android::base::StringPrintf("%s -F", fs_config_generate_command)),
+ android_device_files, arraysize(android_device_files));
+}
+
+static const char vendor_str[] = "vendor/";
+static const char vendor_alt_str[] = "system/vendor/";
+static const char oem_str[] = "oem/";
+static const char oem_alt_str[] = "system/oem/";
+static const char odm_str[] = "odm/";
+static const char odm_alt_str[] = "system/odm/";
+
+TEST(fs_conf_test, system_dirs) {
+ std::vector<fs_path_config> dirs;
+ const fs_path_config* config = android_device_dirs;
+ for (size_t num = arraysize(android_device_dirs); num; --num) {
+ if (!android::base::StartsWith(config->prefix, vendor_str) &&
+ !android::base::StartsWith(config->prefix, vendor_alt_str) &&
+ !android::base::StartsWith(config->prefix, oem_str) &&
+ !android::base::StartsWith(config->prefix, oem_alt_str) &&
+ !android::base::StartsWith(config->prefix, odm_str) &&
+ !android::base::StartsWith(config->prefix, odm_alt_str)) {
+ dirs.emplace_back(*config);
+ }
+ ++config;
+ }
+ confirm(popenToString(android::base::StringPrintf(
+ "%s -D -P -vendor,-oem,-odm", fs_config_generate_command)),
+ &dirs[0], dirs.size());
+}
+
+TEST(fs_conf_test, vendor_dirs) {
+ std::vector<fs_path_config> dirs;
+ const fs_path_config* config = android_device_dirs;
+ for (size_t num = arraysize(android_device_dirs); num; --num) {
+ if (android::base::StartsWith(config->prefix, vendor_str) ||
+ android::base::StartsWith(config->prefix, vendor_alt_str)) {
+ dirs.emplace_back(*config);
+ }
+ ++config;
+ }
+ confirm(popenToString(android::base::StringPrintf(
+ "%s -D -P vendor", fs_config_generate_command)),
+ &dirs[0], dirs.size());
+}
+
+TEST(fs_conf_test, oem_dirs) {
+ std::vector<fs_path_config> dirs;
+ const fs_path_config* config = android_device_dirs;
+ for (size_t num = arraysize(android_device_dirs); num; --num) {
+ if (android::base::StartsWith(config->prefix, oem_str) ||
+ android::base::StartsWith(config->prefix, oem_alt_str)) {
+ dirs.emplace_back(*config);
+ }
+ ++config;
+ }
+ confirm(popenToString(android::base::StringPrintf(
+ "%s -D -P oem", fs_config_generate_command)),
+ &dirs[0], dirs.size());
+}
+
+TEST(fs_conf_test, odm_dirs) {
+ std::vector<fs_path_config> dirs;
+ const fs_path_config* config = android_device_dirs;
+ for (size_t num = arraysize(android_device_dirs); num; --num) {
+ if (android::base::StartsWith(config->prefix, odm_str) ||
+ android::base::StartsWith(config->prefix, odm_alt_str)) {
+ dirs.emplace_back(*config);
+ }
+ ++config;
+ }
+ confirm(popenToString(android::base::StringPrintf(
+ "%s -D -P odm", fs_config_generate_command)),
+ &dirs[0], dirs.size());
+}
+
+TEST(fs_conf_test, system_files) {
+ std::vector<fs_path_config> files;
+ const fs_path_config* config = android_device_files;
+ for (size_t num = arraysize(android_device_files); num; --num) {
+ if (!android::base::StartsWith(config->prefix, vendor_str) &&
+ !android::base::StartsWith(config->prefix, vendor_alt_str) &&
+ !android::base::StartsWith(config->prefix, oem_str) &&
+ !android::base::StartsWith(config->prefix, oem_alt_str) &&
+ !android::base::StartsWith(config->prefix, odm_str) &&
+ !android::base::StartsWith(config->prefix, odm_alt_str)) {
+ files.emplace_back(*config);
+ }
+ ++config;
+ }
+ confirm(popenToString(android::base::StringPrintf(
+ "%s -F -P -vendor,-oem,-odm", fs_config_generate_command)),
+ &files[0], files.size());
+}
+
+TEST(fs_conf_test, vendor_files) {
+ std::vector<fs_path_config> files;
+ const fs_path_config* config = android_device_files;
+ for (size_t num = arraysize(android_device_files); num; --num) {
+ if (android::base::StartsWith(config->prefix, vendor_str) ||
+ android::base::StartsWith(config->prefix, vendor_alt_str)) {
+ files.emplace_back(*config);
+ }
+ ++config;
+ }
+ confirm(popenToString(android::base::StringPrintf(
+ "%s -F -P vendor", fs_config_generate_command)),
+ &files[0], files.size());
+}
+
+TEST(fs_conf_test, oem_files) {
+ std::vector<fs_path_config> files;
+ const fs_path_config* config = android_device_files;
+ for (size_t num = arraysize(android_device_files); num; --num) {
+ if (android::base::StartsWith(config->prefix, oem_str) ||
+ android::base::StartsWith(config->prefix, oem_alt_str)) {
+ files.emplace_back(*config);
+ }
+ ++config;
+ }
+ confirm(popenToString(android::base::StringPrintf(
+ "%s -F -P oem", fs_config_generate_command)),
+ &files[0], files.size());
+}
+
+TEST(fs_conf_test, odm_files) {
+ std::vector<fs_path_config> files;
+ const fs_path_config* config = android_device_files;
+ for (size_t num = arraysize(android_device_files); num; --num) {
+ if (android::base::StartsWith(config->prefix, odm_str) ||
+ android::base::StartsWith(config->prefix, odm_alt_str)) {
+ files.emplace_back(*config);
+ }
+ ++config;
+ }
+ confirm(popenToString(android::base::StringPrintf(
+ "%s -F -P odm", fs_config_generate_command)),
+ &files[0], files.size());
+}
diff --git a/tools/generate-notice-files.py b/tools/generate-notice-files.py
index 5b13bf5..adbf7c2 100755
--- a/tools/generate-notice-files.py
+++ b/tools/generate-notice-files.py
@@ -14,14 +14,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""
-Usage: generate-notice-files [plain text output file] [html output file] [file title] [directory of notices]
+Usage: generate-notice-files --text-output [plain text output file] \
+ --html-output [html output file] \
+ --xml-output [xml output file] \
+ -t [file title] -s [directory of notices]
Generate the Android notice files, including both text and html files.
-h to display this usage message and exit.
"""
from collections import defaultdict
-import getopt
+import argparse
import hashlib
import itertools
import os
@@ -38,26 +41,6 @@
"<": "<",
}
-try:
- opts, args = getopt.getopt(sys.argv[1:], "h")
-except getopt.GetoptError, err:
- print str(err)
- print __doc__
- sys.exit(2)
-
-for o, a in opts:
- if o == "-h":
- print __doc__
- sys.exit(2)
- else:
- print >> sys.stderr, "unhandled option %s" % (o,)
-
-if len(args) != 4:
- print """need exactly four arguments, the two output files, the file title
- and the directory containing notices, not %d""" % (len(args),)
- print __doc__
- sys.exit(1)
-
def hexify(s):
return ("%02x"*len(s)) % tuple(map(ord, s))
@@ -163,27 +146,123 @@
print >> output_file, open(value[0]).read()
output_file.close()
-def main(args):
- txt_output_file = args[0]
- html_output_file = args[1]
- file_title = args[2]
+def combine_notice_files_xml(files_with_same_hash, input_dir, output_filename):
+ """Combine notice files in FILE_HASH and output a XML version to OUTPUT_FILENAME."""
+
+ SRC_DIR_STRIP_RE = re.compile(input_dir + "(/.*).txt")
+
+ # Set up a filename to row id table (anchors inside tables don't work in
+ # most browsers, but href's to table row ids do)
+ id_table = {}
+ for file_key in files_with_same_hash.keys():
+ for filename in files_with_same_hash[file_key]:
+ id_table[filename] = file_key
+
+ # Open the output file, and output the header pieces
+ output_file = open(output_filename, "wb")
+
+ print >> output_file, '<?xml version="1.0" encoding="utf-8"?>'
+ print >> output_file, "<licenses>"
+
+ # Flatten the list of lists into a single list of filenames
+ sorted_filenames = sorted(id_table.keys())
+
+ # Print out a nice table of contents
+ for filename in sorted_filenames:
+ stripped_filename = SRC_DIR_STRIP_RE.sub(r"\1", filename)
+ print >> output_file, '<file-name contentId="%s">%s</file-name>' % (id_table.get(filename), stripped_filename)
+
+ print >> output_file
+ print >> output_file
+
+ processed_file_keys = []
+ # Output the individual notice file lists
+ for filename in sorted_filenames:
+ file_key = id_table.get(filename)
+ if file_key in processed_file_keys:
+ continue
+ processed_file_keys.append(file_key)
+
+ print >> output_file, '<file-content contentId="%s"><![CDATA[%s]]></file-content>' % (file_key, html_escape(open(filename).read()))
+ print >> output_file
+
+ # Finish off the file output
+ print >> output_file, "</licenses>"
+ output_file.close()
+
+def get_args():
+ parser = argparse.ArgumentParser()
+ parser.add_argument(
+ '--text-output', required=True,
+ help='The text output file path.')
+ parser.add_argument(
+ '--html-output',
+ help='The html output file path.')
+ parser.add_argument(
+ '--xml-output',
+ help='The xml output file path.')
+ parser.add_argument(
+ '-t', '--title', required=True,
+ help='The file title.')
+ parser.add_argument(
+ '-s', '--source-dir', required=True,
+ help='The directory containing notices.')
+ parser.add_argument(
+ '-i', '--included-subdirs', action='append',
+ help='The sub directories which should be included.')
+ parser.add_argument(
+ '-e', '--excluded-subdirs', action='append',
+ help='The sub directories which should be excluded.')
+ return parser.parse_args()
+
+def main(argv):
+ args = get_args()
+
+ txt_output_file = args.text_output
+ html_output_file = args.html_output
+ xml_output_file = args.xml_output
+ file_title = args.title
+ included_subdirs = []
+ excluded_subdirs = []
+ if args.included_subdirs is not None:
+ included_subdirs = args.included_subdirs
+ if args.excluded_subdirs is not None:
+ excluded_subdirs = args.excluded_subdirs
# Find all the notice files and md5 them
- input_dir = os.path.normpath(args[3])
+ input_dir = os.path.normpath(args.source_dir)
files_with_same_hash = defaultdict(list)
for root, dir, files in os.walk(input_dir):
for file in files:
- if file.endswith(".txt"):
+ matched = True
+ if len(included_subdirs) > 0:
+ matched = False
+ for subdir in included_subdirs:
+ if root.startswith(input_dir + '/' + subdir):
+ matched = True
+ break
+ elif len(excluded_subdirs) > 0:
+ for subdir in excluded_subdirs:
+ if root.startswith(input_dir + '/' + subdir):
+ matched = False
+ break
+ if matched and file.endswith(".txt"):
filename = os.path.join(root, file)
file_md5sum = md5sum(filename)
files_with_same_hash[file_md5sum].append(filename)
filesets = [sorted(files_with_same_hash[md5]) for md5 in sorted(files_with_same_hash.keys())]
- print "Combining NOTICE files into HTML"
- combine_notice_files_html(filesets, input_dir, html_output_file)
print "Combining NOTICE files into text"
combine_notice_files_text(filesets, input_dir, txt_output_file, file_title)
+ if html_output_file is not None:
+ print "Combining NOTICE files into HTML"
+ combine_notice_files_html(filesets, input_dir, html_output_file)
+
+ if xml_output_file is not None:
+ print "Combining NOTICE files into XML"
+ combine_notice_files_xml(files_with_same_hash, input_dir, xml_output_file)
+
if __name__ == "__main__":
- main(args)
+ main(sys.argv)
diff --git a/tools/releasetools/blockimgdiff.py b/tools/releasetools/blockimgdiff.py
index e385866..b8123c0 100644
--- a/tools/releasetools/blockimgdiff.py
+++ b/tools/releasetools/blockimgdiff.py
@@ -41,10 +41,10 @@
cmd = ['imgdiff', '-z'] if imgdiff else ['bsdiff']
cmd.extend([srcfile, tgtfile, patchfile])
- # Not using common.Run(), which would otherwise dump all the bsdiff/imgdiff
- # commands when OPTIONS.verbose is True - not useful for the case here, since
- # they contain temp filenames only.
- p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ # Don't dump the bsdiff/imgdiff commands, which are not useful for the case
+ # here, since they contain temp filenames only.
+ p = common.Run(cmd, verbose=False, stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT)
output, _ = p.communicate()
if p.returncode != 0:
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index e200f9f..925a523 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -107,10 +107,15 @@
pass
-def Run(args, **kwargs):
- """Create and return a subprocess.Popen object, printing the command
- line on the terminal if -v was specified."""
- if OPTIONS.verbose:
+def Run(args, verbose=None, **kwargs):
+ """Create and return a subprocess.Popen object.
+
+ Caller can specify if the command line should be printed. The global
+ OPTIONS.verbose will be used if not specified.
+ """
+ if verbose is None:
+ verbose = OPTIONS.verbose
+ if verbose:
print(" running: ", " ".join(args))
return subprocess.Popen(args, **kwargs)
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index f75bb96..1a7e10e 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -316,6 +316,59 @@
return sparse_img.SparseImage(path, mappath, clobbered_blocks)
+def AddCompatibilityArchive(target_zip, output_zip, system_included=True,
+ vendor_included=True):
+ """Adds compatibility info from target files into the output zip.
+
+ Metadata used for on-device compatibility verification is retrieved from
+ target_zip then added to compatibility.zip which is added to the output_zip
+ archive.
+
+ Compatibility archive should only be included for devices with a vendor
+ partition as checking provides value when system and vendor are independently
+ versioned.
+
+ Args:
+ target_zip: Zip file containing the source files to be included for OTA.
+ output_zip: Zip file that will be sent for OTA.
+ system_included: If True, the system image will be updated and therefore
+ its metadata should be included.
+ vendor_included: If True, the vendor image will be updated and therefore
+ its metadata should be included.
+ """
+
+ # Determine what metadata we need. Files are names relative to META/.
+ compatibility_files = []
+ vendor_metadata = ("vendor_manifest.xml", "vendor_matrix.xml")
+ system_metadata = ("system_manifest.xml", "system_matrix.xml")
+ if vendor_included:
+ compatibility_files += vendor_metadata
+ if system_included:
+ compatibility_files += system_metadata
+
+ # Create new archive.
+ compatibility_archive = tempfile.NamedTemporaryFile()
+ compatibility_archive_zip = zipfile.ZipFile(compatibility_archive, "w",
+ compression=zipfile.ZIP_DEFLATED)
+
+ # Add metadata.
+ for file_name in compatibility_files:
+ target_file_name = "META/" + file_name
+
+ if target_file_name in target_zip.namelist():
+ data = target_zip.read(target_file_name)
+ common.ZipWriteStr(compatibility_archive_zip, file_name, data)
+
+ # Ensure files are written before we copy into output_zip.
+ compatibility_archive_zip.close()
+
+ # Only add the archive if we have any compatibility info.
+ if compatibility_archive_zip.namelist():
+ common.ZipWrite(output_zip, compatibility_archive.name,
+ arcname="compatibility.zip",
+ compress_type=zipfile.ZIP_STORED)
+
+
def WriteFullOTAPackage(input_zip, output_zip):
# TODO: how to determine this? We don't know what version it will
# be installed on top of. For now, we expect the API just won't
@@ -943,6 +996,9 @@
if 'care_map.txt' in zip_file.namelist():
offsets.append(ComputeEntryOffsetSize('care_map.txt'))
+ if 'compatibility.zip' in zip_file.namelist():
+ offsets.append(ComputeEntryOffsetSize('compatibility.zip'))
+
# 'META-INF/com/android/metadata' is required. We don't know its actual
# offset and length (as well as the values for other entries). So we
# reserve 10-byte as a placeholder, which is to cover the space for metadata
@@ -1114,8 +1170,8 @@
# If dm-verity is supported for the device, copy contents of care_map
# into A/B OTA package.
+ target_zip = zipfile.ZipFile(target_file, "r")
if OPTIONS.info_dict.get("verity") == "true":
- target_zip = zipfile.ZipFile(target_file, "r")
care_map_path = "META/care_map.txt"
namelist = target_zip.namelist()
if care_map_path in namelist:
@@ -1124,7 +1180,34 @@
compress_type=zipfile.ZIP_STORED)
else:
print("Warning: cannot find care map file in target_file package")
- common.ZipClose(target_zip)
+
+ if HasVendorPartition(target_zip):
+ update_vendor = True
+ update_system = True
+
+ # If incremental then figure out what is being updated so metadata only for
+ # the updated image is included.
+ if source_file is not None:
+ input_tmp, input_zip = common.UnzipTemp(
+ target_file, UNZIP_PATTERN)
+ source_tmp, source_zip = common.UnzipTemp(
+ source_file, UNZIP_PATTERN)
+
+ vendor_src = GetImage("vendor", source_tmp)
+ vendor_tgt = GetImage("vendor", input_tmp)
+ system_src = GetImage("system", source_tmp)
+ system_tgt = GetImage("system", input_tmp)
+
+ update_system = system_src.TotalSha1() != system_tgt.TotalSha1()
+ update_vendor = vendor_src.TotalSha1() != vendor_tgt.TotalSha1()
+
+ input_zip.close()
+ source_zip.close()
+
+ target_zip = zipfile.ZipFile(target_file, "r")
+ AddCompatibilityArchive(target_zip, output_zip, update_system,
+ update_vendor)
+ common.ZipClose(target_zip)
# Write the current metadata entry with placeholders.
metadata['ota-streaming-property-files'] = ComputeStreamingMetadata(
diff --git a/tools/warn.py b/tools/warn.py
index e786e3c..8aed830 100755
--- a/tools/warn.py
+++ b/tools/warn.py
@@ -2385,7 +2385,8 @@
def parse_input_file(infile):
- """Parse input file, match warning lines."""
+ """Parse input file, collect parameters and warning lines."""
+ global android_root
global platform_version
global target_product
global target_variant
@@ -2412,6 +2413,9 @@
m = re.search('(?<=^TARGET_BUILD_VARIANT=).*', line)
if m is not None:
target_variant = m.group(0)
+ m = re.search('.* TOP=([^ ]*) .*', line)
+ if m is not None:
+ android_root = m.group(1)
return warning_lines
@@ -2463,10 +2467,11 @@
if (FlagURL == "") return line;
if (FlagSeparator == "") {
return line.replace(ParseLinePattern,
- "<a href='" + FlagURL + "/$1'>$1</a>:$2:$3");
+ "<a target='_blank' href='" + FlagURL + "/$1'>$1</a>:$2:$3");
}
return line.replace(ParseLinePattern,
- "<a href='" + FlagURL + "/$1" + FlagSeparator + "$2'>$1:$2</a>:$3");
+ "<a target='_blank' href='" + FlagURL + "/$1" + FlagSeparator +
+ "$2'>$1:$2</a>:$3");
}
function createArrayOfDictionaries(n) {
var result = [];