Merge "system += misctrl" into main
diff --git a/ci/build_test_suites.py b/ci/build_test_suites.py
index 9b83148..5798f2b 100644
--- a/ci/build_test_suites.py
+++ b/ci/build_test_suites.py
@@ -25,7 +25,7 @@
import re
import subprocess
import sys
-from typing import Any, Dict, Set, Text
+from typing import Any
import test_mapping_module_retriever
@@ -80,6 +80,9 @@
# Call the build command with everything.
build_command = base_build_command(args)
build_command.extend(modules_to_build)
+ # When not building general-tests we also have to build the general tests
+ # shared libs.
+ build_command.append('general-tests-shared-libs')
run_command(build_command, print_output=True)
@@ -104,7 +107,7 @@
def run_command(
args: list[str],
- env: Dict[Text, Text] = os.environ,
+ env: dict[str, str] = os.environ,
print_output: bool = False,
) -> str:
result = subprocess.run(
@@ -129,8 +132,8 @@
def find_modules_to_build(
- change_info: pathlib.Path, extra_required_modules: list[Text]
-) -> Set[Text]:
+ change_info: pathlib.Path, extra_required_modules: list[str]
+) -> set[str]:
changed_files = find_changed_files(change_info)
test_mappings = test_mapping_module_retriever.GetTestMappings(
@@ -147,7 +150,7 @@
return modules_to_build
-def find_changed_files(change_info: pathlib.Path) -> Set[Text]:
+def find_changed_files(change_info: pathlib.Path) -> set[str]:
with open(change_info) as change_info_file:
change_info_contents = json.load(change_info_file)
@@ -164,8 +167,8 @@
def find_affected_modules(
- test_mappings: Dict[str, Any], changed_files: Set[Text]
-) -> Set[Text]:
+ test_mappings: dict[str, Any], changed_files: set[str]
+) -> set[str]:
modules = set()
# The test_mappings object returned by GetTestMappings is organized as
@@ -200,7 +203,7 @@
# TODO(lucafarsi): Share this logic with the original logic in
# test_mapping_test_retriever.py
def matches_file_patterns(
- file_patterns: list[Text], changed_files: Set[Text]
+ file_patterns: list[set], changed_files: set[str]
) -> bool:
for changed_file in changed_files:
for pattern in file_patterns:
@@ -211,33 +214,45 @@
def zip_build_outputs(
- modules_to_build: Set[Text], dist_dir: Text, target_release: Text
+ modules_to_build: set[str], dist_dir: str, target_release: str
):
src_top = os.environ.get('TOP', os.getcwd())
# Call dumpvars to get the necessary things.
# TODO(lucafarsi): Don't call soong_ui 4 times for this, --dumpvars-mode can
# do it but it requires parsing.
- host_out_testcases = get_soong_var('HOST_OUT_TESTCASES', target_release)
- target_out_testcases = get_soong_var('TARGET_OUT_TESTCASES', target_release)
- product_out = get_soong_var('PRODUCT_OUT', target_release)
- soong_host_out = get_soong_var('SOONG_HOST_OUT', target_release)
- host_out = get_soong_var('HOST_OUT', target_release)
+ host_out_testcases = pathlib.Path(
+ get_soong_var('HOST_OUT_TESTCASES', target_release)
+ )
+ target_out_testcases = pathlib.Path(
+ get_soong_var('TARGET_OUT_TESTCASES', target_release)
+ )
+ product_out = pathlib.Path(get_soong_var('PRODUCT_OUT', target_release))
+ soong_host_out = pathlib.Path(get_soong_var('SOONG_HOST_OUT', target_release))
+ host_out = pathlib.Path(get_soong_var('HOST_OUT', target_release))
# Call the class to package the outputs.
# TODO(lucafarsi): Move this code into a replaceable class.
host_paths = []
target_paths = []
+ host_config_files = []
+ target_config_files = []
for module in modules_to_build:
host_path = os.path.join(host_out_testcases, module)
if os.path.exists(host_path):
host_paths.append(host_path)
+ collect_config_files(src_top, host_path, host_config_files)
target_path = os.path.join(target_out_testcases, module)
if os.path.exists(target_path):
target_paths.append(target_path)
+ collect_config_files(src_top, target_path, target_config_files)
- zip_command = ['time', os.path.join(host_out, 'bin', 'soong_zip')]
+ zip_test_configs_zips(
+ dist_dir, host_out, product_out, host_config_files, target_config_files
+ )
+
+ zip_command = base_zip_command(host_out, dist_dir, 'general-tests.zip')
# Add host testcases.
zip_command.append('-C')
@@ -274,13 +289,107 @@
zip_command.append('-f')
zip_command.append(os.path.join(framework_path, 'vts-tradefed.jar'))
- # Zip to the DIST dir.
- zip_command.append('-o')
- zip_command.append(os.path.join(dist_dir, 'general-tests.zip'))
-
run_command(zip_command, print_output=True)
+def collect_config_files(
+ src_top: pathlib.Path, root_dir: pathlib.Path, config_files: list[str]
+):
+ for root, dirs, files in os.walk(os.path.join(src_top, root_dir)):
+ for file in files:
+ if file.endswith('.config'):
+ config_files.append(os.path.join(root_dir, file))
+
+
+def base_zip_command(
+ host_out: pathlib.Path, dist_dir: pathlib.Path, name: str
+) -> list[str]:
+ return [
+ 'time',
+ os.path.join(host_out, 'bin', 'soong_zip'),
+ '-d',
+ '-o',
+ os.path.join(dist_dir, name),
+ ]
+
+
+# generate general-tests_configs.zip which contains all of the .config files
+# that were built and general-tests_list.zip which contains a text file which
+# lists all of the .config files that are in general-tests_configs.zip.
+#
+# general-tests_comfigs.zip is organized as follows:
+# /
+# host/
+# testcases/
+# test_1.config
+# test_2.config
+# ...
+# target/
+# testcases/
+# test_1.config
+# test_2.config
+# ...
+#
+# So the process is we write out the paths to all the host config files into one
+# file and all the paths to the target config files in another. We also write
+# the paths to all the config files into a third file to use for
+# general-tests_list.zip.
+def zip_test_configs_zips(
+ dist_dir: pathlib.Path,
+ host_out: pathlib.Path,
+ product_out: pathlib.Path,
+ host_config_files: list[str],
+ target_config_files: list[str],
+):
+ with open(
+ os.path.join(host_out, 'host_general-tests_list'), 'w'
+ ) as host_list_file, open(
+ os.path.join(product_out, 'target_general-tests_list'), 'w'
+ ) as target_list_file, open(
+ os.path.join(host_out, 'general-tests_list'), 'w'
+ ) as list_file:
+
+ for config_file in host_config_files:
+ host_list_file.write(config_file + '\n')
+ list_file.write('host/' + os.path.relpath(config_file, host_out) + '\n')
+
+ for config_file in target_config_files:
+ target_list_file.write(config_file + '\n')
+ list_file.write(
+ 'target/' + os.path.relpath(config_file, product_out) + '\n'
+ )
+
+ tests_config_zip_command = base_zip_command(
+ host_out, dist_dir, 'general-tests_configs.zip'
+ )
+ tests_config_zip_command.append('-P')
+ tests_config_zip_command.append('host')
+ tests_config_zip_command.append('-C')
+ tests_config_zip_command.append(host_out)
+ tests_config_zip_command.append('-l')
+ tests_config_zip_command.append(
+ os.path.join(host_out, 'host_general-tests_list')
+ )
+ tests_config_zip_command.append('-P')
+ tests_config_zip_command.append('target')
+ tests_config_zip_command.append('-C')
+ tests_config_zip_command.append(product_out)
+ tests_config_zip_command.append('-l')
+ tests_config_zip_command.append(
+ os.path.join(product_out, 'target_general-tests_list')
+ )
+ run_command(tests_config_zip_command, print_output=True)
+
+ tests_list_zip_command = base_zip_command(
+ host_out, dist_dir, 'general-tests_list.zip'
+ )
+ tests_list_zip_command.append('-C')
+ tests_list_zip_command.append(host_out)
+ tests_list_zip_command.append('-f')
+ tests_list_zip_command.append(os.path.join(host_out, 'general-tests_list'))
+ run_command(tests_list_zip_command, print_output=True)
+
+
def get_soong_var(var: str, target_release: str) -> str:
new_env = os.environ.copy()
new_env['TARGET_RELEASE'] = target_release
diff --git a/core/Makefile b/core/Makefile
index 9e4298e..d4e241e 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -5140,8 +5140,9 @@
check_vintf_system_deps :=
# -- Check vendor manifest / matrix including fragments (excluding other device manifests / matrices)
-check_vintf_vendor_deps := $(filter $(TARGET_OUT_VENDOR)/etc/vintf/%, $(check_vintf_common_srcs))
-check_vintf_vendor_deps += $(filter $(TARGET_OUT_VENDOR)/apex/%, $(check_vintf_common_srcs))
+check_vintf_vendor_deps := $(filter $(TARGET_OUT_VENDOR)/etc/vintf/% \
+ $(TARGET_OUT_VENDOR)/apex/%, \
+ $(check_vintf_common_srcs))
ifneq ($(strip $(check_vintf_vendor_deps)),)
check_vintf_has_vendor := true
check_vintf_vendor_log := $(intermediates)/check_vintf_vendor.log
diff --git a/core/android_soong_config_vars.mk b/core/android_soong_config_vars.mk
index 5afdd6c..9f43a3e 100644
--- a/core/android_soong_config_vars.mk
+++ b/core/android_soong_config_vars.mk
@@ -152,10 +152,6 @@
$(call add_soong_config_var_value,ANDROID,avf_enabled,$(PRODUCT_AVF_ENABLED))
endif
-ifdef PRODUCT_AVF_KERNEL_MODULES_ENABLED
-$(call add_soong_config_var_value,ANDROID,avf_kernel_modules_enabled,$(PRODUCT_AVF_KERNEL_MODULES_ENABLED))
-endif
-
$(call add_soong_config_var_value,ANDROID,release_avf_allow_preinstalled_apps,$(RELEASE_AVF_ALLOW_PREINSTALLED_APPS))
$(call add_soong_config_var_value,ANDROID,release_avf_enable_device_assignment,$(RELEASE_AVF_ENABLE_DEVICE_ASSIGNMENT))
$(call add_soong_config_var_value,ANDROID,release_avf_enable_dice_changes,$(RELEASE_AVF_ENABLE_DICE_CHANGES))
@@ -203,5 +199,12 @@
# Add crashrecovery build flag to soong
$(call soong_config_set,ANDROID,release_crashrecovery_module,$(RELEASE_CRASHRECOVERY_MODULE))
+ifeq (true,$(RELEASE_CRASHRECOVERY_FILE_MOVE))
+ $(call soong_config_set,ANDROID,crashrecovery_files_in_module,true)
+ $(call soong_config_set,ANDROID,crashrecovery_files_in_platform,false)
+else
+ $(call soong_config_set,ANDROID,crashrecovery_files_in_module,false)
+ $(call soong_config_set,ANDROID,crashrecovery_files_in_platform,true)
+endif
# Weirdly required because platform_bootclasspath is using AUTO namespace
$(call soong_config_set,AUTO,release_crashrecovery_module,$(RELEASE_CRASHRECOVERY_MODULE))
diff --git a/core/main.mk b/core/main.mk
index 9b98efe..9b7382b 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -434,6 +434,8 @@
# To speedup startup of non-preopted builds, don't verify or compile the boot image.
ADDITIONAL_SYSTEM_PROPERTIES += dalvik.vm.image-dex2oat-filter=extract
endif
+# b/323566535
+ADDITIONAL_SYSTEM_PROPERTIES += init.svc_debug.no_fatal.zygote=true
endif
## asan ##
@@ -1994,17 +1996,6 @@
.PHONY: findbugs
findbugs: $(INTERNAL_FINDBUGS_HTML_TARGET) $(INTERNAL_FINDBUGS_XML_TARGET)
-LSDUMP_PATHS_FILE := $(PRODUCT_OUT)/lsdump_paths.txt
-
-.PHONY: findlsdumps
-# LSDUMP_PATHS is a list of tag:path.
-findlsdumps: $(LSDUMP_PATHS_FILE) $(foreach p,$(LSDUMP_PATHS),$(call word-colon,2,$(p)))
-
-$(LSDUMP_PATHS_FILE): PRIVATE_LSDUMP_PATHS := $(LSDUMP_PATHS)
-$(LSDUMP_PATHS_FILE):
- @echo "Generate $@"
- @rm -rf $@ && echo -e "$(subst :,:$(space),$(subst $(space),\n,$(PRIVATE_LSDUMP_PATHS)))" > $@
-
.PHONY: check-elf-files
check-elf-files:
diff --git a/core/tasks/general-tests-shared-libs.mk b/core/tasks/general-tests-shared-libs.mk
new file mode 100644
index 0000000..2405140
--- /dev/null
+++ b/core/tasks/general-tests-shared-libs.mk
@@ -0,0 +1,52 @@
+# Copyright (C) 2024 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.
+
+.PHONY: general-tests-shared-libs
+
+intermediates_dir := $(call intermediates-dir-for,PACKAGING,general-tests-shared-libs)
+
+general_tests_shared_libs_zip := $(PRODUCT_OUT)/general-tests_host-shared-libs.zip
+
+# Filter shared entries between general-tests and device-tests's HOST_SHARED_LIBRARY.FILES,
+# to avoid warning about overriding commands.
+my_host_shared_lib_for_general_tests := \
+ $(foreach m,$(filter $(COMPATIBILITY.device-tests.HOST_SHARED_LIBRARY.FILES),\
+ $(COMPATIBILITY.general-tests.HOST_SHARED_LIBRARY.FILES)),$(call word-colon,2,$(m)))
+my_general_tests_shared_lib_files := \
+ $(filter-out $(COMPATIBILITY.device-tests.HOST_SHARED_LIBRARY.FILES),\
+ $(COMPATIBILITY.general-tests.HOST_SHARED_LIBRARY.FILES))
+
+my_host_shared_lib_for_general_tests += $(call copy-many-files,$(my_general_tests_shared_lib_files))
+
+$(general_tests_shared_libs_zip) : PRIVATE_INTERMEDIATES_DIR := $(intermediates_dir)
+$(general_tests_shared_libs_zip) : PRIVATE_HOST_SHARED_LIBS := $(my_host_shared_lib_for_general_tests)
+$(general_tests_shared_libs_zip) : PRIVATE_general_host_shared_libs_zip := $(general_tests_shared_libs_zip)
+$(general_tests_shared_libs_zip) : $(my_host_shared_lib_for_general_tests) $(SOONG_ZIP)
+ rm -rf $(PRIVATE_INTERMEDIATES_DIR)
+ mkdir -p $(PRIVATE_INTERMEDIATES_DIR) $(PRIVATE_INTERMEDIATES_DIR)/tools
+ $(hide) for shared_lib in $(PRIVATE_HOST_SHARED_LIBS); do \
+ echo $$shared_lib >> $(PRIVATE_INTERMEDIATES_DIR)/shared-libs.list; \
+ done
+ grep $(HOST_OUT_TESTCASES) $(PRIVATE_INTERMEDIATES_DIR)/shared-libs.list > $(PRIVATE_INTERMEDIATES_DIR)/host-shared-libs.list || true
+ $(SOONG_ZIP) -d -o $(PRIVATE_general_host_shared_libs_zip) \
+ -P host -C $(HOST_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/host-shared-libs.list
+
+general-tests-shared-libs: $(general_tests_shared_libs_zip)
+$(call dist-for-goals, general-tests-shared-libs, $(general_tests_shared_libs_zip))
+
+$(call declare-1p-container,$(general_tests_shared_libs_zip),)
+$(call declare-container-license-deps,$(general_tests_shared_libs_zip),$(my_host_shared_lib_for_general_tests),$(PRODUCT_OUT)/:/)
+
+intermediates_dir :=
+general_tests_shared_libs_zip :=
diff --git a/core/tasks/general-tests.mk b/core/tasks/general-tests.mk
index fb2a6be..cae71e4 100644
--- a/core/tasks/general-tests.mk
+++ b/core/tasks/general-tests.mk
@@ -24,21 +24,8 @@
# Create an artifact to include a list of test config files in general-tests.
general_tests_list_zip := $(PRODUCT_OUT)/general-tests_list.zip
-# Filter shared entries between general-tests and device-tests's HOST_SHARED_LIBRARY.FILES,
-# to avoid warning about overriding commands.
-my_host_shared_lib_for_general_tests := \
- $(foreach m,$(filter $(COMPATIBILITY.device-tests.HOST_SHARED_LIBRARY.FILES),\
- $(COMPATIBILITY.general-tests.HOST_SHARED_LIBRARY.FILES)),$(call word-colon,2,$(m)))
-my_general_tests_shared_lib_files := \
- $(filter-out $(COMPATIBILITY.device-tests.HOST_SHARED_LIBRARY.FILES),\
- $(COMPATIBILITY.general-tests.HOST_SHARED_LIBRARY.FILES))
-
-my_host_shared_lib_for_general_tests += $(call copy-many-files,$(my_general_tests_shared_lib_files))
-
# Create an artifact to include all test config files in general-tests.
general_tests_configs_zip := $(PRODUCT_OUT)/general-tests_configs.zip
-# Create an artifact to include all shared librariy files in general-tests.
-general_tests_host_shared_libs_zip := $(PRODUCT_OUT)/general-tests_host-shared-libs.zip
# Copy kernel test modules to testcases directories
include $(BUILD_SYSTEM)/tasks/tools/vts-kernel-tests.mk
@@ -50,16 +37,17 @@
.PHONY: vts_kernel_ltp_tests
vts_kernel_ltp_tests: $(copy_ltp_tests)
+general_tests_shared_libs_zip := $(PRODUCT_OUT)/general-tests_host-shared-libs.zip
+
+$(general_tests_zip) : $(general_tests_shared_libs_zip)
$(general_tests_zip) : $(copy_ltp_tests)
$(general_tests_zip) : PRIVATE_KERNEL_LTP_HOST_OUT := $(kernel_ltp_host_out)
$(general_tests_zip) : PRIVATE_general_tests_list_zip := $(general_tests_list_zip)
-$(general_tests_zip) : .KATI_IMPLICIT_OUTPUTS := $(general_tests_list_zip) $(general_tests_configs_zip) $(general_tests_host_shared_libs_zip)
+$(general_tests_zip) : .KATI_IMPLICIT_OUTPUTS := $(general_tests_list_zip) $(general_tests_configs_zip)
$(general_tests_zip) : PRIVATE_TOOLS := $(general_tests_tools)
$(general_tests_zip) : PRIVATE_INTERMEDIATES_DIR := $(intermediates_dir)
-$(general_tests_zip) : PRIVATE_HOST_SHARED_LIBS := $(my_host_shared_lib_for_general_tests)
$(general_tests_zip) : PRIVATE_general_tests_configs_zip := $(general_tests_configs_zip)
-$(general_tests_zip) : PRIVATE_general_host_shared_libs_zip := $(general_tests_host_shared_libs_zip)
-$(general_tests_zip) : $(COMPATIBILITY.general-tests.FILES) $(general_tests_tools) $(my_host_shared_lib_for_general_tests) $(SOONG_ZIP)
+$(general_tests_zip) : $(COMPATIBILITY.general-tests.FILES) $(general_tests_tools) $(SOONG_ZIP)
rm -rf $(PRIVATE_INTERMEDIATES_DIR)
rm -f $@ $(PRIVATE_general_tests_list_zip)
mkdir -p $(PRIVATE_INTERMEDIATES_DIR) $(PRIVATE_INTERMEDIATES_DIR)/tools
@@ -69,11 +57,6 @@
grep $(TARGET_OUT_TESTCASES) $(PRIVATE_INTERMEDIATES_DIR)/list > $(PRIVATE_INTERMEDIATES_DIR)/target.list || true
grep -e .*\\.config$$ $(PRIVATE_INTERMEDIATES_DIR)/host.list > $(PRIVATE_INTERMEDIATES_DIR)/host-test-configs.list || true
grep -e .*\\.config$$ $(PRIVATE_INTERMEDIATES_DIR)/target.list > $(PRIVATE_INTERMEDIATES_DIR)/target-test-configs.list || true
- $(hide) for shared_lib in $(PRIVATE_HOST_SHARED_LIBS); do \
- echo $$shared_lib >> $(PRIVATE_INTERMEDIATES_DIR)/host.list; \
- echo $$shared_lib >> $(PRIVATE_INTERMEDIATES_DIR)/shared-libs.list; \
- done
- grep $(HOST_OUT_TESTCASES) $(PRIVATE_INTERMEDIATES_DIR)/shared-libs.list > $(PRIVATE_INTERMEDIATES_DIR)/host-shared-libs.list || true
cp -fp $(PRIVATE_TOOLS) $(PRIVATE_INTERMEDIATES_DIR)/tools/
$(SOONG_ZIP) -d -o $@ \
-P host -C $(PRIVATE_INTERMEDIATES_DIR) -D $(PRIVATE_INTERMEDIATES_DIR)/tools \
@@ -83,21 +66,19 @@
$(SOONG_ZIP) -d -o $(PRIVATE_general_tests_configs_zip) \
-P host -C $(HOST_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/host-test-configs.list \
-P target -C $(PRODUCT_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/target-test-configs.list
- $(SOONG_ZIP) -d -o $(PRIVATE_general_host_shared_libs_zip) \
- -P host -C $(HOST_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/host-shared-libs.list
grep -e .*\\.config$$ $(PRIVATE_INTERMEDIATES_DIR)/host.list | sed s%$(HOST_OUT)%host%g > $(PRIVATE_INTERMEDIATES_DIR)/general-tests_list
grep -e .*\\.config$$ $(PRIVATE_INTERMEDIATES_DIR)/target.list | sed s%$(PRODUCT_OUT)%target%g >> $(PRIVATE_INTERMEDIATES_DIR)/general-tests_list
$(SOONG_ZIP) -d -o $(PRIVATE_general_tests_list_zip) -C $(PRIVATE_INTERMEDIATES_DIR) -f $(PRIVATE_INTERMEDIATES_DIR)/general-tests_list
general-tests: $(general_tests_zip)
-$(call dist-for-goals, general-tests, $(general_tests_zip) $(general_tests_list_zip) $(general_tests_configs_zip) $(general_tests_host_shared_libs_zip))
+$(call dist-for-goals, general-tests, $(general_tests_zip) $(general_tests_list_zip) $(general_tests_configs_zip) $(general_tests_shared_libs_zip))
$(call declare-1p-container,$(general_tests_zip),)
-$(call declare-container-license-deps,$(general_tests_zip),$(COMPATIBILITY.general-tests.FILES) $(general_tests_tools) $(my_host_shared_lib_for_general_tests),$(PRODUCT_OUT)/:/)
+$(call declare-container-license-deps,$(general_tests_zip),$(COMPATIBILITY.general-tests.FILES) $(general_tests_tools),$(PRODUCT_OUT)/:/)
intermediates_dir :=
general_tests_tools :=
general_tests_zip :=
general_tests_list_zip :=
general_tests_configs_zip :=
-general_tests_host_shared_libs_zip :=
+general_tests_shared_libs_zip :=
diff --git a/core/version_util.mk b/core/version_util.mk
index 0ed4499..6cda0fc 100644
--- a/core/version_util.mk
+++ b/core/version_util.mk
@@ -31,6 +31,7 @@
# PLATFORM_VNDK_VERSION
# PLATFORM_SYSTEMSDK_VERSIONS
# PLATFORM_VERSION_LAST_STABLE
+# PLATFORM_VERSION_KNOWN_CODENAMES
#
# Look for an optional file containing overrides of the defaults,
@@ -95,17 +96,10 @@
PLATFORM_VERSION_LAST_STABLE := $(RELEASE_PLATFORM_VERSION_LAST_STABLE)
.KATI_READONLY := PLATFORM_VERSION_LAST_STABLE
-
-# This are all known codenames. Should this move into the release config?
-PLATFORM_VERSION_KNOWN_CODENAMES := \
-Base Base11 Cupcake Donut Eclair Eclair01 EclairMr1 Froyo Gingerbread GingerbreadMr1 \
-Honeycomb HoneycombMr1 HoneycombMr2 IceCreamSandwich IceCreamSandwichMr1 \
-JellyBean JellyBeanMr1 JellyBeanMr2 Kitkat KitkatWatch Lollipop LollipopMr1 M N NMr1 O OMr1 P \
-Q R S Sv2 Tiramisu UpsideDownCake VanillaIceCream
-
-# Convert from space separated list to comma separated
-PLATFORM_VERSION_KNOWN_CODENAMES := \
- $(call normalize-comma-list,$(PLATFORM_VERSION_KNOWN_CODENAMES))
+ifdef PLATFORM_VERSION_KNOWN_CODENAMES
+ $(error Do not set PLATFORM_VERSION_KNOWN_CODENAMES directly. Use RELEASE_PLATFORM_VERSION_KNOWN_CODENAMES. value: $(PLATFORM_VERSION_KNOWN_CODENAMES))
+endif
+PLATFORM_VERSION_KNOWN_CODENAMES := $(RELEASE_PLATFORM_VERSION_KNOWN_CODENAMES)
.KATI_READONLY := PLATFORM_VERSION_KNOWN_CODENAMES
ifndef PLATFORM_VERSION
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index f813a7b..3840e1f 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -18,6 +18,7 @@
PRODUCT_PACKAGES += \
abx \
adbd_system_api \
+ aflags \
am \
android.hidl.base-V1.0-java \
android.hidl.manager-V1.0-java \
diff --git a/target/product/default_art_config.mk b/target/product/default_art_config.mk
index 3e3918c..dca9baa 100644
--- a/target/product/default_art_config.mk
+++ b/target/product/default_art_config.mk
@@ -74,6 +74,7 @@
com.android.media:updatable-media \
com.android.mediaprovider:framework-mediaprovider \
com.android.mediaprovider:framework-pdf \
+ com.android.mediaprovider:framework-pdf-v \
com.android.ondevicepersonalization:framework-ondevicepersonalization \
com.android.os.statsd:framework-statsd \
com.android.permission:framework-permission \
@@ -108,6 +109,7 @@
# Keep the list sorted by module names and then library names.
PRODUCT_APEX_BOOT_JARS_FOR_SOURCE_BUILD_ONLY := \
com.android.mediaprovider:framework-pdf \
+ com.android.mediaprovider:framework-pdf-v \
# List of system_server classpath jars delivered via apex.
# Keep the list sorted by module names and then library names.
diff --git a/target/product/gsi/Android.mk b/target/product/gsi/Android.mk
index 54c84ea..f348fbb 100644
--- a/target/product/gsi/Android.mk
+++ b/target/product/gsi/Android.mk
@@ -109,6 +109,38 @@
@chmod a+x $@
#####################################################################
+# ABI reference dumps.
+
+# LSDUMP_PATHS is a list of tag:path. They are written to LSDUMP_PATHS_FILE.
+LSDUMP_PATHS_FILE := $(PRODUCT_OUT)/lsdump_paths.txt
+
+$(LSDUMP_PATHS_FILE): PRIVATE_LSDUMP_PATHS := $(LSDUMP_PATHS)
+$(LSDUMP_PATHS_FILE):
+ @echo "Generate $@"
+ @rm -rf $@ && echo -e "$(subst :,:$(space),$(subst $(space),\n,$(PRIVATE_LSDUMP_PATHS)))" > $@
+
+# $(1): A list of tags.
+# $(2): A list of tag:path.
+# Return the file paths of the ABI dumps that match the tags.
+define filter-abi-dump-paths
+$(eval tag_patterns := $(addsuffix :%,$(1)))
+$(patsubst $(tag_patterns),%,$(filter $(tag_patterns),$(2)))
+endef
+
+# Subsets of LSDUMP_PATHS.
+.PHONY: findlsdumps_LLNDK
+findlsdumps_LLNDK: $(LSDUMP_PATHS_FILE) $(call filter-abi-dump-paths,LLNDK,$(LSDUMP_PATHS))
+
+.PHONY: findlsdumps_NDK
+findlsdumps_NDK: $(LSDUMP_PATHS_FILE) $(call filter-abi-dump-paths,NDK,$(LSDUMP_PATHS))
+
+.PHONY: findlsdumps_PLATFORM
+findlsdumps_PLATFORM: $(LSDUMP_PATHS_FILE) $(call filter-abi-dump-paths,PLATFORM,$(LSDUMP_PATHS))
+
+.PHONY: findlsdumps
+findlsdumps: $(LSDUMP_PATHS_FILE) $(foreach p,$(LSDUMP_PATHS),$(call word-colon,2,$(p)))
+
+#####################################################################
# Check that all ABI reference dumps have corresponding
# NDK/VNDK/PLATFORM libraries.
@@ -123,12 +155,15 @@
# $(1): A list of tags.
# $(2): A list of tag:path.
# Return the file names of the ABI dumps that match the tags.
-define filter-abi-dump-paths
-$(eval tag_patterns := $(foreach tag,$(1),$(tag):%))
-$(notdir $(patsubst $(tag_patterns),%,$(filter $(tag_patterns),$(2))))
+define filter-abi-dump-names
+$(notdir $(call filter-abi-dump-paths,$(1),$(2)))
endef
-VNDK_ABI_DUMP_DIR := prebuilts/abi-dumps/vndk/$(PLATFORM_VNDK_VERSION)
+ifdef RELEASE_BOARD_API_LEVEL
+ VNDK_ABI_DUMP_DIR := prebuilts/abi-dumps/vndk/$(RELEASE_BOARD_API_LEVEL)
+else
+ VNDK_ABI_DUMP_DIR := prebuilts/abi-dumps/vndk/$(PLATFORM_VNDK_VERSION)
+endif
ifeq (REL,$(PLATFORM_VERSION_CODENAME))
NDK_ABI_DUMP_DIR := prebuilts/abi-dumps/ndk/$(PLATFORM_SDK_VERSION)
PLATFORM_ABI_DUMP_DIR := prebuilts/abi-dumps/platform/$(PLATFORM_SDK_VERSION)
@@ -149,20 +184,21 @@
$(check-vndk-abi-dump-list-timestamp): PRIVATE_STUB_LIBRARIES := $(STUB_LIBRARIES)
$(check-vndk-abi-dump-list-timestamp):
$(eval added_vndk_abi_dumps := $(strip $(sort $(filter-out \
- $(call filter-abi-dump-paths,VNDK-SP VNDK-core,$(PRIVATE_LSDUMP_PATHS)), \
+ $(call filter-abi-dump-names,LLNDK VNDK-SP VNDK-core,$(PRIVATE_LSDUMP_PATHS)), \
$(notdir $(VNDK_ABI_DUMPS))))))
$(if $(added_vndk_abi_dumps), \
echo -e "Found unexpected ABI reference dump files under $(VNDK_ABI_DUMP_DIR). It is caused by mismatch between Android.bp and the dump files. Run \`find \$${ANDROID_BUILD_TOP}/$(VNDK_ABI_DUMP_DIR) '(' -name $(subst $(space), -or -name ,$(added_vndk_abi_dumps)) ')' -delete\` to delete the dump files.")
$(eval added_ndk_abi_dumps := $(strip $(sort $(filter-out \
- $(call filter-abi-dump-paths,NDK,$(PRIVATE_LSDUMP_PATHS)) \
+ $(call filter-abi-dump-names,NDK,$(PRIVATE_LSDUMP_PATHS)) \
$(addsuffix .lsdump,$(PRIVATE_STUB_LIBRARIES)), \
$(notdir $(NDK_ABI_DUMPS))))))
$(if $(added_ndk_abi_dumps), \
echo -e "Found unexpected ABI reference dump files under $(NDK_ABI_DUMP_DIR). It is caused by mismatch between Android.bp and the dump files. Run \`find \$${ANDROID_BUILD_TOP}/$(NDK_ABI_DUMP_DIR) '(' -name $(subst $(space), -or -name ,$(added_ndk_abi_dumps)) ')' -delete\` to delete the dump files.")
+ # TODO(b/314010764): Remove LLNDK tag after PLATFORM_SDK_VERSION is upgraded to 35.
$(eval added_platform_abi_dumps := $(strip $(sort $(filter-out \
- $(call filter-abi-dump-paths,LLNDK PLATFORM,$(PRIVATE_LSDUMP_PATHS)) \
+ $(call filter-abi-dump-names,LLNDK PLATFORM,$(PRIVATE_LSDUMP_PATHS)) \
$(addsuffix .lsdump,$(PRIVATE_STUB_LIBRARIES)), \
$(notdir $(PLATFORM_ABI_DUMPS))))))
$(if $(added_platform_abi_dumps), \
diff --git a/tools/aconfig/Cargo.toml b/tools/aconfig/Cargo.toml
index 970fdcf..95f1215 100644
--- a/tools/aconfig/Cargo.toml
+++ b/tools/aconfig/Cargo.toml
@@ -4,6 +4,7 @@
"aconfig",
"aconfig_protos",
"aconfig_storage_file",
+ "aflags",
"printflags"
]
diff --git a/tools/aconfig/TEST_MAPPING b/tools/aconfig/TEST_MAPPING
index 398da06..e42b5d3 100644
--- a/tools/aconfig/TEST_MAPPING
+++ b/tools/aconfig/TEST_MAPPING
@@ -65,5 +65,20 @@
// that using the flag macros to do filtering will get affected.
"name": "FlagMacrosTests"
}
+ ],
+ "postsubmit": [
+ {
+ // aconfig_storage read api rust integration tests
+ "name": "aconfig_storage.test.rust"
+ },
+ {
+ // aconfig_storage read api cpp integration tests
+ "name": "aconfig_storage.test.cpp"
+ },
+ {
+ // aflags CLI unit tests
+ // TODO(b/326062088): add to presubmit once proven in postsubmit.
+ "name": "aflags.test"
+ }
]
}
diff --git a/tools/aconfig/aflags/Android.bp b/tools/aconfig/aflags/Android.bp
new file mode 100644
index 0000000..c65da97
--- /dev/null
+++ b/tools/aconfig/aflags/Android.bp
@@ -0,0 +1,29 @@
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+rust_defaults {
+ name: "aflags.defaults",
+ edition: "2021",
+ clippy_lints: "android",
+ lints: "android",
+ srcs: ["src/main.rs"],
+ rustlibs: [
+ "libaconfig_protos",
+ "libanyhow",
+ "libclap",
+ "libprotobuf",
+ "libregex",
+ ],
+}
+
+rust_binary {
+ name: "aflags",
+ defaults: ["aflags.defaults"],
+}
+
+rust_test_host {
+ name: "aflags.test",
+ defaults: ["aflags.defaults"],
+ test_suites: ["general-tests"],
+}
diff --git a/tools/aconfig/aflags/Cargo.toml b/tools/aconfig/aflags/Cargo.toml
new file mode 100644
index 0000000..3350a6cd
--- /dev/null
+++ b/tools/aconfig/aflags/Cargo.toml
@@ -0,0 +1,12 @@
+[package]
+name = "aflags"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
+anyhow = "1.0.69"
+paste = "1.0.11"
+clap = { version = "4", features = ["derive"] }
+protobuf = "3.2.0"
+regex = "1.10.3"
+aconfig_protos = { path = "../aconfig_protos" }
diff --git a/tools/aconfig/aflags/src/device_config_source.rs b/tools/aconfig/aflags/src/device_config_source.rs
new file mode 100644
index 0000000..12a62cf
--- /dev/null
+++ b/tools/aconfig/aflags/src/device_config_source.rs
@@ -0,0 +1,171 @@
+/*
+ * Copyright (C) 2024 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.
+ */
+
+use crate::{Flag, FlagPermission, FlagSource, ValuePickedFrom};
+use aconfig_protos::ProtoFlagPermission as ProtoPermission;
+use aconfig_protos::ProtoFlagState as ProtoState;
+use aconfig_protos::ProtoParsedFlag;
+use aconfig_protos::ProtoParsedFlags;
+use anyhow::{anyhow, bail, Result};
+use regex::Regex;
+use std::collections::BTreeMap;
+use std::collections::HashMap;
+use std::process::Command;
+use std::{fs, str};
+
+pub struct DeviceConfigSource {}
+
+fn convert_parsed_flag(flag: &ProtoParsedFlag) -> Flag {
+ let namespace = flag.namespace().to_string();
+ let package = flag.package().to_string();
+ let name = flag.name().to_string();
+
+ let container = if flag.container().is_empty() {
+ "system".to_string()
+ } else {
+ flag.container().to_string()
+ };
+
+ let value = match flag.state() {
+ ProtoState::ENABLED => "true",
+ ProtoState::DISABLED => "false",
+ }
+ .to_string();
+
+ let permission = match flag.permission() {
+ ProtoPermission::READ_ONLY => FlagPermission::ReadOnly,
+ ProtoPermission::READ_WRITE => FlagPermission::ReadWrite,
+ };
+
+ Flag {
+ namespace,
+ package,
+ name,
+ container,
+ value,
+ permission,
+ value_picked_from: ValuePickedFrom::Default,
+ }
+}
+
+fn read_pb_files() -> Result<Vec<Flag>> {
+ let mut flags: BTreeMap<String, Flag> = BTreeMap::new();
+ for partition in ["system", "system_ext", "product", "vendor"] {
+ let path = format!("/{}/etc/aconfig_flags.pb", partition);
+ let Ok(bytes) = fs::read(&path) else {
+ eprintln!("warning: failed to read {}", path);
+ continue;
+ };
+ let parsed_flags: ProtoParsedFlags = protobuf::Message::parse_from_bytes(&bytes)?;
+ for flag in parsed_flags.parsed_flag {
+ let key = format!("{}.{}", flag.package(), flag.name());
+ let container = if flag.container().is_empty() {
+ "system".to_string()
+ } else {
+ flag.container().to_string()
+ };
+
+ if container.eq(partition) {
+ flags.insert(key, convert_parsed_flag(&flag));
+ }
+ }
+ }
+ Ok(flags.values().cloned().collect())
+}
+
+fn parse_device_config(raw: &str) -> Result<HashMap<String, String>> {
+ let mut flags = HashMap::new();
+ let regex = Regex::new(r"(?m)^([[[:alnum:]]_]+/[[[:alnum:]]_\.]+)=(true|false)$")?;
+ for capture in regex.captures_iter(raw) {
+ let key =
+ capture.get(1).ok_or(anyhow!("invalid device_config output"))?.as_str().to_string();
+ let value = capture.get(2).ok_or(anyhow!("invalid device_config output"))?.as_str();
+ flags.insert(key, value.to_string());
+ }
+ Ok(flags)
+}
+
+fn read_device_config_output(command: &str) -> Result<String> {
+ let output = Command::new("/system/bin/device_config").arg(command).output()?;
+ if !output.status.success() {
+ let reason = match output.status.code() {
+ Some(code) => format!("exit code {}", code),
+ None => "terminated by signal".to_string(),
+ };
+ bail!("failed to execute device_config: {}", reason);
+ }
+ Ok(str::from_utf8(&output.stdout)?.to_string())
+}
+
+fn read_device_config_flags() -> Result<HashMap<String, String>> {
+ let list_output = read_device_config_output("list")?;
+ parse_device_config(&list_output)
+}
+
+fn reconcile(pb_flags: &[Flag], dc_flags: HashMap<String, String>) -> Vec<Flag> {
+ pb_flags
+ .iter()
+ .map(|f| {
+ dc_flags
+ .get(&format!("{}/{}.{}", f.namespace, f.package, f.name))
+ .map(|value| {
+ if value.eq(&f.value) {
+ Flag { value_picked_from: ValuePickedFrom::Default, ..f.clone() }
+ } else {
+ Flag {
+ value_picked_from: ValuePickedFrom::Server,
+ value: value.to_string(),
+ ..f.clone()
+ }
+ }
+ })
+ .unwrap_or(f.clone())
+ })
+ .collect()
+}
+
+impl FlagSource for DeviceConfigSource {
+ fn list_flags() -> Result<Vec<Flag>> {
+ let pb_flags = read_pb_files()?;
+ let dc_flags = read_device_config_flags()?;
+
+ let flags = reconcile(&pb_flags, dc_flags);
+ Ok(flags)
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn test_parse_device_config() {
+ let input = r#"
+namespace_one/com.foo.bar.flag_one=true
+namespace_one/com.foo.bar.flag_two=false
+random_noise;
+namespace_two/android.flag_one=true
+namespace_two/android.flag_two=nonsense
+"#;
+ let expected = HashMap::from([
+ ("namespace_one/com.foo.bar.flag_one".to_string(), "true".to_string()),
+ ("namespace_one/com.foo.bar.flag_two".to_string(), "false".to_string()),
+ ("namespace_two/android.flag_one".to_string(), "true".to_string()),
+ ]);
+ let actual = parse_device_config(input).unwrap();
+ assert_eq!(expected, actual);
+ }
+}
diff --git a/tools/aconfig/aflags/src/main.rs b/tools/aconfig/aflags/src/main.rs
new file mode 100644
index 0000000..1e2a7a0
--- /dev/null
+++ b/tools/aconfig/aflags/src/main.rs
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2024 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.
+ */
+
+//! `aflags` is a device binary to read and write aconfig flags.
+
+use anyhow::Result;
+use clap::Parser;
+
+mod device_config_source;
+use device_config_source::DeviceConfigSource;
+
+#[derive(Clone)]
+enum FlagPermission {
+ ReadOnly,
+ ReadWrite,
+}
+
+impl ToString for FlagPermission {
+ fn to_string(&self) -> String {
+ match &self {
+ Self::ReadOnly => "read-only".into(),
+ Self::ReadWrite => "read-write".into(),
+ }
+ }
+}
+
+#[derive(Clone)]
+enum ValuePickedFrom {
+ Default,
+ Server,
+}
+
+impl ToString for ValuePickedFrom {
+ fn to_string(&self) -> String {
+ match &self {
+ Self::Default => "default".into(),
+ Self::Server => "server".into(),
+ }
+ }
+}
+
+#[derive(Clone)]
+struct Flag {
+ namespace: String,
+ name: String,
+ package: String,
+ container: String,
+ value: String,
+ permission: FlagPermission,
+ value_picked_from: ValuePickedFrom,
+}
+
+trait FlagSource {
+ fn list_flags() -> Result<Vec<Flag>>;
+}
+
+const ABOUT_TEXT: &str = "Tool for reading and writing flags.
+
+Rows in the table from the `list` command follow this format:
+
+ package flag_name value provenance permission container
+
+ * `package`: package set for this flag in its .aconfig definition.
+ * `flag_name`: flag name, also set in definition.
+ * `value`: the value read from the flag.
+ * `provenance`: one of:
+ + `default`: the flag value comes from its build-time default.
+ + `server`: the flag value comes from a server override.
+ * `permission`: read-write or read-only.
+ * `container`: the container for the flag, configured in its definition.
+";
+
+#[derive(Parser, Debug)]
+#[clap(long_about=ABOUT_TEXT)]
+struct Cli {
+ #[clap(subcommand)]
+ command: Command,
+}
+
+#[derive(Parser, Debug)]
+enum Command {
+ /// List all aconfig flags on this device.
+ List,
+}
+
+struct PaddingInfo {
+ longest_package_col: usize,
+ longest_name_col: usize,
+ longest_val_col: usize,
+ longest_value_picked_from_col: usize,
+ longest_permission_col: usize,
+}
+
+fn format_flag_row(flag: &Flag, info: &PaddingInfo) -> String {
+ let pkg = &flag.package;
+ let p0 = info.longest_package_col + 1;
+
+ let name = &flag.name;
+ let p1 = info.longest_name_col + 1;
+
+ let val = flag.value.to_string();
+ let p2 = info.longest_val_col + 1;
+
+ let value_picked_from = flag.value_picked_from.to_string();
+ let p3 = info.longest_value_picked_from_col + 1;
+
+ let perm = flag.permission.to_string();
+ let p4 = info.longest_permission_col + 1;
+
+ let container = &flag.container;
+
+ format!("{pkg:p0$}{name:p1$}{val:p2$}{value_picked_from:p3$}{perm:p4$}{container}\n")
+}
+
+fn list() -> Result<String> {
+ let flags = DeviceConfigSource::list_flags()?;
+ let padding_info = PaddingInfo {
+ longest_package_col: flags.iter().map(|f| f.package.len()).max().unwrap_or(0),
+ longest_name_col: flags.iter().map(|f| f.name.len()).max().unwrap_or(0),
+ longest_val_col: flags.iter().map(|f| f.value.to_string().len()).max().unwrap_or(0),
+ longest_value_picked_from_col: flags
+ .iter()
+ .map(|f| f.value_picked_from.to_string().len())
+ .max()
+ .unwrap_or(0),
+ longest_permission_col: flags
+ .iter()
+ .map(|f| f.permission.to_string().len())
+ .max()
+ .unwrap_or(0),
+ };
+
+ let mut result = String::from("");
+ for flag in flags {
+ let row = format_flag_row(&flag, &padding_info);
+ result.push_str(&row);
+ }
+ Ok(result)
+}
+
+fn main() {
+ let cli = Cli::parse();
+ let output = match cli.command {
+ Command::List => list(),
+ };
+ match output {
+ Ok(text) => println!("{text}"),
+ Err(msg) => println!("Error: {}", msg),
+ }
+}
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index e521e1f..dbbbca2 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -261,7 +261,7 @@
Specify the VABC cow version to be used
--compression_factor
- Specify the maximum block size to be compressed at once during OTA. supported options: 4k, 8k, 16k, 32k, 64k, 128k
+ Specify the maximum block size to be compressed at once during OTA. supported options: 4k, 8k, 16k, 32k, 64k, 128k, 256k
"""
from __future__ import print_function
@@ -603,7 +603,7 @@
This function modifies ab_partitions list with the desired partitions before
calling the brillo_update_payload script. It also cleans up the reference to
- the excluded partitions in the info file, e.g misc_info.txt.
+ the excluded partitions in the info file, e.g. misc_info.txt.
Args:
input_file: The input target-files.zip filename.
@@ -1276,11 +1276,11 @@
raise ValueError("Cannot parse value %r for option %r - only "
"integers are allowed." % (a, o))
elif o in ("--compression_factor"):
- values = ["4k", "8k", "16k", "32k", "64k", "128k"]
+ values = ["4k", "8k", "16k", "32k", "64k", "128k", "256k"]
if a[:-1].isdigit() and a in values and a.endswith("k"):
OPTIONS.compression_factor = str(int(a[:-1]) * 1024)
else:
- raise ValueError("Please specify value from following options: 4k, 8k, 16k, 32k, 64k, 128k")
+ raise ValueError("Please specify value from following options: 4k, 8k, 16k, 32k, 64k, 128k", "256k")
elif o == "--vabc_cow_version":
if a.isdigit():