Merge "Add a build-time flag for AVF permission change" into main
diff --git a/core/Makefile b/core/Makefile
index a591fbb..099df47 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -5137,40 +5137,48 @@
my_board_extracted_kernel :=
-# BOARD_KERNEL_CONFIG_FILE and BOARD_KERNEL_VERSION can be used to override the values extracted
-# from INSTALLED_KERNEL_TARGET.
-ifdef BOARD_KERNEL_CONFIG_FILE
-ifdef BOARD_KERNEL_VERSION
-$(BUILT_KERNEL_CONFIGS_FILE): $(BOARD_KERNEL_CONFIG_FILE)
- cp $< $@
-$(BUILT_KERNEL_VERSION_FILE):
- echo $(BOARD_KERNEL_VERSION) > $@
-
-$(call declare-license-metadata,$(BUILT_KERNEL_CONFIGS_FILE),SPDX-license-identifier-GPL-2.0-only,restricted,$(BUILD_SYSTEM)/LINUX_KERNEL_COPYING,"Kernel",kernel)
-$(call declare-license-metadata,$(BUILT_KERNEL_VERSION_FILE),SPDX-license-identifier-GPL-2.0-only,restricted,$(BUILD_SYSTEM)/LINUX_KERNEL_COPYING,"Kernel",kernel)
-
-my_board_extracted_kernel := true
-endif # BOARD_KERNEL_VERSION
-endif # BOARD_KERNEL_CONFIG_FILE
-
-ifneq ($(my_board_extracted_kernel),true)
# Tools for decompression that is not in PATH.
# Check $(EXTRACT_KERNEL) for decompression algorithms supported by the script.
# Algorithms that are in the script but not in this list will be found in PATH.
my_decompress_tools := \
lz4:$(HOST_OUT_EXECUTABLES)/lz4 \
-endif # my_board_extracted_kernel
+
+# BOARD_KERNEL_CONFIG_FILE and BOARD_KERNEL_VERSION can be used to override the values extracted
+# from INSTALLED_KERNEL_TARGET.
+ifdef BOARD_KERNEL_VERSION
+$(BUILT_KERNEL_VERSION_FILE): PRIVATE_DECOMPRESS_TOOLS := $(my_decompress_tools)
+$(BUILT_KERNEL_VERSION_FILE): $(foreach pair,$(my_decompress_tools),$(call word-colon,2,$(pair)))
+$(BUILT_KERNEL_VERSION_FILE): $(EXTRACT_KERNEL) $(firstword $(INSTALLED_KERNEL_TARGET))
+ KERNEL_RELEASE=`$(EXTRACT_KERNEL) --tools $(PRIVATE_DECOMPRESS_TOOLS) --input $(firstword $(INSTALLED_KERNEL_TARGET)) \
+ --output-release` ;\
+ if [ "$$KERNEL_RELEASE" != '$(BOARD_KERNEL_VERSION)' ]; then \
+ echo "Specified kernel version '$(BOARD_KERNEL_VERSION)' does not match actual kernel version '$$KERNEL_RELEASE' " ; exit 1; fi;
+ echo '$(BOARD_KERNEL_VERSION)' > $@
+
+ifdef BOARD_KERNEL_CONFIG_FILE
+$(BUILT_KERNEL_CONFIGS_FILE): $(BOARD_KERNEL_CONFIG_FILE)
+ cp $< $@
+
+$(call declare-license-metadata,$(BUILT_KERNEL_CONFIGS_FILE),SPDX-license-identifier-GPL-2.0-only,restricted,$(BUILD_SYSTEM)/LINUX_KERNEL_COPYING,"Kernel",kernel)
+$(call declare-license-metadata,$(BUILT_KERNEL_VERSION_FILE),SPDX-license-identifier-GPL-2.0-only,restricted,$(BUILD_SYSTEM)/LINUX_KERNEL_COPYING,"Kernel",kernel)
+
+my_board_extracted_kernel := true
+endif # BOARD_KERNEL_CONFIG_FILE
+endif # BOARD_KERNEL_VERSION
+
ifneq ($(my_board_extracted_kernel),true)
ifdef INSTALLED_KERNEL_TARGET
+ifndef BOARD_KERNEL_VERSION
$(BUILT_KERNEL_CONFIGS_FILE): .KATI_IMPLICIT_OUTPUTS := $(BUILT_KERNEL_VERSION_FILE)
+endif
$(BUILT_KERNEL_CONFIGS_FILE): PRIVATE_DECOMPRESS_TOOLS := $(my_decompress_tools)
$(BUILT_KERNEL_CONFIGS_FILE): $(foreach pair,$(my_decompress_tools),$(call word-colon,2,$(pair)))
$(BUILT_KERNEL_CONFIGS_FILE): $(EXTRACT_KERNEL) $(firstword $(INSTALLED_KERNEL_TARGET))
$< --tools $(PRIVATE_DECOMPRESS_TOOLS) --input $(firstword $(INSTALLED_KERNEL_TARGET)) \
--output-configs $@ \
- --output-release $(BUILT_KERNEL_VERSION_FILE)
+ $(if $(BOARD_KERNEL_VERSION),,--output-release $(BUILT_KERNEL_VERSION_FILE))
$(call declare-license-metadata,$(BUILT_KERNEL_CONFIGS_FILE),SPDX-license-identifier-GPL-2.0-only,restricted,$(BUILD_SYSTEM)/LINUX_KERNEL_COPYING,"Kernel",kernel)
@@ -5941,6 +5949,20 @@
fi
endef
+# This is the same as the non-hermetic version, but also accepts a list of files in the directory
+# to copy. It will only copy those files. This is so that we don't copy extra files that could've
+# been built in the staging directories by prior builds.
+# $(1): Directory to copy
+# $(2): Location to copy it to
+# $(3): A list of files in the $(1) directory, only these files will be copied
+define package_files-copy-root-hermetic
+ $(if $(BUILD_BROKEN_INCORRECT_PARTITION_IMAGES),
+ $(call package_files-copy-root,$(1),$(2)),
+ $(foreach f,$(filter $(strip $(1))/%,$(3)), \
+ mkdir -p $(strip $(2))/$(dir $(patsubst $(strip $(1))/%,%,$(f)))$(newline) \
+ $(ACP) -d $(f) $(strip $(2))/$(patsubst $(strip $(1))/%,%,$(f))$(newline)))
+endef
+
built_ota_tools :=
# We can't build static executables when SANITIZE_TARGET=address
@@ -6290,7 +6312,7 @@
$(BUILT_KERNEL_VERSION_FILE) \
| $(ACP)
@echo "Building target files: $@"
- $(hide) rm -rf $@ $@.list $(zip_root)
+ $(hide) rm -rf $@ $(zip_root)
$(hide) mkdir -p $(dir $@) $(zip_root)
ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT))$(filter true,$(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT)))
@# Components of the recovery image
@@ -6417,8 +6439,8 @@
endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET
ifdef BUILDING_SYSTEM_IMAGE
@# Contents of the system image
- $(hide) $(call package_files-copy-root, \
- $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
+ $(hide) $(call package_files-copy-root-hermetic, \
+ $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM,$(FULL_SYSTEMIMAGE_DEPS))
else ifdef INSTALLED_BUILD_PROP_TARGET
@# Copy the system build.prop even if not building a system image
@# because add_img_to_target_files may need it to build other partition
@@ -6428,48 +6450,48 @@
endif
ifdef BUILDING_USERDATA_IMAGE
@# Contents of the data image
- $(hide) $(call package_files-copy-root, \
- $(TARGET_OUT_DATA),$(zip_root)/DATA)
+ $(hide) $(call package_files-copy-root-hermetic, \
+ $(TARGET_OUT_DATA),$(zip_root)/DATA,$(INSTALLED_USERDATAIMAGE_TARGET_DEPS))
endif
ifdef BUILDING_VENDOR_IMAGE
@# Contents of the vendor image
- $(hide) $(call package_files-copy-root, \
- $(TARGET_OUT_VENDOR),$(zip_root)/VENDOR)
+ $(hide) $(call package_files-copy-root-hermetic, \
+ $(TARGET_OUT_VENDOR),$(zip_root)/VENDOR,$(INTERNAL_VENDORIMAGE_FILES))
endif
ifdef BUILDING_PRODUCT_IMAGE
@# Contents of the product image
- $(hide) $(call package_files-copy-root, \
- $(TARGET_OUT_PRODUCT),$(zip_root)/PRODUCT)
+ $(hide) $(call package_files-copy-root-hermetic, \
+ $(TARGET_OUT_PRODUCT),$(zip_root)/PRODUCT,$(INTERNAL_PRODUCTIMAGE_FILES))
endif
ifdef BUILDING_SYSTEM_EXT_IMAGE
@# Contents of the system_ext image
- $(hide) $(call package_files-copy-root, \
- $(TARGET_OUT_SYSTEM_EXT),$(zip_root)/SYSTEM_EXT)
+ $(hide) $(call package_files-copy-root-hermetic, \
+ $(TARGET_OUT_SYSTEM_EXT),$(zip_root)/SYSTEM_EXT,$(INTERNAL_SYSTEM_EXTIMAGE_FILES))
endif
ifdef BUILDING_ODM_IMAGE
@# Contents of the odm image
- $(hide) $(call package_files-copy-root, \
- $(TARGET_OUT_ODM),$(zip_root)/ODM)
+ $(hide) $(call package_files-copy-root-hermetic, \
+ $(TARGET_OUT_ODM),$(zip_root)/ODM,$(INTERNAL_ODMIMAGE_FILES))
endif
ifdef BUILDING_VENDOR_DLKM_IMAGE
@# Contents of the vendor_dlkm image
- $(hide) $(call package_files-copy-root, \
- $(TARGET_OUT_VENDOR_DLKM),$(zip_root)/VENDOR_DLKM)
+ $(hide) $(call package_files-copy-root-hermetic, \
+ $(TARGET_OUT_VENDOR_DLKM),$(zip_root)/VENDOR_DLKM,$(INTERNAL_VENDOR_DLKMIMAGE_FILES))
endif
ifdef BUILDING_ODM_DLKM_IMAGE
@# Contents of the odm_dlkm image
- $(hide) $(call package_files-copy-root, \
- $(TARGET_OUT_ODM_DLKM),$(zip_root)/ODM_DLKM)
+ $(hide) $(call package_files-copy-root-hermetic, \
+ $(TARGET_OUT_ODM_DLKM),$(zip_root)/ODM_DLKM,$(INTERNAL_ODM_DLKMIMAGE_FILES))
endif
ifdef BUILDING_SYSTEM_DLKM_IMAGE
@# Contents of the system_dlkm image
- $(hide) $(call package_files-copy-root, \
- $(TARGET_OUT_SYSTEM_DLKM),$(zip_root)/SYSTEM_DLKM)
+ $(hide) $(call package_files-copy-root-hermetic, \
+ $(TARGET_OUT_SYSTEM_DLKM),$(zip_root)/SYSTEM_DLKM,$(INTERNAL_SYSTEM_DLKMIMAGE_FILES))
endif
ifdef BUILDING_SYSTEM_OTHER_IMAGE
@# Contents of the system_other image
- $(hide) $(call package_files-copy-root, \
- $(TARGET_OUT_SYSTEM_OTHER),$(zip_root)/SYSTEM_OTHER)
+ $(hide) $(call package_files-copy-root-hermetic, \
+ $(TARGET_OUT_SYSTEM_OTHER),$(zip_root)/SYSTEM_OTHER,$(INTERNAL_SYSTEMOTHERIMAGE_FILES))
endif
@# Extra contents of the OTA package
$(hide) mkdir -p $(zip_root)/OTA
@@ -6558,7 +6580,8 @@
endif
ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true)
@# If breakpad symbols have been generated, add them to the zip.
- $(hide) cp -R $(TARGET_OUT_BREAKPAD) $(zip_root)/BREAKPAD
+ $(call package_files-copy-root, \
+ $(TARGET_OUT_BREAKPAD),$(zip_root)/BREAKPAD)
endif
ifdef BOARD_PREBUILT_VENDORIMAGE
$(hide) mkdir -p $(zip_root)/IMAGES
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index 6ac169b..6791125 100644
--- a/core/dex_preopt.mk
+++ b/core/dex_preopt.mk
@@ -90,8 +90,8 @@
# The input variables are written by build/soong/java/dexpreopt_bootjars.go. Examples can be found
# at the bottom of build/soong/java/dexpreopt_config_testing.go.
dexpreopt_root_dir := $(dir $(patsubst %/,%,$(dir $(firstword $(bootclasspath_jars)))))
-booclasspath_arg := $(subst $(space),:,$(patsubst $(dexpreopt_root_dir)%,%,$(DEXPREOPT_BOOTCLASSPATH_DEX_FILES)))
-booclasspath_locations_arg := $(subst $(space),:,$(DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS))
+bootclasspath_arg := $(subst $(space),:,$(patsubst $(dexpreopt_root_dir)%,%,$(DEXPREOPT_BOOTCLASSPATH_DEX_FILES)))
+bootclasspath_locations_arg := $(subst $(space),:,$(DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS))
boot_images := $(subst :,$(space),$(DEXPREOPT_IMAGE_LOCATIONS_ON_DEVICE$(DEXPREOPT_INFIX)))
boot_image_arg := $(subst $(space),:,$(patsubst /%,%,$(boot_images)))
dex2oat_extra_args := $(if $(filter true,$(ENABLE_UFFD_GC)),--runtime-arg -Xgc:CMC)
@@ -99,8 +99,8 @@
boot_zip_metadata_txt := $(dir $(boot_zip))boot_zip/METADATA.txt
$(boot_zip_metadata_txt):
rm -f $@
- echo "booclasspath = $(booclasspath_arg)" >> $@
- echo "booclasspath-locations = $(booclasspath_locations_arg)" >> $@
+ echo "bootclasspath = $(bootclasspath_arg)" >> $@
+ echo "bootclasspath-locations = $(bootclasspath_locations_arg)" >> $@
echo "boot-image = $(boot_image_arg)" >> $@
echo "extra-args = $(dex2oat_extra_args)" >> $@
diff --git a/core/release_config.mk b/core/release_config.mk
index 4f9daaf..b72ee89 100644
--- a/core/release_config.mk
+++ b/core/release_config.mk
@@ -76,12 +76,6 @@
ifeq ($(filter $(_all_release_configs), $(TARGET_RELEASE)),)
$(error No release config found for TARGET_RELEASE: $(TARGET_RELEASE). Available releases are: $(_all_release_configs))
else
-# TODO(b/294161396): Remove this logic
-ifeq ($(TARGET_RELEASE),next)
-ifndef TESTING_TARGET_RELEASE_NEXT
- $(error "next" releases are not supported yet. b/294161396)
-endif
-endif
# Choose flag files
# Don't sort this, use it in the order they gave us.
flag_value_files := $(_all_release_configs.$(TARGET_RELEASE).FILES)
diff --git a/core/soong_config.mk b/core/soong_config.mk
index e00447a..5bcdfce 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -319,6 +319,10 @@
$(call add_json_bool, CheckVendorSeappViolations, $(filter true,$(CHECK_VENDOR_SEAPP_VIOLATIONS)))
+$(call add_json_map, PartitionVars)
+ $(call add_json_str, ProductDirectory, $(dir $(INTERNAL_PRODUCT)))
+$(call end_json_map)
+
$(call json_end)
$(file >$(SOONG_VARIABLES).tmp,$(json_contents))
diff --git a/target/board/Android.mk b/target/board/Android.mk
index 21c0c10..decc345 100644
--- a/target/board/Android.mk
+++ b/target/board/Android.mk
@@ -10,15 +10,29 @@
# device we're building for. This file is typically packaged up
# with everything else.
#
-# If TARGET_BOARD_INFO_FILE (which can be set in BoardConfig.mk) is
-# defined, it is used, otherwise board-info.txt is looked for in
-# $(TARGET_DEVICE_DIR).
+# The following logic is used to find the contents of the info file:
+# 1. TARGET_BOARD_INFO_FILES (can be set in BoardConfig.mk) will be combined.
+# 2. TARGET_BOARD_INFO_FILE (can be set in BoardConfig.mk) will be used.
+# 3. $(TARGET_DEVICE_DIR)/board-info.txt will be used if present.
+#
+# Specifying both TARGET_BOARD_INFO_FILES and TARGET_BOARD_INFO_FILE is an
+# error.
#
INSTALLED_ANDROID_INFO_TXT_TARGET := $(PRODUCT_OUT)/android-info.txt
-board_info_txt := $(TARGET_BOARD_INFO_FILE)
-ifndef board_info_txt
-board_info_txt := $(wildcard $(TARGET_DEVICE_DIR)/board-info.txt)
+ifdef TARGET_BOARD_INFO_FILES
+ ifdef TARGET_BOARD_INFO_FILE
+ $(warning Both TARGET_BOARD_INFO_FILES and TARGET_BOARD_INFO_FILE are defined.)
+ $(warning Using $(TARGET_BOARD_INFO_FILES) rather than $(TARGET_BOARD_INFO_FILE) for android-info.txt)
+ endif
+ board_info_txt := $(call intermediates-dir-for,PACKAGING,board-info)/board-info.txt
+$(board_info_txt): $(TARGET_BOARD_INFO_FILES)
+ $(hide) cat $(TARGET_BOARD_INFO_FILES) > $@
+else ifdef TARGET_BOARD_INFO_FILE
+ board_info_txt := $(TARGET_BOARD_INFO_FILE)
+else
+ board_info_txt := $(wildcard $(TARGET_DEVICE_DIR)/board-info.txt)
endif
+
CHECK_RADIO_VERSIONS := $(HOST_OUT_EXECUTABLES)/check_radio_versions$(HOST_EXECUTABLE_SUFFIX)
$(INSTALLED_ANDROID_INFO_TXT_TARGET): $(board_info_txt) $(CHECK_RADIO_VERSIONS)
$(hide) $(CHECK_RADIO_VERSIONS) \
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index c74d0a3..f8dbafd 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -22,7 +22,6 @@
android.hidl.base-V1.0-java \
android.hidl.manager-V1.0-java \
android.hidl.memory@1.0-impl \
- android.hidl.memory@1.0-impl.vendor \
android.system.suspend-service \
android.test.base \
android.test.mock \
diff --git a/target/product/base_vendor.mk b/target/product/base_vendor.mk
index d22f71f..b6e5370 100644
--- a/target/product/base_vendor.mk
+++ b/target/product/base_vendor.mk
@@ -46,6 +46,7 @@
# Base modules and settings for the vendor partition.
PRODUCT_PACKAGES += \
+ android.hidl.memory@1.0-impl.vendor \
com.android.hardware.cas \
boringssl_self_test_vendor \
dumpsys_vendor \
diff --git a/tools/auto_gen_test_config.py b/tools/auto_gen_test_config.py
index 0bf47c6..8ee599a 100755
--- a/tools/auto_gen_test_config.py
+++ b/tools/auto_gen_test_config.py
@@ -17,6 +17,7 @@
"""A tool to generate TradeFed test config file.
"""
+import argparse
import re
import os
import shutil
@@ -43,20 +44,28 @@
Returns:
0 if no error, otherwise 1.
"""
- if len(argv) != 4 and len(argv) != 6:
- sys.stderr.write(
- f'Invalid arguments: {argv}. The script requires 4 arguments for file paths: '
- 'target_config, android_manifest (or the xmltree dump), empty_config, '
- 'instrumentation_test_config_template, '
- 'and 2 optional arguments for extra configs: '
- '--extra-configs \'EXTRA_CONFIGS\'.\n')
- return 1
- target_config = argv[0]
- android_manifest = argv[1]
- empty_config = argv[2]
- instrumentation_test_config_template = argv[3]
- extra_configs = '\n'.join(argv[5].split('\\n')) if len(argv) == 6 else ''
+ parser = argparse.ArgumentParser()
+ parser.add_argument(
+ "target_config",
+ help="Path to the generated output config.")
+ parser.add_argument(
+ "android_manifest",
+ help="Path to AndroidManifest.xml or output of 'aapt2 dump xmltree' with .xmltree extension.")
+ parser.add_argument(
+ "empty_config",
+ help="Path to the empty config template.")
+ parser.add_argument(
+ "instrumentation_test_config_template",
+ help="Path to the instrumentation test config template.")
+ parser.add_argument("--extra-configs", default="")
+ args = parser.parse_args(argv)
+
+ target_config = args.target_config
+ android_manifest = args.android_manifest
+ empty_config = args.empty_config
+ instrumentation_test_config_template = args.instrumentation_test_config_template
+ extra_configs = '\n'.join(args.extra_configs.split('\\n'))
module = os.path.splitext(os.path.basename(target_config))[0]
@@ -70,7 +79,7 @@
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pattern = re.compile(r"\(Raw:\s\"(.*)\"\)$")
curr_element = None
- for line in manifest.readlines():
+ for line in manifest:
curr_line = line.strip()
if curr_line.startswith("E:"):
# e.g. "E: instrumentation (line=9)"