Merge "DO NOT MERGE: Merge Oreo MR1 into master"
diff --git a/core/Makefile b/core/Makefile
index 265c14d..a4f46ca 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1303,12 +1303,10 @@
$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
$(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))), \
$(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE))))
- $(if $(and $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),$(filter true,$(BOARD_AVB_ENABLE))), \
- $(hide) $(AVBTOOL) add_hash_footer \
- --image $(1) \
- --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
- --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \
- $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS))
+ $(if $(filter true,$(BOARD_AVB_ENABLE)), \
+ $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
+ $(hide) $(AVBTOOL) add_hash_footer --image $(1) --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS),\
+ $(hide) $(AVBTOOL) add_hash_footer --image $(1) --partition_size $(BOARD_RECOVERYIMAGE_PARTITION_SIZE) --partition_name recovery $(INTERNAL_AVB_RECOVERY_SIGNING_ARGS) $(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)))
endef
ADBD := $(TARGET_OUT_EXECUTABLES)/adbd
@@ -1962,6 +1960,7 @@
DTBO_FOOTER_ARGS := BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS
SYSTEM_FOOTER_ARGS := BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS
VENDOR_FOOTER_ARGS := BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS
+RECOVERY_FOOTER_ARGS := BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS
# Check and set required build variables for a chain partition.
# $(1): the partition to enable AVB chain, e.g., BOOT or SYSTEM.
@@ -2023,6 +2022,15 @@
endif
endif
+ifdef INSTALLED_RECOVERYIMAGE_TARGET
+ifdef BOARD_AVB_RECOVERY_KEY_PATH
+$(eval $(call check-and-set-avb-chain-args,RECOVERY))
+else
+INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
+ --include_descriptors_from_image $(INSTALLED_RECOVERYIMAGE_TARGET)
+endif
+endif
+
BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --padding_size 4096
# Add kernel cmdline descriptor for kernel to mount system.img as root with
@@ -2061,6 +2069,9 @@
$(if $(BOARD_AVB_DTBO_KEY_PATH),\
$(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_DTBO_KEY_PATH) \
--output $(1)/dtbo.avbpubkey)
+ $(if $(BOARD_AVB_RECOVERY_KEY_PATH),\
+ $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_RECOVERY_KEY_PATH) \
+ --output $(1)/recovery.avbpubkey)
endef
define build-vbmetaimage-target
@@ -2076,7 +2087,14 @@
endef
INSTALLED_VBMETAIMAGE_TARGET := $(BUILT_VBMETAIMAGE_TARGET)
-$(INSTALLED_VBMETAIMAGE_TARGET): $(AVBTOOL) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_SYSTEMIMAGE) $(INSTALLED_VENDORIMAGE_TARGET) $(INSTALLED_DTBOIMAGE_TARGET) $(BOARD_AVB_KEY_PATH)
+$(INSTALLED_VBMETAIMAGE_TARGET): \
+ $(AVBTOOL) \
+ $(INSTALLED_BOOTIMAGE_TARGET) \
+ $(INSTALLED_SYSTEMIMAGE) \
+ $(INSTALLED_VENDORIMAGE_TARGET) \
+ $(INSTALLED_DTBOIMAGE_TARGET) \
+ $(INSTALLED_RECOVERYIMAGE_TARGET) \
+ $(BOARD_AVB_KEY_PATH)
$(build-vbmetaimage-target)
.PHONY: vbmetaimage-nodeps
@@ -2506,6 +2524,12 @@
$(hide) echo "avb_boot_algorithm=$(BOARD_AVB_BOOT_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
$(hide) echo "avb_boot_rollback_index_location=$(BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
endif # BOARD_AVB_BOOT_KEY_PATH
+ $(hide) echo "avb_recovery_add_hash_footer_args=$(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
+ifdef BOARD_AVB_RECOVERY_KEY_PATH
+ $(hide) echo "avb_recovery_key_path=$(BOARD_AVB_RECOVERY_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
+ $(hide) echo "avb_recovery_algorithm=$(BOARD_AVB_RECOVERY_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
+ $(hide) echo "avb_recovery_rollback_index_location=$(BOARD_AVB_RECOVERY_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
+endif # BOARD_AVB_RECOVERY_KEY_PATH
endif # BOARD_AVB_ENABLE
ifdef BOARD_BPT_INPUT_FILES
$(hide) echo "board_bpt_enable=true" >> $(zip_root)/META/misc_info.txt
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index e4ce21f..fc2adde 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -244,6 +244,7 @@
LOCAL_STRIP_MODULE:=
LOCAL_SYSTEM_SHARED_LIBRARIES:=none
LOCAL_TARGET_REQUIRED_MODULES:=
+LOCAL_TEST_CONFIG_OPTIONS:=
LOCAL_TEST_DATA:=
LOCAL_TEST_MODULE_TO_PROGUARD_WITH:=
LOCAL_TIDY:=
diff --git a/core/config.mk b/core/config.mk
index daaa54e..d7e6f1e 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -155,6 +155,8 @@
BUILD_HOST_DALVIK_JAVA_LIBRARY := $(BUILD_SYSTEM)/host_dalvik_java_library.mk
BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY := $(BUILD_SYSTEM)/host_dalvik_static_java_library.mk
+BUILD_HOST_TEST_CONFIG:= $(BUILD_SYSTEM)/host_test_config.mk
+BUILD_TARGET_TEST_CONFIG:= $(BUILD_SYSTEM)/target_test_config.mk
# ###############################################################
# Parse out any modifier targets.
diff --git a/core/definitions.mk b/core/definitions.mk
index b850bb8..96a6663 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -3027,7 +3027,9 @@
HOST_DALVIK_JAVA_LIBRARY \
HOST_DALVIK_STATIC_JAVA_LIBRARY \
base_rules \
- HEADER_LIBRARY
+ HEADER_LIBRARY \
+ HOST_TEST_CONFIG \
+ TARGET_TEST_CONFIG
$(foreach s,$(STATS.MODULE_TYPE),$(eval STATS.MODULE_TYPE.$(s) :=))
define record-module-type
diff --git a/core/envsetup.mk b/core/envsetup.mk
index c02a5a3..e220fae 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -391,6 +391,8 @@
HOST_CROSS_OUT_GEN := $(HOST_CROSS_OUT)/gen
+HOST_OUT_TEST_CONFIG := $(HOST_OUT)/test_config
+
# Out for HOST_2ND_ARCH
HOST_2ND_ARCH_VAR_PREFIX := 2ND_
HOST_2ND_ARCH_MODULE_SUFFIX := _32
@@ -466,6 +468,7 @@
TARGET_OUT_NOTICE_FILES := $(TARGET_OUT_INTERMEDIATES)/NOTICE_FILES
TARGET_OUT_FAKE := $(PRODUCT_OUT)/fake_packages
TARGET_OUT_TESTCASES := $(PRODUCT_OUT)/testcases
+TARGET_OUT_TEST_CONFIG := $(PRODUCT_OUT)/test_config
ifeq ($(SANITIZE_LITE),true)
# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
diff --git a/core/host_test_config.mk b/core/host_test_config.mk
new file mode 100644
index 0000000..b9975e5
--- /dev/null
+++ b/core/host_test_config.mk
@@ -0,0 +1,25 @@
+#
+# 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.
+#
+
+#
+# Common rules for building a TradeFed test XML file for host side tests.
+#
+
+$(call record-module-type,HOST_TEST_CONFIG)
+
+LOCAL_IS_HOST_MODULE := true
+
+include $(BUILD_SYSTEM)/test_config_common.mk
diff --git a/core/main.mk b/core/main.mk
index 90e365f..cac9c59 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -97,11 +97,21 @@
# (must be defined before including definitions.make)
INTERNAL_MODIFIER_TARGETS := all
-# EMMA_INSTRUMENT_STATIC merges the static emma library to each emma-enabled module.
+# EMMA_INSTRUMENT_STATIC merges the static jacoco library to each
+# jacoco-enabled module.
ifeq (true,$(EMMA_INSTRUMENT_STATIC))
EMMA_INSTRUMENT := true
endif
+ifeq (true,$(EMMA_INSTRUMENT))
+# Adding the jacoco library can cause the inclusion of
+# some typically banned classes
+# So if the user didn't specify SKIP_BOOT_JARS_CHECK, enable it here
+ifndef SKIP_BOOT_JARS_CHECK
+SKIP_BOOT_JARS_CHECK := true
+endif
+endif
+
#
# -----------------------------------------------------------------
# Validate ADDITIONAL_DEFAULT_PROPERTIES.
diff --git a/core/target_test_config.mk b/core/target_test_config.mk
new file mode 100644
index 0000000..61f5d2b
--- /dev/null
+++ b/core/target_test_config.mk
@@ -0,0 +1,23 @@
+#
+# 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.
+#
+
+#
+# Common rules for building a TradeFed test XML file for target side tests.
+#
+
+$(call record-module-type,TARGET_TEST_CONFIG)
+
+include $(BUILD_SYSTEM)/test_config_common.mk
diff --git a/core/test_config_common.mk b/core/test_config_common.mk
new file mode 100644
index 0000000..487f9f2
--- /dev/null
+++ b/core/test_config_common.mk
@@ -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.
+#
+
+LOCAL_MODULE_CLASS := TEST_CONFIG
+
+# Output test config files to testcases directory.
+ifeq (,$(filter general-tests, $(LOCAL_COMPATIBILITY_SUITE)))
+ LOCAL_COMPATIBILITY_SUITE += general-tests
+endif
+
+LOCAL_MODULE_SUFFIX := .config
+
+my_test_config_file := $(wildcard $(LOCAL_PATH)/$(LOCAL_MODULE).xml)
+LOCAL_SRC_FILES :=
+
+include $(BUILD_SYSTEM)/base_rules.mk
+
+# The test config is not in a standalone XML file.
+ifndef my_test_config_file
+
+ifndef LOCAL_TEST_CONFIG_OPTIONS
+ $(call pretty-error,LOCAL_TEST_CONFIG_OPTIONS must be set if the test XML file is not provided.)
+endif
+
+my_base_test_config_file := $(LOCAL_PATH)/AndroidTest.xml
+my_test_config_file := $(dir $(LOCAL_BUILT_MODULE))AndroidTest.xml
+
+$(my_test_config_file) : PRIVATE_test_config_options := $(LOCAL_TEST_CONFIG_OPTIONS)
+$(my_test_config_file) : $(my_base_test_config_file)
+ @echo "Create $(notdir $@) with options: $(PRIVATE_test_config_options)."
+ $(eval _option_xml := \
+ $(foreach option,$(PRIVATE_test_config_options), \
+ $(eval p := $(subst :,$(space),$(option))) \
+ <option name="$(word 1,$(p))" value="$(word 2,$(p))" \/>\n))
+ $(hide) sed 's&</configuration>&$(_option_xml)</configuration>&' $< > $@
+
+endif # my_test_config_file
+
+$(LOCAL_BUILT_MODULE) : $(my_test_config_file)
+ $(copy-file-to-target)
+
+my_base_test_config_file :=
+my_test_config_file :=
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 6b75366..fc1f52a 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -501,15 +501,15 @@
img_unsigned.close()
img_keyblock.close()
- # AVB: if enabled, calculate and add hash to boot.img.
+ # AVB: if enabled, calculate and add hash to boot.img or recovery.img.
if info_dict.get("avb_enable") == "true":
avbtool = os.getenv('AVBTOOL') or info_dict["avb_avbtool"]
- part_size = info_dict["boot_size"]
+ part_size = info_dict[partition_name + "_size"]
cmd = [avbtool, "add_hash_footer", "--image", img.name,
"--partition_size", str(part_size), "--partition_name",
partition_name]
AppendAVBSigningArgs(cmd, partition_name)
- args = info_dict.get("avb_boot_add_hash_footer_args")
+ args = info_dict.get("avb_" + partition_name + "_add_hash_footer_args")
if args and args.strip():
cmd.extend(shlex.split(args))
p = Run(cmd, stdout=subprocess.PIPE)
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index 44977a4..f559b29 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -589,6 +589,7 @@
AVB_FOOTER_ARGS_BY_PARTITION = {
'boot' : 'avb_boot_add_hash_footer_args',
'dtbo' : 'avb_dtbo_add_hash_footer_args',
+ 'recovery' : 'avb_recovery_add_hash_footer_args',
'system' : 'avb_system_add_hashtree_footer_args',
'vendor' : 'avb_vendor_add_hashtree_footer_args',
'vbmeta' : 'avb_vbmeta_args',