Merge "Add custom images in fastboot-info" 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 50aa11d..0215fda 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -2727,6 +2727,8 @@
$(if $(strip $(recovery_wipe)), \
cp -f $(recovery_wipe) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.wipe)
ln -sf prop.default $(TARGET_RECOVERY_ROOT_OUT)/default.prop
+ # Silence warnings in first_stage_console.
+ touch $(TARGET_RECOVERY_ROOT_OUT)/linkerconfig/ld.config.txt
$(BOARD_RECOVERY_IMAGE_PREPARE)
$(hide) touch $@
@@ -3395,6 +3397,14 @@
FULL_SYSTEMIMAGE_DEPS += $(INTERNAL_ROOT_FILES) $(INSTALLED_FILES_FILE_ROOT)
+define write-file-lines
+$(1):
+ @echo Writing $$@
+ rm -f $$@
+ echo -n > $$@
+ $$(foreach f,$(2),echo "$$(f)" >> $$@$$(newline))
+endef
+
# -----------------------------------------------------------------
ifdef BUILDING_SYSTEM_IMAGE
@@ -3448,14 +3458,6 @@
$(systemimage_intermediates)/staging_dir.stamp: $(FULL_SYSTEMIMAGE_DEPS)
touch $@
-define write-file-lines
-$(1):
- @echo Writing $$@
- rm -f $$@
- echo -n > $$@
- $$(foreach f,$(2),echo "$$(f)" >> $$@$$(newline))
-endef
-
# $(1): output file
define build-systemimage-target
@echo "Target system fs image: $(1)"
@@ -5109,8 +5111,11 @@
$(error EMPTY_VENDOR_SKU_PLACEHOLDER is an internal variable and cannot be used for DEIVCE_MANIFEST_SKUS)
endif
-# -- Check system manifest / matrix including fragments (excluding other framework manifests / matrices, e.g. product);
-check_vintf_system_deps := $(filter $(TARGET_OUT)/etc/vintf/%, $(check_vintf_common_srcs))
+# -- Check system and system_ext manifests / matrices including fragments (excluding other framework manifests / matrices, e.g. product);
+ifdef BUILDING_SYSTEM_IMAGE
+check_vintf_system_deps := $(filter $(TARGET_OUT)/etc/vintf/% \
+ $(TARGET_OUT_SYSTEM_EXT)/etc/vintf/%, \
+ $(check_vintf_common_srcs))
ifneq ($(check_vintf_system_deps),)
check_vintf_has_system := true
@@ -5137,9 +5142,12 @@
endif # check_vintf_system_deps
check_vintf_system_deps :=
+endif # BUILDING_SYSTEM_IMAGE
+
# -- 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_manifest.mk b/core/android_manifest.mk
index ff49262..7f46903 100644
--- a/core/android_manifest.mk
+++ b/core/android_manifest.mk
@@ -51,6 +51,9 @@
my_target_sdk_version := $(my_target_sdk_version).$$(cat $(API_FINGERPRINT))
my_min_sdk_version := $(my_min_sdk_version).$$(cat $(API_FINGERPRINT))
$(fixed_android_manifest): $(API_FINGERPRINT)
+ else ifdef UNBUNDLED_BUILD_TARGET_SDK_WITH_DESSERT_SHA
+ my_target_sdk_version := $(UNBUNDLED_BUILD_TARGET_SDK_WITH_DESSERT_SHA)
+ my_min_sdk_version := $(UNBUNDLED_BUILD_TARGET_SDK_WITH_DESSERT_SHA)
endif
endif
endif
diff --git a/core/android_soong_config_vars.mk b/core/android_soong_config_vars.mk
index 18d955c..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))
@@ -164,6 +160,7 @@
$(call add_soong_config_var_value,ANDROID,release_avf_enable_remote_attestation,$(RELEASE_AVF_ENABLE_REMOTE_ATTESTATION))
$(call add_soong_config_var_value,ANDROID,release_avf_enable_vendor_modules,$(RELEASE_AVF_ENABLE_VENDOR_MODULES))
$(call add_soong_config_var_value,ANDROID,release_avf_enable_virt_cpufreq,$(RELEASE_AVF_ENABLE_VIRT_CPUFREQ))
+$(call add_soong_config_var_value,ANDROID,release_avf_microdroid_kernel_version,$(RELEASE_AVF_MICRODROID_KERNEL_VERSION))
$(call add_soong_config_var_value,ANDROID,release_binder_death_recipient_weak_from_jni,$(RELEASE_BINDER_DEATH_RECIPIENT_WEAK_FROM_JNI))
@@ -202,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/board_config.mk b/core/board_config.mk
index ac9a34f..8c23f93 100644
--- a/core/board_config.mk
+++ b/core/board_config.mk
@@ -965,12 +965,15 @@
$(if $(wildcard $(vndk_path)/*/Android.bp),,$(error VNDK version $(1) not found))
endef
+ifeq ($(KEEP_VNDK),true)
ifeq ($(BOARD_VNDK_VERSION),$(PLATFORM_VNDK_VERSION))
$(error BOARD_VNDK_VERSION is equal to PLATFORM_VNDK_VERSION; use BOARD_VNDK_VERSION := current)
endif
ifneq ($(BOARD_VNDK_VERSION),current)
$(call check_vndk_version,$(BOARD_VNDK_VERSION))
endif
+endif
+
TARGET_VENDOR_TEST_SUFFIX := /vendor
ifeq (,$(TARGET_BUILD_UNBUNDLED))
diff --git a/core/config.mk b/core/config.mk
index fc11405..dbee0a0 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -374,16 +374,6 @@
endif
-include $(ANDROID_BUILDSPEC)
-# Starting in Android U, non-VNDK devices not supported
-# WARNING: DO NOT CHANGE: if you are downstream of AOSP, and you change this, without
-# letting upstream know it's important to you, we may do cleanup which breaks this
-# significantly. Please let us know if you are changing this.
-ifndef BOARD_VNDK_VERSION
-# READ WARNING - DO NOT CHANGE
-BOARD_VNDK_VERSION := current
-# READ WARNING - DO NOT CHANGE
-endif
-
# ---------------------------------------------------------------
# Define most of the global variables. These are the ones that
# are specific to the user's build configuration.
@@ -813,13 +803,6 @@
requirements :=
-# Set default value of KEEP_VNDK.
-ifeq ($(RELEASE_DEPRECATE_VNDK),true)
- KEEP_VNDK ?= false
-else
- KEEP_VNDK ?= true
-endif
-
# BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED can be true only if early-mount of
# partitions is supported. But the early-mount must be supported for full
# treble products, and so BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED should be set
@@ -888,21 +871,9 @@
# SEPolicy versions
-# PLATFORM_SEPOLICY_VERSION is a number of the form "YYYYMM.0" with "YYYYMM"
-# mapping to vFRC version. This value will be set to 1000000.0 to represent
-# tip-of-tree development that is inherently unstable and thus designed not to
-# work with any shipping vendor policy. This is similar in spirit to how
-# DEFAULT_APP_TARGET_SDK is set.
-sepolicy_vers := $(BOARD_API_LEVEL).0
-
-TOT_SEPOLICY_VERSION := 1000000.0
-ifeq (true,$(RELEASE_BOARD_API_LEVEL_FROZEN))
- PLATFORM_SEPOLICY_VERSION := $(sepolicy_vers)
-else
- PLATFORM_SEPOLICY_VERSION := $(TOT_SEPOLICY_VERSION)
-endif
-sepolicy_vers :=
-
+# PLATFORM_SEPOLICY_VERSION is a number of the form "YYYYMM" with "YYYYMM"
+# mapping to vFRC version.
+PLATFORM_SEPOLICY_VERSION := $(BOARD_API_LEVEL)
BOARD_SEPOLICY_VERS := $(PLATFORM_SEPOLICY_VERSION)
.KATI_READONLY := PLATFORM_SEPOLICY_VERSION BOARD_SEPOLICY_VERS
@@ -919,7 +890,6 @@
.KATI_READONLY := \
PLATFORM_SEPOLICY_COMPAT_VERSIONS \
PLATFORM_SEPOLICY_VERSION \
- TOT_SEPOLICY_VERSION \
ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
ifneq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true)
@@ -1293,6 +1263,15 @@
include $(BUILD_SYSTEM)/dumpvar.mk
+ifneq ($(KEEP_VNDK),true)
+ifdef BOARD_VNDK_VERSION
+BOARD_VNDK_VERSION=
+endif
+ifdef PLATFORM_VNDK_VERSION
+PLATFORM_VNDK_VERSION=
+endif
+endif
+
ifeq (true,$(FULL_SYSTEM_OPTIMIZE_JAVA))
ifeq (,$(SYSTEM_OPTIMIZE_JAVA))
$(error SYSTEM_OPTIMIZE_JAVA must be enabled when FULL_SYSTEM_OPTIMIZE_JAVA is enabled)
diff --git a/core/envsetup.mk b/core/envsetup.mk
index cfb8a66..30a6c06 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -50,6 +50,25 @@
# Release config
include $(BUILD_SYSTEM)/release_config.mk
+# Set default value of KEEP_VNDK.
+ifeq ($(RELEASE_DEPRECATE_VNDK),true)
+ KEEP_VNDK ?= false
+else
+ KEEP_VNDK ?= true
+endif
+
+ifeq ($(KEEP_VNDK),true)
+ # Starting in Android U, non-VNDK devices not supported
+ # WARNING: DO NOT CHANGE: if you are downstream of AOSP, and you change this, without
+ # letting upstream know it's important to you, we may do cleanup which breaks this
+ # significantly. Please let us know if you are changing this.
+ ifndef BOARD_VNDK_VERSION
+ # READ WARNING - DO NOT CHANGE
+ BOARD_VNDK_VERSION := current
+ # READ WARNING - DO NOT CHANGE
+ endif
+endif
+
# ---------------------------------------------------------------
# Set up version information
include $(BUILD_SYSTEM)/version_util.mk
diff --git a/core/main.mk b/core/main.mk
index f5dbad8..b4ca2a4 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -225,20 +225,14 @@
# ADDITIONAL_VENDOR_PROPERTIES will be installed in vendor/build.prop if
# property_overrides_split_enabled is true. Otherwise it will be installed in
# /system/build.prop
+ifeq ($(KEEP_VNDK),true)
ifdef BOARD_VNDK_VERSION
- ifeq ($(KEEP_VNDK),true)
ifeq ($(BOARD_VNDK_VERSION),current)
ADDITIONAL_VENDOR_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION)
else
ADDITIONAL_VENDOR_PROPERTIES := ro.vndk.version=$(BOARD_VNDK_VERSION)
endif
- endif
-
- # TODO(b/290159430): ro.vndk.deprecate is a temporal variable for deprecating VNDK.
- # This variable will be removed once ro.vndk.version can be removed.
- ifneq ($(KEEP_VNDK),true)
- ADDITIONAL_SYSTEM_PROPERTIES += ro.vndk.deprecate=true
- endif
+endif
endif
# Add cpu properties for bionic and ART.
@@ -440,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 ##
@@ -1676,6 +1672,7 @@
$(INSTALLED_SYSTEM_DLKMIMAGE_TARGET) \
$(INSTALLED_SUPERIMAGE_EMPTY_TARGET) \
$(INSTALLED_PRODUCTIMAGE_TARGET) \
+ $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \
$(INSTALLED_SYSTEMOTHERIMAGE_TARGET) \
$(INSTALLED_TEST_HARNESS_RAMDISK_TARGET) \
$(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET) \
@@ -2000,17 +1997,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/product.mk b/core/product.mk
index 2d22ebf..60cab47 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -454,6 +454,12 @@
_product_single_value_vars += PRODUCT_BUILD_FROM_SOURCE_STUB
+_product_list_vars += PRODUCT_BUILD_IGNORE_APEX_CONTRIBUTION_CONTENTS
+
+_product_single_value_vars += PRODUCT_HIDDEN_API_EXPORTABLE_STUBS
+
+_product_single_value_vars += PRODUCT_EXPORT_RUNTIME_APIS
+
.KATI_READONLY := _product_single_value_vars _product_list_vars
_product_var_list :=$= $(_product_single_value_vars) $(_product_list_vars)
diff --git a/core/proguard.flags b/core/proguard.flags
index 9cbba0f..aa406b9 100644
--- a/core/proguard.flags
+++ b/core/proguard.flags
@@ -15,6 +15,13 @@
@com.android.internal.annotations.VisibleForTesting *;
}
+# Keep classes and members with platform @TestApi annotations, similar to
+# @VisibleForTesting.
+-keep @android.annotation.TestApi class *
+-keepclassmembers class * {
+ @android.annotation.TestApi *;
+}
+
# Keep classes and members with non-platform @VisibleForTesting annotations, but
# only within platform-defined packages. This avoids keeping external, library-specific
# test code that isn't actually needed for platform testing.
diff --git a/core/soong_config.mk b/core/soong_config.mk
index 7d03aa3..b43a952 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -147,8 +147,10 @@
$(call add_json_str, BtConfigIncludeDir, $(BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR))
$(call add_json_list, DeviceKernelHeaders, $(TARGET_DEVICE_KERNEL_HEADERS) $(TARGET_BOARD_KERNEL_HEADERS) $(TARGET_PRODUCT_KERNEL_HEADERS))
$(call add_json_str, VendorApiLevel, $(BOARD_API_LEVEL))
+ifeq ($(KEEP_VNDK),true)
$(call add_json_str, DeviceVndkVersion, $(BOARD_VNDK_VERSION))
$(call add_json_str, Platform_vndk_version, $(PLATFORM_VNDK_VERSION))
+endif
$(call add_json_list, ExtraVndkVersions, $(PRODUCT_EXTRA_VNDK_VERSIONS))
$(call add_json_list, DeviceSystemSdkVersions, $(BOARD_SYSTEMSDK_VERSIONS))
$(call add_json_str, RecoverySnapshotVersion, $(RECOVERY_SNAPSHOT_VERSION))
@@ -228,7 +230,6 @@
$(call add_json_str, ProductSepolicyPrebuiltApiDir, $(BOARD_PRODUCT_PREBUILT_DIR))
$(call add_json_str, PlatformSepolicyVersion, $(PLATFORM_SEPOLICY_VERSION))
-$(call add_json_str, TotSepolicyVersion, $(TOT_SEPOLICY_VERSION))
$(call add_json_list, PlatformSepolicyCompatVersions, $(PLATFORM_SEPOLICY_COMPAT_VERSIONS))
$(call add_json_bool, ForceApexSymlinkOptimization, $(filter true,$(TARGET_FORCE_APEX_SYMLINK_OPTIMIZATION)))
@@ -334,6 +335,8 @@
$(call add_json_bool, CheckVendorSeappViolations, $(filter true,$(CHECK_VENDOR_SEAPP_VIOLATIONS)))
+$(call add_json_list, BuildIgnoreApexContributionContents, $(sort $(PRODUCT_BUILD_IGNORE_APEX_CONTRIBUTION_CONTENTS)))
+
$(call add_json_map, PartitionVarsForBazelMigrationOnlyDoNotUse)
$(call add_json_str, ProductDirectory, $(dir $(INTERNAL_PRODUCT)))
@@ -397,6 +400,10 @@
$(call add_json_bool, BuildFromSourceStub, $(findstring true,$(PRODUCT_BUILD_FROM_SOURCE_STUB) $(BUILD_FROM_SOURCE_STUB)))
+$(call add_json_bool, HiddenapiExportableStubs, $(filter true,$(PRODUCT_HIDDEN_API_EXPORTABLE_STUBS)))
+
+$(call add_json_bool, ExportRuntimeApis, $(filter true,$(PRODUCT_EXPORT_RUNTIME_APIS)))
+
$(call json_end)
$(file >$(SOONG_VARIABLES).tmp,$(json_contents))
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 dfa0277..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
@@ -157,21 +151,23 @@
endif
.KATI_READONLY := DEFAULT_APP_TARGET_SDK
-ifndef PLATFORM_VNDK_VERSION
- # This is the definition of the VNDK version for the current VNDK libraries.
- # With trunk stable, VNDK will not be frozen but deprecated.
- # This version will be removed with the VNDK deprecation.
- ifeq (REL,$(PLATFORM_VERSION_CODENAME))
- ifdef RELEASE_PLATFORM_VNDK_VERSION
- PLATFORM_VNDK_VERSION := $(RELEASE_PLATFORM_VNDK_VERSION)
+ifeq ($(KEEP_VNDK),true)
+ ifndef PLATFORM_VNDK_VERSION
+ # This is the definition of the VNDK version for the current VNDK libraries.
+ # With trunk stable, VNDK will not be frozen but deprecated.
+ # This version will be removed with the VNDK deprecation.
+ ifeq (REL,$(PLATFORM_VERSION_CODENAME))
+ ifdef RELEASE_PLATFORM_VNDK_VERSION
+ PLATFORM_VNDK_VERSION := $(RELEASE_PLATFORM_VNDK_VERSION)
+ else
+ PLATFORM_VNDK_VERSION := $(PLATFORM_SDK_VERSION)
+ endif
else
- PLATFORM_VNDK_VERSION := $(PLATFORM_SDK_VERSION)
+ PLATFORM_VNDK_VERSION := $(PLATFORM_VERSION_CODENAME)
endif
- else
- PLATFORM_VNDK_VERSION := $(PLATFORM_VERSION_CODENAME)
endif
+ .KATI_READONLY := PLATFORM_VNDK_VERSION
endif
-.KATI_READONLY := PLATFORM_VNDK_VERSION
ifndef PLATFORM_SYSTEMSDK_MIN_VERSION
# This is the oldest version of system SDK that the platform supports. Contrary
diff --git a/envsetup.sh b/envsetup.sh
index 6111952..db21188 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -367,7 +367,7 @@
# And in with the new...
ANDROID_GLOBAL_BUILD_PATHS=$T/build/soong/bin
- ANDROID_GLOBAL_BUILD_PATHS+=:$T/bazel/bin
+ ANDROID_GLOBAL_BUILD_PATHS+=:$T/build/bazel/bin
ANDROID_GLOBAL_BUILD_PATHS+=:$T/development/scripts
ANDROID_GLOBAL_BUILD_PATHS+=:$T/prebuilts/devtools/tools
diff --git a/target/board/BoardConfigMainlineCommon.mk b/target/board/BoardConfigMainlineCommon.mk
index 01ebe56..c3878b8 100644
--- a/target/board/BoardConfigMainlineCommon.mk
+++ b/target/board/BoardConfigMainlineCommon.mk
@@ -21,8 +21,10 @@
# the devices with metadata parition
BOARD_USES_METADATA_PARTITION := true
+ifeq ($(KEEP_VNDK),true)
# Default is current, but allow devices to override vndk version if needed.
BOARD_VNDK_VERSION ?= current
+endif
# 64 bit mediadrmserver
TARGET_ENABLE_MEDIADRM_64 := true
diff --git a/target/product/AndroidProducts.mk b/target/product/AndroidProducts.mk
index 76b1c58..07eb96d 100644
--- a/target/product/AndroidProducts.mk
+++ b/target/product/AndroidProducts.mk
@@ -67,6 +67,7 @@
$(LOCAL_DIR)/mainline_system_x86_arm.mk \
$(LOCAL_DIR)/ndk.mk \
$(LOCAL_DIR)/sdk.mk \
+ $(LOCAL_DIR)/sdk_with_runtime_apis.mk \
endif
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index 277223e..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 \
@@ -223,6 +224,7 @@
mke2fs \
mkfs.erofs \
monkey \
+ misctrl \
mtectrl \
ndc \
netd \
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/fullmte.mk b/target/product/fullmte.mk
index 5e2a694..b622496 100644
--- a/target/product/fullmte.mk
+++ b/target/product/fullmte.mk
@@ -20,8 +20,7 @@
# For more details, see:
# https://source.android.com/docs/security/test/memory-safety/arm-mte
ifeq ($(filter memtag_heap,$(SANITIZE_TARGET)),)
- # TODO(b/292478827): Re-enable memtag_stack when new toolchain rolls.
- SANITIZE_TARGET := $(strip $(SANITIZE_TARGET) memtag_heap)
+ SANITIZE_TARGET := $(strip $(SANITIZE_TARGET) memtag_heap memtag_stack)
SANITIZE_TARGET_DIAG := $(strip $(SANITIZE_TARGET_DIAG) memtag_heap)
endif
PRODUCT_PRODUCT_PROPERTIES += persist.arm64.memtag.default=sync
diff --git a/target/product/go_defaults_common.mk b/target/product/go_defaults_common.mk
index ba0912c..5218f29 100644
--- a/target/product/go_defaults_common.mk
+++ b/target/product/go_defaults_common.mk
@@ -49,6 +49,3 @@
# use the go specific handheld_core_hardware.xml from frameworks
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/go_handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml
-
-# Dedupe VNDK libraries with identical core variants.
-TARGET_VNDK_USE_CORE_VARIANT := true
diff --git a/target/product/gsi/Android.mk b/target/product/gsi/Android.mk
index 007aabd..f348fbb 100644
--- a/target/product/gsi/Android.mk
+++ b/target/product/gsi/Android.mk
@@ -7,6 +7,7 @@
#####################################################################
# This is the up-to-date list of vndk libs.
LATEST_VNDK_LIB_LIST := $(LOCAL_PATH)/current.txt
+ifeq ($(KEEP_VNDK),true)
UNFROZEN_VNDK := true
ifeq (REL,$(PLATFORM_VERSION_CODENAME))
# Use frozen vndk lib list only if "34 >= PLATFORM_VNDK_VERSION"
@@ -18,6 +19,7 @@
UNFROZEN_VNDK :=
endif
endif
+endif
#####################################################################
# Check the generate list against the latest list stored in the
@@ -35,6 +37,8 @@
check-vndk-list: ;
else ifeq ($(TARGET_SKIP_CURRENT_VNDK),true)
check-vndk-list: ;
+else ifeq ($(BOARD_VNDK_VERSION),)
+check-vndk-list: ;
else
check-vndk-list: $(check-vndk-list-timestamp)
ifneq ($(SKIP_ABI_CHECKS),true)
@@ -105,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.
@@ -119,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)
@@ -145,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), \
@@ -199,25 +239,14 @@
include $(BUILD_PHONY_PACKAGE)
include $(CLEAR_VARS)
-_vndk_versions :=
-ifeq ($(filter com.android.vndk.current.on_vendor, $(PRODUCT_PACKAGES)),)
- _vndk_versions += $(if $(call math_is_number,$(PLATFORM_VNDK_VERSION)),\
- $(foreach vndk_ver,$(PRODUCT_EXTRA_VNDK_VERSIONS),\
- $(if $(call math_lt,$(vndk_ver),$(PLATFORM_VNDK_VERSION)),$(vndk_ver))),\
- $(PRODUCT_EXTRA_VNDK_VERSIONS))
-endif
-ifneq ($(BOARD_VNDK_VERSION),current)
- _vndk_versions += $(BOARD_VNDK_VERSION)
-endif
+
LOCAL_MODULE := vndk_apex_snapshot_package
LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
LOCAL_LICENSE_CONDITIONS := notice
LOCAL_NOTICE_FILE := build/soong/licenses/LICENSE
-LOCAL_REQUIRED_MODULES := $(foreach vndk_ver,$(_vndk_versions),com.android.vndk.v$(vndk_ver))
+LOCAL_REQUIRED_MODULES := $(foreach vndk_ver,$(PRODUCT_EXTRA_VNDK_VERSIONS),com.android.vndk.v$(vndk_ver))
include $(BUILD_PHONY_PACKAGE)
-_vndk_versions :=
-
#####################################################################
# Define Phony module to install LLNDK modules which are installed in
# the system image
diff --git a/target/product/sdk_with_runtime_apis.mk b/target/product/sdk_with_runtime_apis.mk
new file mode 100644
index 0000000..e80b4fb
--- /dev/null
+++ b/target/product/sdk_with_runtime_apis.mk
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+
+$(call inherit-product, $(SRC_TARGET_DIR)/product/sdk.mk)
+
+PRODUCT_NAME := sdk_with_runtime_apis
+
+PRODUCT_HIDDEN_API_EXPORTABLE_STUBS := true
+PRODUCT_EXPORT_RUNTIME_APIS := true
\ No newline at end of file
diff --git a/teams/Android.bp b/teams/Android.bp
index 89c719f..bae8e80 100644
--- a/teams/Android.bp
+++ b/teams/Android.bp
@@ -4335,3 +4335,32 @@
// go/trendy/manage/engineers/5093014696525824
trendy_team_id: "5093014696525824",
}
+
+team {
+ name: "trendy_team_media_framework_drm",
+
+ // go/trendy/manage/engineers/5311752690335744
+ trendy_team_id: "5311752690335744",
+}
+
+team {
+ name: "trendy_team_media_framework_audio",
+
+ // go/trendy/manage/engineers/5823575353065472
+ trendy_team_id: "5823575353065472",
+}
+
+team {
+ name: "trendy_team_ar_sensors_context_hub",
+
+ // go/trendy/manage/engineers/4776371090259968
+ trendy_team_id: "4776371090259968",
+}
+
+
+team {
+ name: "trendy_team_media_codec_framework",
+
+ // go/trendy/manage/engineers/4943966050844672
+ trendy_team_id: "4943966050844672",
+}
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/aconfig/src/test.rs b/tools/aconfig/aconfig/src/test.rs
index 7b5318d..7409cda 100644
--- a/tools/aconfig/aconfig/src/test.rs
+++ b/tools/aconfig/aconfig/src/test.rs
@@ -15,6 +15,9 @@
*/
#[cfg(test)]
+pub use test_utils::*;
+
+#[cfg(test)]
pub mod test_utils {
use crate::commands::Input;
use aconfig_protos::ProtoParsedFlags;
@@ -340,6 +343,3 @@
);
}
}
-
-#[cfg(test)]
-pub use test_utils::*;
diff --git a/tools/aconfig/aconfig_storage_file/Android.bp b/tools/aconfig/aconfig_storage_file/Android.bp
index ff284e6..8922ba4 100644
--- a/tools/aconfig/aconfig_storage_file/Android.bp
+++ b/tools/aconfig/aconfig_storage_file/Android.bp
@@ -47,38 +47,14 @@
cmd: "rm -f $(out);cp -f $(in) $(out);chmod -w $(out)",
}
-genrule {
- name: "rw.package.map",
- out: ["tests/tmp.rw.package.map"],
- srcs: ["tests/package.map"],
- cmd: "rm -f $(out);cp -f $(in) $(out);chmod +w $(out)",
-}
-
-genrule {
- name: "rw.flag.map",
- out: ["tests/tmp.rw.flag.map"],
- srcs: ["tests/flag.map"],
- cmd: "rm -f $(out);cp -f $(in) $(out);chmod +w $(out)",
-}
-
-genrule {
- name: "rw.flag.val",
- out: ["tests/tmp.rw.flag.val"],
- srcs: ["tests/flag.val"],
- cmd: "rm -f $(out);cp -f $(in) $(out);chmod +w $(out)",
-}
-
rust_test_host {
name: "aconfig_storage_file.test",
test_suites: ["general-tests"],
defaults: ["aconfig_storage_file.defaults"],
data: [
- ":ro.package.map",
- ":ro.flag.map",
- ":ro.flag.val",
- ":rw.package.map",
- ":rw.flag.map",
- ":rw.flag.val",
+ "tests/package.map",
+ "tests/flag.map",
+ "tests/flag.val",
],
}
diff --git a/tools/aconfig/aconfig_storage_file/src/lib.rs b/tools/aconfig/aconfig_storage_file/src/lib.rs
index c238f24..84e0e90 100644
--- a/tools/aconfig/aconfig_storage_file/src/lib.rs
+++ b/tools/aconfig/aconfig_storage_file/src/lib.rs
@@ -438,32 +438,38 @@
#[cfg(test)]
mod tests {
use super::*;
- use crate::test_utils::{
- create_temp_storage_files_for_test, get_binary_storage_proto_bytes,
- set_temp_storage_files_to_read_only, write_bytes_to_temp_file,
- };
+ use crate::test_utils::{write_storage_text_to_temp_file, TestStorageFileSet};
+
+ fn create_test_storage_files(read_only: bool) -> TestStorageFileSet {
+ TestStorageFileSet::new(
+ "./tests/package.map",
+ "./tests/flag.map",
+ "./tests/flag.val",
+ read_only,
+ )
+ .unwrap()
+ }
#[test]
// this test point locks down flag package offset query
fn test_package_offset_query() {
- #[cfg(feature = "cargo")]
- create_temp_storage_files_for_test();
-
- set_temp_storage_files_to_read_only();
- let text_proto = r#"
-files {
+ let ro_files = create_test_storage_files(true);
+ let text_proto = format!(
+ r#"
+files {{
version: 0
container: "system"
- package_map: "./tests/tmp.ro.package.map"
- flag_map: "./tests/tmp.ro.flag.map"
- flag_val: "./tests/tmp.ro.flag.val"
+ package_map: "{}"
+ flag_map: "{}"
+ flag_val: "{}"
timestamp: 12345
-}
-"#;
- let binary_proto_bytes = get_binary_storage_proto_bytes(text_proto).unwrap();
- let file = write_bytes_to_temp_file(&binary_proto_bytes).unwrap();
- let file_full_path = file.path().display().to_string();
+}}
+"#,
+ ro_files.package_map.name, ro_files.flag_map.name, ro_files.flag_val.name
+ );
+ let file = write_storage_text_to_temp_file(&text_proto).unwrap();
+ let file_full_path = file.path().display().to_string();
let package_offset = get_package_offset_impl(
&file_full_path,
"system",
@@ -498,24 +504,23 @@
#[test]
// this test point locks down flag offset query
fn test_flag_offset_query() {
- #[cfg(feature = "cargo")]
- create_temp_storage_files_for_test();
-
- set_temp_storage_files_to_read_only();
- let text_proto = r#"
-files {
+ let ro_files = create_test_storage_files(true);
+ let text_proto = format!(
+ r#"
+files {{
version: 0
container: "system"
- package_map: "./tests/tmp.ro.package.map"
- flag_map: "./tests/tmp.ro.flag.map"
- flag_val: "./tests/tmp.ro.flag.val"
+ package_map: "{}"
+ flag_map: "{}"
+ flag_val: "{}"
timestamp: 12345
-}
-"#;
- let binary_proto_bytes = get_binary_storage_proto_bytes(text_proto).unwrap();
- let file = write_bytes_to_temp_file(&binary_proto_bytes).unwrap();
- let file_full_path = file.path().display().to_string();
+}}
+"#,
+ ro_files.package_map.name, ro_files.flag_map.name, ro_files.flag_val.name
+ );
+ let file = write_storage_text_to_temp_file(&text_proto).unwrap();
+ let file_full_path = file.path().display().to_string();
let baseline = vec![
(0, "enabled_ro", 1u16),
(0, "enabled_rw", 2u16),
@@ -538,24 +543,23 @@
#[test]
// this test point locks down flag offset query
fn test_flag_value_query() {
- #[cfg(feature = "cargo")]
- create_temp_storage_files_for_test();
-
- set_temp_storage_files_to_read_only();
- let text_proto = r#"
-files {
+ let ro_files = create_test_storage_files(true);
+ let text_proto = format!(
+ r#"
+files {{
version: 0
container: "system"
- package_map: "./tests/tmp.ro.package.map"
- flag_map: "./tests/tmp.ro.flag.map"
- flag_val: "./tests/tmp.ro.flag.val"
+ package_map: "{}"
+ flag_map: "{}"
+ flag_val: "{}"
timestamp: 12345
-}
-"#;
- let binary_proto_bytes = get_binary_storage_proto_bytes(text_proto).unwrap();
- let file = write_bytes_to_temp_file(&binary_proto_bytes).unwrap();
- let file_full_path = file.path().display().to_string();
+}}
+"#,
+ ro_files.package_map.name, ro_files.flag_map.name, ro_files.flag_val.name
+ );
+ let file = write_storage_text_to_temp_file(&text_proto).unwrap();
+ let file_full_path = file.path().display().to_string();
let baseline: Vec<bool> = vec![false; 8];
for (offset, expected_value) in baseline.into_iter().enumerate() {
let flag_value =
diff --git a/tools/aconfig/aconfig_storage_file/src/mapped_file.rs b/tools/aconfig/aconfig_storage_file/src/mapped_file.rs
index 3929dbd..d8f2570 100644
--- a/tools/aconfig/aconfig_storage_file/src/mapped_file.rs
+++ b/tools/aconfig/aconfig_storage_file/src/mapped_file.rs
@@ -148,10 +148,7 @@
#[cfg(test)]
mod tests {
use super::*;
- use crate::test_utils::{
- create_temp_storage_files_for_test, get_binary_storage_proto_bytes,
- set_temp_storage_files_to_read_only, write_bytes_to_temp_file,
- };
+ use crate::test_utils::{write_storage_text_to_temp_file, TestStorageFileSet};
#[test]
fn test_find_storage_file_location() {
@@ -173,10 +170,8 @@
timestamp: 54321
}
"#;
- let binary_proto_bytes = get_binary_storage_proto_bytes(text_proto).unwrap();
- let file = write_bytes_to_temp_file(&binary_proto_bytes).unwrap();
+ let file = write_storage_text_to_temp_file(text_proto).unwrap();
let file_full_path = file.path().display().to_string();
-
let file_info = find_container_storage_location(&file_full_path, "system").unwrap();
assert_eq!(file_info.version(), 0);
assert_eq!(file_info.container(), "system");
@@ -213,100 +208,121 @@
assert_eq!(mmaped_file[..], content[..]);
}
- #[test]
- fn test_mapped_file_contents() {
- #[cfg(feature = "cargo")]
- create_temp_storage_files_for_test();
-
- set_temp_storage_files_to_read_only();
- let text_proto = r#"
-files {
- version: 0
- container: "system"
- package_map: "./tests/tmp.ro.package.map"
- flag_map: "./tests/tmp.ro.flag.map"
- flag_val: "./tests/tmp.ro.flag.val"
- timestamp: 12345
-}
-"#;
- let binary_proto_bytes = get_binary_storage_proto_bytes(text_proto).unwrap();
- let file = write_bytes_to_temp_file(&binary_proto_bytes).unwrap();
- let file_full_path = file.path().display().to_string();
-
- map_and_verify(
- &file_full_path,
- StorageFileSelection::PackageMap,
- "./tests/tmp.ro.package.map",
- );
- map_and_verify(&file_full_path, StorageFileSelection::FlagMap, "./tests/tmp.ro.flag.map");
- map_and_verify(&file_full_path, StorageFileSelection::FlagVal, "./tests/tmp.ro.flag.val");
+ fn create_test_storage_files(read_only: bool) -> TestStorageFileSet {
+ TestStorageFileSet::new(
+ "./tests/package.map",
+ "./tests/flag.map",
+ "./tests/flag.val",
+ read_only,
+ )
+ .unwrap()
}
#[test]
- #[cfg(feature = "cargo")]
+ fn test_mapped_file_contents() {
+ let ro_files = create_test_storage_files(true);
+ let text_proto = format!(
+ r#"
+files {{
+ version: 0
+ container: "system"
+ package_map: "{}"
+ flag_map: "{}"
+ flag_val: "{}"
+ timestamp: 12345
+}}
+"#,
+ ro_files.package_map.name, ro_files.flag_map.name, ro_files.flag_val.name
+ );
+
+ let file = write_storage_text_to_temp_file(&text_proto).unwrap();
+ let file_full_path = file.path().display().to_string();
+ map_and_verify(
+ &file_full_path,
+ StorageFileSelection::PackageMap,
+ &ro_files.package_map.name,
+ );
+ map_and_verify(&file_full_path, StorageFileSelection::FlagMap, &ro_files.flag_map.name);
+ map_and_verify(&file_full_path, StorageFileSelection::FlagVal, &ro_files.flag_val.name);
+ }
+
+ #[test]
fn test_map_non_read_only_file() {
- #[cfg(feature = "cargo")]
- create_temp_storage_files_for_test();
-
- set_temp_storage_files_to_read_only();
- let text_proto = r#"
-files {
+ let ro_files = create_test_storage_files(true);
+ let rw_files = create_test_storage_files(false);
+ let text_proto = format!(
+ r#"
+files {{
version: 0
container: "system"
- package_map: "./tests/tmp.rw.package.map"
- flag_map: "./tests/tmp.rw.flag.map"
- flag_val: "./tests/tmp.rw.flag.val"
+ package_map: "{}"
+ flag_map: "{}"
+ flag_val: "{}"
timestamp: 12345
-}
-"#;
- let binary_proto_bytes = get_binary_storage_proto_bytes(text_proto).unwrap();
- let file = write_bytes_to_temp_file(&binary_proto_bytes).unwrap();
- let file_full_path = file.path().display().to_string();
-
- let error = map_container_storage_files(&file_full_path, "system").unwrap_err();
- assert_eq!(
- format!("{:?}", error),
- "MapFileFail(fail to map non read only storage file ./tests/tmp.rw.package.map)"
+}}
+"#,
+ rw_files.package_map.name, ro_files.flag_map.name, ro_files.flag_val.name
);
- let text_proto = r#"
-files {
- version: 0
- container: "system"
- package_map: "./tests/tmp.ro.package.map"
- flag_map: "./tests/tmp.rw.flag.map"
- flag_val: "./tests/tmp.rw.flag.val"
- timestamp: 12345
-}
-"#;
- let binary_proto_bytes = get_binary_storage_proto_bytes(text_proto).unwrap();
- let file = write_bytes_to_temp_file(&binary_proto_bytes).unwrap();
+ let file = write_storage_text_to_temp_file(&text_proto).unwrap();
let file_full_path = file.path().display().to_string();
-
let error = map_container_storage_files(&file_full_path, "system").unwrap_err();
assert_eq!(
format!("{:?}", error),
- "MapFileFail(fail to map non read only storage file ./tests/tmp.rw.flag.map)"
+ format!(
+ "MapFileFail(fail to map non read only storage file {})",
+ rw_files.package_map.name
+ )
);
- let text_proto = r#"
-files {
+ let text_proto = format!(
+ r#"
+files {{
version: 0
container: "system"
- package_map: "./tests/tmp.ro.package.map"
- flag_map: "./tests/tmp.ro.flag.map"
- flag_val: "./tests/tmp.rw.flag.val"
+ package_map: "{}"
+ flag_map: "{}"
+ flag_val: "{}"
timestamp: 12345
-}
-"#;
- let binary_proto_bytes = get_binary_storage_proto_bytes(text_proto).unwrap();
- let file = write_bytes_to_temp_file(&binary_proto_bytes).unwrap();
- let file_full_path = file.path().display().to_string();
+}}
+"#,
+ ro_files.package_map.name, rw_files.flag_map.name, ro_files.flag_val.name
+ );
+ let file = write_storage_text_to_temp_file(&text_proto).unwrap();
+ let file_full_path = file.path().display().to_string();
let error = map_container_storage_files(&file_full_path, "system").unwrap_err();
assert_eq!(
format!("{:?}", error),
- "MapFileFail(fail to map non read only storage file ./tests/tmp.rw.flag.val)"
+ format!(
+ "MapFileFail(fail to map non read only storage file {})",
+ rw_files.flag_map.name
+ )
+ );
+
+ let text_proto = format!(
+ r#"
+files {{
+ version: 0
+ container: "system"
+ package_map: "{}"
+ flag_map: "{}"
+ flag_val: "{}"
+ timestamp: 12345
+}}
+"#,
+ ro_files.package_map.name, ro_files.flag_map.name, rw_files.flag_val.name
+ );
+
+ let file = write_storage_text_to_temp_file(&text_proto).unwrap();
+ let file_full_path = file.path().display().to_string();
+ let error = map_container_storage_files(&file_full_path, "system").unwrap_err();
+ assert_eq!(
+ format!("{:?}", error),
+ format!(
+ "MapFileFail(fail to map non read only storage file {})",
+ rw_files.flag_val.name
+ )
);
}
}
diff --git a/tools/aconfig/aconfig_storage_file/src/test_utils.rs b/tools/aconfig/aconfig_storage_file/src/test_utils.rs
index 6fe5a27..7905d51 100644
--- a/tools/aconfig/aconfig_storage_file/src/test_utils.rs
+++ b/tools/aconfig/aconfig_storage_file/src/test_utils.rs
@@ -19,12 +19,8 @@
use protobuf::Message;
use std::fs;
use std::io::Write;
-use std::path::Path;
-use std::sync::Once;
use tempfile::NamedTempFile;
-static INIT: Once = Once::new();
-
pub(crate) fn get_binary_storage_proto_bytes(text_proto: &str) -> Result<Vec<u8>> {
let storage_files: ProtoStorageFiles = protobuf::text_format::parse_from_str(text_proto)?;
let mut binary_proto = Vec::new();
@@ -32,59 +28,65 @@
Ok(binary_proto)
}
-pub(crate) fn write_bytes_to_temp_file(bytes: &[u8]) -> Result<NamedTempFile> {
+pub(crate) fn write_storage_text_to_temp_file(text_proto: &str) -> Result<NamedTempFile> {
+ let bytes = get_binary_storage_proto_bytes(text_proto).unwrap();
let mut file = NamedTempFile::new()?;
let _ = file.write_all(&bytes);
Ok(file)
}
-fn has_same_content(file1: &Path, file2: &Path) -> Result<bool> {
- let bytes1 = fs::read(file1)?;
- let bytes2 = fs::read(file2)?;
- if bytes1.len() != bytes2.len() {
- return Ok(false);
+fn set_file_read_only(file: &NamedTempFile) {
+ let mut perms = fs::metadata(file.path()).unwrap().permissions();
+ if !perms.readonly() {
+ perms.set_readonly(true);
+ fs::set_permissions(file.path(), perms).unwrap();
}
- for (i, &b1) in bytes1.iter().enumerate() {
- if b1 != bytes2[i] {
- return Ok(false);
- }
- }
- Ok(true)
}
-pub(crate) fn create_temp_storage_files_for_test() {
- INIT.call_once(|| {
- let file_paths = [
- ("./tests/package.map", "./tests/tmp.ro.package.map"),
- ("./tests/flag.map", "./tests/tmp.ro.flag.map"),
- ("./tests/flag.val", "./tests/tmp.ro.flag.val"),
- ("./tests/package.map", "./tests/tmp.rw.package.map"),
- ("./tests/flag.map", "./tests/tmp.rw.flag.map"),
- ("./tests/flag.val", "./tests/tmp.rw.flag.val"),
- ];
- for (file_path, copied_file_path) in file_paths.into_iter() {
- let file_path = Path::new(&file_path);
- let copied_file_path = Path::new(&copied_file_path);
- if copied_file_path.exists() && !has_same_content(file_path, copied_file_path).unwrap()
- {
- fs::remove_file(copied_file_path).unwrap();
- }
- if !copied_file_path.exists() {
- fs::copy(file_path, copied_file_path).unwrap();
- }
- }
- });
+fn set_file_read_write(file: &NamedTempFile) {
+ let mut perms = fs::metadata(file.path()).unwrap().permissions();
+ if perms.readonly() {
+ perms.set_readonly(false);
+ fs::set_permissions(file.path(), perms).unwrap();
+ }
}
-pub(crate) fn set_temp_storage_files_to_read_only() {
- let file_paths =
- ["./tests/tmp.ro.package.map", "./tests/tmp.ro.flag.map", "./tests/tmp.ro.flag.val"];
- for file_path in file_paths.into_iter() {
- let file_path = Path::new(&file_path);
- let mut perms = fs::metadata(file_path).unwrap().permissions();
- if !perms.readonly() {
- perms.set_readonly(true);
- fs::set_permissions(file_path, perms).unwrap();
+pub(crate) struct TestStorageFile {
+ pub file: NamedTempFile,
+ pub name: String,
+}
+
+impl TestStorageFile {
+ pub(crate) fn new(source_file: &str, read_only: bool) -> Result<Self> {
+ let file = NamedTempFile::new()?;
+ fs::copy(source_file, file.path())?;
+ if read_only {
+ set_file_read_only(&file);
+ } else {
+ set_file_read_write(&file);
}
+ let name = file.path().display().to_string();
+ Ok(Self { file, name })
+ }
+}
+
+pub(crate) struct TestStorageFileSet {
+ pub package_map: TestStorageFile,
+ pub flag_map: TestStorageFile,
+ pub flag_val: TestStorageFile,
+}
+
+impl TestStorageFileSet {
+ pub(crate) fn new(
+ package_map_path: &str,
+ flag_map_path: &str,
+ flag_val_path: &str,
+ read_only: bool,
+ ) -> Result<Self> {
+ Ok(Self {
+ package_map: TestStorageFile::new(package_map_path, read_only)?,
+ flag_map: TestStorageFile::new(flag_map_path, read_only)?,
+ flag_val: TestStorageFile::new(flag_val_path, read_only)?,
+ })
}
}
diff --git a/tools/aconfig/aconfig_storage_file/tests/Android.bp b/tools/aconfig/aconfig_storage_file/tests/Android.bp
new file mode 100644
index 0000000..b951273
--- /dev/null
+++ b/tools/aconfig/aconfig_storage_file/tests/Android.bp
@@ -0,0 +1,42 @@
+rust_test {
+ name: "aconfig_storage.test.rust",
+ srcs: [
+ "storage_lib_rust_test.rs"
+ ],
+ rustlibs: [
+ "libanyhow",
+ "libaconfig_storage_file",
+ "libprotobuf",
+ "libtempfile",
+ ],
+ data: [
+ ":ro.package.map",
+ ":ro.flag.map",
+ ":ro.flag.val",
+ ],
+ test_suites: ["general-tests"],
+}
+
+cc_test {
+ name: "aconfig_storage.test.cpp",
+ srcs: [
+ "storage_lib_cc_test.cpp",
+ ],
+ static_libs: [
+ "libgmock",
+ "libaconfig_storage_protos_cc",
+ "libprotobuf-cpp-lite",
+ "libaconfig_storage_cc",
+ "libbase",
+ "liblog",
+ ],
+ data: [
+ ":ro.package.map",
+ ":ro.flag.map",
+ ":ro.flag.val",
+ ],
+ test_suites: [
+ "device-tests",
+ "general-tests",
+ ],
+}
diff --git a/tools/aconfig/aconfig_storage_file/tests/storage_lib_cc_test.cpp b/tools/aconfig/aconfig_storage_file/tests/storage_lib_cc_test.cpp
new file mode 100644
index 0000000..7d5ba0a
--- /dev/null
+++ b/tools/aconfig/aconfig_storage_file/tests/storage_lib_cc_test.cpp
@@ -0,0 +1,161 @@
+/*
+ * 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.
+ */
+
+#include <string>
+#include <vector>
+
+#include "aconfig_storage/aconfig_storage.hpp"
+#include <gtest/gtest.h>
+#include <protos/aconfig_storage_metadata.pb.h>
+#include <android-base/file.h>
+
+using android::aconfig_storage_metadata::storage_files;
+using ::android::base::WriteStringToFile;
+using ::aconfig_storage::test_only_api::get_package_offset_impl;
+using ::aconfig_storage::test_only_api::get_flag_offset_impl;
+using ::aconfig_storage::test_only_api::get_boolean_flag_value_impl;
+
+void write_storage_location_pb_to_file(std::string const& file_path) {
+ auto const test_dir = android::base::GetExecutableDirectory();
+ auto proto = storage_files();
+ auto* info = proto.add_files();
+ info->set_version(0);
+ info->set_container("system");
+ info->set_package_map(test_dir + "/tests/tmp.ro.package.map");
+ info->set_flag_map(test_dir + "/tests/tmp.ro.flag.map");
+ info->set_flag_val(test_dir + "/tests/tmp.ro.flag.val");
+ info->set_timestamp(12345);
+
+ auto content = std::string();
+ proto.SerializeToString(&content);
+ ASSERT_TRUE(WriteStringToFile(content, file_path))
+ << "Failed to write a file: " << file_path;
+}
+
+TEST(AconfigStorageTest, test_package_offset_query) {
+ auto pb_file = std::string("/tmp/test_package_offset_query.pb");
+ write_storage_location_pb_to_file(pb_file);
+
+ auto query = get_package_offset_impl(
+ pb_file, "system", "com.android.aconfig.storage.test_1");
+ ASSERT_EQ(query.error_message, std::string());
+ ASSERT_TRUE(query.query_success);
+ ASSERT_TRUE(query.package_exists);
+ ASSERT_EQ(query.package_id, 0);
+ ASSERT_EQ(query.boolean_offset, 0);
+
+ query = get_package_offset_impl(
+ pb_file, "system", "com.android.aconfig.storage.test_2");
+ ASSERT_EQ(query.error_message, std::string());
+ ASSERT_TRUE(query.query_success);
+ ASSERT_TRUE(query.package_exists);
+ ASSERT_EQ(query.package_id, 1);
+ ASSERT_EQ(query.boolean_offset, 3);
+
+ query = get_package_offset_impl(
+ pb_file, "system", "com.android.aconfig.storage.test_4");
+ ASSERT_EQ(query.error_message, std::string());
+ ASSERT_TRUE(query.query_success);
+ ASSERT_TRUE(query.package_exists);
+ ASSERT_EQ(query.package_id, 2);
+ ASSERT_EQ(query.boolean_offset, 6);
+}
+
+TEST(AconfigStorageTest, test_invalid_package_offset_query) {
+ auto pb_file = std::string("/tmp/test_package_offset_query.pb");
+ write_storage_location_pb_to_file(pb_file);
+
+ auto query = get_package_offset_impl(
+ pb_file, "system", "com.android.aconfig.storage.test_3");
+ ASSERT_EQ(query.error_message, std::string());
+ ASSERT_TRUE(query.query_success);
+ ASSERT_FALSE(query.package_exists);
+
+ query = get_package_offset_impl(
+ pb_file, "vendor", "com.android.aconfig.storage.test_1");
+ ASSERT_EQ(query.error_message,
+ std::string("StorageFileNotFound(Storage file does not exist for vendor)"));
+ ASSERT_FALSE(query.query_success);
+}
+
+TEST(AconfigStorageTest, test_flag_offset_query) {
+ auto pb_file = std::string("/tmp/test_package_offset_query.pb");
+ write_storage_location_pb_to_file(pb_file);
+
+ auto baseline = std::vector<std::tuple<int, std::string, int>>{
+ {0, "enabled_ro", 1},
+ {0, "enabled_rw", 2},
+ {1, "disabled_ro", 0},
+ {2, "enabled_ro", 1},
+ {1, "enabled_fixed_ro", 1},
+ {1, "enabled_ro", 2},
+ {2, "enabled_fixed_ro", 0},
+ {0, "disabled_rw", 0},
+ };
+ for (auto const&[package_id, flag_name, expected_offset] : baseline) {
+ auto query = get_flag_offset_impl(pb_file, "system", package_id, flag_name);
+ ASSERT_EQ(query.error_message, std::string());
+ ASSERT_TRUE(query.query_success);
+ ASSERT_TRUE(query.flag_exists);
+ ASSERT_EQ(query.flag_offset, expected_offset);
+ }
+}
+
+TEST(AconfigStorageTest, test_invalid_flag_offset_query) {
+ auto pb_file = std::string("/tmp/test_invalid_package_offset_query.pb");
+ write_storage_location_pb_to_file(pb_file);
+
+ auto query = get_flag_offset_impl(pb_file, "system", 0, "none_exist");
+ ASSERT_EQ(query.error_message, std::string());
+ ASSERT_TRUE(query.query_success);
+ ASSERT_FALSE(query.flag_exists);
+
+ query = get_flag_offset_impl(pb_file, "system", 3, "enabled_ro");
+ ASSERT_EQ(query.error_message, std::string());
+ ASSERT_TRUE(query.query_success);
+ ASSERT_FALSE(query.flag_exists);
+
+ query = get_flag_offset_impl(pb_file, "vendor", 0, "enabled_ro");
+ ASSERT_EQ(query.error_message,
+ std::string("StorageFileNotFound(Storage file does not exist for vendor)"));
+ ASSERT_FALSE(query.query_success);
+}
+
+TEST(AconfigStorageTest, test_boolean_flag_value_query) {
+ auto pb_file = std::string("/tmp/test_boolean_flag_value_query.pb");
+ write_storage_location_pb_to_file(pb_file);
+ for (int offset = 0; offset < 8; ++offset) {
+ auto query = get_boolean_flag_value_impl(pb_file, "system", offset);
+ ASSERT_EQ(query.error_message, std::string());
+ ASSERT_TRUE(query.query_success);
+ ASSERT_FALSE(query.flag_value);
+ }
+}
+
+TEST(AconfigStorageTest, test_invalid_boolean_flag_value_query) {
+ auto pb_file = std::string("/tmp/test_invalid_boolean_flag_value_query.pb");
+ write_storage_location_pb_to_file(pb_file);
+
+ auto query = get_boolean_flag_value_impl(pb_file, "vendor", 0);
+ ASSERT_EQ(query.error_message,
+ std::string("StorageFileNotFound(Storage file does not exist for vendor)"));
+ ASSERT_FALSE(query.query_success);
+
+ query = get_boolean_flag_value_impl(pb_file, "system", 8);
+ ASSERT_EQ(query.error_message,
+ std::string("InvalidStorageFileOffset(Flag value offset goes beyond the end of the file.)"));
+ ASSERT_FALSE(query.query_success);
+}
diff --git a/tools/aconfig/aconfig_storage_file/tests/storage_lib_rust_test.rs b/tools/aconfig/aconfig_storage_file/tests/storage_lib_rust_test.rs
new file mode 100644
index 0000000..9916915
--- /dev/null
+++ b/tools/aconfig/aconfig_storage_file/tests/storage_lib_rust_test.rs
@@ -0,0 +1,174 @@
+#[cfg(not(feature = "cargo"))]
+mod aconfig_storage_rust_test {
+ use aconfig_storage_file::{
+ get_boolean_flag_value_impl, get_flag_offset_impl, get_package_offset_impl, PackageOffset,
+ ProtoStorageFiles,
+ };
+ use protobuf::Message;
+ use std::io::Write;
+ use tempfile::NamedTempFile;
+
+ fn write_storage_location_file() -> NamedTempFile {
+ let text_proto = r#"
+files {
+ version: 0
+ container: "system"
+ package_map: "./tests/tmp.ro.package.map"
+ flag_map: "./tests/tmp.ro.flag.map"
+ flag_val: "./tests/tmp.ro.flag.val"
+ timestamp: 12345
+}
+"#;
+ let storage_files: ProtoStorageFiles =
+ protobuf::text_format::parse_from_str(text_proto).unwrap();
+ let mut binary_proto_bytes = Vec::new();
+ storage_files.write_to_vec(&mut binary_proto_bytes).unwrap();
+ let mut file = NamedTempFile::new().unwrap();
+ file.write_all(&binary_proto_bytes).unwrap();
+ file
+ }
+
+ #[test]
+ fn test_package_offset_query() {
+ let file = write_storage_location_file();
+ let file_full_path = file.path().display().to_string();
+
+ let package_offset = get_package_offset_impl(
+ &file_full_path,
+ "system",
+ "com.android.aconfig.storage.test_1",
+ )
+ .unwrap()
+ .unwrap();
+ let expected_package_offset = PackageOffset { package_id: 0, boolean_offset: 0 };
+ assert_eq!(package_offset, expected_package_offset);
+
+ let package_offset = get_package_offset_impl(
+ &file_full_path,
+ "system",
+ "com.android.aconfig.storage.test_2",
+ )
+ .unwrap()
+ .unwrap();
+ let expected_package_offset = PackageOffset { package_id: 1, boolean_offset: 3 };
+ assert_eq!(package_offset, expected_package_offset);
+
+ let package_offset = get_package_offset_impl(
+ &file_full_path,
+ "system",
+ "com.android.aconfig.storage.test_4",
+ )
+ .unwrap()
+ .unwrap();
+ let expected_package_offset = PackageOffset { package_id: 2, boolean_offset: 6 };
+ assert_eq!(package_offset, expected_package_offset);
+
+ let package_offset = get_package_offset_impl(
+ &file_full_path,
+ "system",
+ "com.android.aconfig.storage.test_3",
+ )
+ .unwrap();
+ assert_eq!(package_offset, None);
+ }
+
+ #[test]
+ fn test_invalid_package_offset_query() {
+ let file = write_storage_location_file();
+ let file_full_path = file.path().display().to_string();
+
+ let package_offset_option = get_package_offset_impl(
+ &file_full_path,
+ "system",
+ "com.android.aconfig.storage.test_3",
+ )
+ .unwrap();
+ assert_eq!(package_offset_option, None);
+
+ let err = get_package_offset_impl(
+ &file_full_path,
+ "vendor",
+ "com.android.aconfig.storage.test_1",
+ )
+ .unwrap_err();
+ assert_eq!(
+ format!("{:?}", err),
+ "StorageFileNotFound(Storage file does not exist for vendor)"
+ );
+ }
+
+ #[test]
+ fn test_flag_offset_query() {
+ let file = write_storage_location_file();
+ let file_full_path = file.path().display().to_string();
+
+ let baseline = vec![
+ (0, "enabled_ro", 1u16),
+ (0, "enabled_rw", 2u16),
+ (1, "disabled_ro", 0u16),
+ (2, "enabled_ro", 1u16),
+ (1, "enabled_fixed_ro", 1u16),
+ (1, "enabled_ro", 2u16),
+ (2, "enabled_fixed_ro", 0u16),
+ (0, "disabled_rw", 0u16),
+ ];
+ for (package_id, flag_name, expected_offset) in baseline.into_iter() {
+ let flag_offset =
+ get_flag_offset_impl(&file_full_path, "system", package_id, flag_name)
+ .unwrap()
+ .unwrap();
+ assert_eq!(flag_offset, expected_offset);
+ }
+ }
+
+ #[test]
+ fn test_invalid_flag_offset_query() {
+ let file = write_storage_location_file();
+ let file_full_path = file.path().display().to_string();
+
+ let flag_offset_option =
+ get_flag_offset_impl(&file_full_path, "system", 0, "none_exist").unwrap();
+ assert_eq!(flag_offset_option, None);
+
+ let flag_offset_option =
+ get_flag_offset_impl(&file_full_path, "system", 3, "enabled_ro").unwrap();
+ assert_eq!(flag_offset_option, None);
+
+ let err = get_flag_offset_impl(&file_full_path, "vendor", 0, "enabled_ro").unwrap_err();
+ assert_eq!(
+ format!("{:?}", err),
+ "StorageFileNotFound(Storage file does not exist for vendor)"
+ );
+ }
+
+ #[test]
+ fn test_boolean_flag_value_query() {
+ let file = write_storage_location_file();
+ let file_full_path = file.path().display().to_string();
+
+ let baseline: Vec<bool> = vec![false; 8];
+ for (offset, expected_value) in baseline.into_iter().enumerate() {
+ let flag_value =
+ get_boolean_flag_value_impl(&file_full_path, "system", offset as u32).unwrap();
+ assert_eq!(flag_value, expected_value);
+ }
+ }
+
+ #[test]
+ fn test_invalid_boolean_flag_value_query() {
+ let file = write_storage_location_file();
+ let file_full_path = file.path().display().to_string();
+
+ let err = get_boolean_flag_value_impl(&file_full_path, "vendor", 0u32).unwrap_err();
+ assert_eq!(
+ format!("{:?}", err),
+ "StorageFileNotFound(Storage file does not exist for vendor)"
+ );
+
+ let err = get_boolean_flag_value_impl(&file_full_path, "system", 8u32).unwrap_err();
+ assert_eq!(
+ format!("{:?}", err),
+ "InvalidStorageFileOffset(Flag value offset goes beyond the end of the file.)"
+ );
+ }
+}
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/aconfig/fake_device_config/Android.bp b/tools/aconfig/fake_device_config/Android.bp
index 7420aa8..4566bf9 100644
--- a/tools/aconfig/fake_device_config/Android.bp
+++ b/tools/aconfig/fake_device_config/Android.bp
@@ -15,7 +15,8 @@
java_library {
name: "fake_device_config",
srcs: ["src/**/*.java"],
- sdk_version: "core_current",
+ sdk_version: "none",
+ system_modules: "core-all-system-modules",
host_supported: true,
}
diff --git a/tools/characteristics_rro_generator.py b/tools/characteristics_rro_generator.py
index 6489673..cf873ee 100644
--- a/tools/characteristics_rro_generator.py
+++ b/tools/characteristics_rro_generator.py
@@ -1,22 +1,14 @@
#!/usr/bin/env python3
import sys
-from xml.dom.minidom import parseString
-
-def parse_package(manifest):
- with open(manifest, 'r') as f:
- data = f.read()
- dom = parseString(data)
- return dom.documentElement.getAttribute('package')
if __name__ == '__main__':
if len(sys.argv) != 3:
- sys.exit(f"usage: {sys_argv[0]} target_package_manifest output\n")
- package_name = parse_package(sys.argv[1])
+ sys.exit(f"usage: {sys_argv[0]} target_package_name output\n")
with open(sys.argv[2], "w") as f:
f.write(f'''<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="{package_name}.auto_generated_characteristics_rro">
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="{sys.argv[1]}.auto_generated_characteristics_rro">
<application android:hasCode="false" />
- <overlay android:targetPackage="{package_name}"
+ <overlay android:targetPackage="{sys.argv[1]}"
android:isStatic="true"
android:priority="0" />
</manifest>
diff --git a/tools/ide_query/go.mod b/tools/ide_query/go.mod
new file mode 100644
index 0000000..f9d727f
--- /dev/null
+++ b/tools/ide_query/go.mod
@@ -0,0 +1,7 @@
+module ide_query
+
+go 1.21
+
+require (
+ google.golang.org/protobuf v0.0.0
+)
diff --git a/tools/ide_query/go.work b/tools/ide_query/go.work
new file mode 100644
index 0000000..851f352
--- /dev/null
+++ b/tools/ide_query/go.work
@@ -0,0 +1,9 @@
+go 1.21
+
+use (
+ .
+)
+
+replace (
+ google.golang.org/protobuf v0.0.0 => ../../../../external/golang-protobuf
+)
\ No newline at end of file
diff --git a/tools/ide_query/go.work.sum b/tools/ide_query/go.work.sum
new file mode 100644
index 0000000..cf42b48
--- /dev/null
+++ b/tools/ide_query/go.work.sum
@@ -0,0 +1,5 @@
+github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
+github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+google.golang.org/protobuf v1.26.0-rc.1 h1:7QnIQpGRHE5RnLKnESfDoxm2dTapTZua5a0kS0A+VXQ=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
diff --git a/tools/ide_query/ide_query.go b/tools/ide_query/ide_query.go
new file mode 100644
index 0000000..c1c4da0
--- /dev/null
+++ b/tools/ide_query/ide_query.go
@@ -0,0 +1,265 @@
+// Binary ide_query generates and analyzes build artifacts.
+// The produced result can be consumed by IDEs to provide language features.
+package main
+
+import (
+ "container/list"
+ "context"
+ "encoding/json"
+ "flag"
+ "fmt"
+ "log"
+ "os"
+ "os/exec"
+ "path"
+ "slices"
+ "strings"
+
+ "google.golang.org/protobuf/proto"
+ pb "ide_query/ide_query_proto"
+)
+
+// Env contains information about the current environment.
+type Env struct {
+ LunchTarget LunchTarget
+ RepoDir string
+ OutDir string
+}
+
+// LunchTarget is a parsed Android lunch target.
+// Input format: <product_name>-<release_type>-<build_variant>
+type LunchTarget struct {
+ Product string
+ Release string
+ Variant string
+}
+
+var _ flag.Value = (*LunchTarget)(nil)
+
+// // Get implements flag.Value.
+// func (l *LunchTarget) Get() any {
+// return l
+// }
+
+// Set implements flag.Value.
+func (l *LunchTarget) Set(s string) error {
+ parts := strings.Split(s, "-")
+ if len(parts) != 3 {
+ return fmt.Errorf("invalid lunch target: %q, must have form <product_name>-<release_type>-<build_variant>", s)
+ }
+ *l = LunchTarget{
+ Product: parts[0],
+ Release: parts[1],
+ Variant: parts[2],
+ }
+ return nil
+}
+
+// String implements flag.Value.
+func (l *LunchTarget) String() string {
+ return fmt.Sprintf("%s-%s-%s", l.Product, l.Release, l.Variant)
+}
+
+func main() {
+ var env Env
+ env.OutDir = os.Getenv("OUT_DIR")
+ env.RepoDir = os.Getenv("ANDROID_BUILD_TOP")
+ flag.Var(&env.LunchTarget, "lunch_target", "The lunch target to query")
+ flag.Parse()
+ files := flag.Args()
+ if len(files) == 0 {
+ fmt.Println("No files provided.")
+ os.Exit(1)
+ return
+ }
+
+ var javaFiles []string
+ for _, f := range files {
+ switch {
+ case strings.HasSuffix(f, ".java") || strings.HasSuffix(f, ".kt"):
+ javaFiles = append(javaFiles, f)
+ default:
+ log.Printf("File %q is supported - will be skipped.", f)
+ }
+ }
+
+ ctx := context.Background()
+ javaDepsPath := path.Join(env.RepoDir, env.OutDir, "soong/module_bp_java_deps.json")
+ // TODO(michaelmerg): Figure out if module_bp_java_deps.json is outdated.
+ runMake(ctx, env, "nothing")
+
+ javaModules, err := loadJavaModules(javaDepsPath)
+ if err != nil {
+ log.Fatalf("Failed to load java modules: %v", err)
+ }
+
+ fileToModule := make(map[string]*javaModule) // file path -> module
+ for _, f := range javaFiles {
+ for _, m := range javaModules {
+ if !slices.Contains(m.Srcs, f) {
+ continue
+ }
+ if fileToModule[f] != nil {
+ // TODO(michaelmerg): Handle the case where a file is covered by multiple modules.
+ log.Printf("File %q found in module %q but is already covered by module %q", f, m.Name, fileToModule[f].Name)
+ continue
+ }
+ fileToModule[f] = m
+ }
+ }
+
+ var toMake []string
+ for _, m := range fileToModule {
+ toMake = append(toMake, m.Name)
+ }
+ fmt.Printf("Running make for modules: %v\n", strings.Join(toMake, ", "))
+ if err := runMake(ctx, env, toMake...); err != nil {
+ log.Fatalf("Failed to run make: %v", err)
+ }
+
+ var sources []*pb.SourceFile
+ type depsAndGenerated struct {
+ Deps []string
+ Generated []*pb.GeneratedFile
+ }
+ moduleToDeps := make(map[string]*depsAndGenerated)
+ for _, f := range files {
+ file := &pb.SourceFile{
+ Path: f,
+ WorkingDir: env.RepoDir,
+ }
+ sources = append(sources, file)
+
+ m := fileToModule[f]
+ if m == nil {
+ file.Status = &pb.Status{
+ Code: pb.Status_FAILURE,
+ Message: proto.String("File not found in any module."),
+ }
+ continue
+ }
+
+ file.Status = &pb.Status{Code: pb.Status_OK}
+ if moduleToDeps[m.Name] != nil {
+ file.Generated = moduleToDeps[m.Name].Generated
+ file.Deps = moduleToDeps[m.Name].Deps
+ continue
+ }
+
+ deps := transitiveDeps(m, javaModules)
+ var generated []*pb.GeneratedFile
+ outPrefix := env.OutDir + "/"
+ for _, d := range deps {
+ if relPath, ok := strings.CutPrefix(d, outPrefix); ok {
+ contents, err := os.ReadFile(d)
+ if err != nil {
+ fmt.Printf("Generated file %q not found - will be skipped.\n", d)
+ continue
+ }
+
+ generated = append(generated, &pb.GeneratedFile{
+ Path: relPath,
+ Contents: contents,
+ })
+ }
+ }
+ moduleToDeps[m.Name] = &depsAndGenerated{deps, generated}
+ file.Generated = generated
+ file.Deps = deps
+ }
+
+ res := &pb.IdeAnalysis{
+ BuildArtifactRoot: env.OutDir,
+ Sources: sources,
+ Status: &pb.Status{Code: pb.Status_OK},
+ }
+ data, err := proto.Marshal(res)
+ if err != nil {
+ log.Fatalf("Failed to marshal result proto: %v", err)
+ }
+
+ err = os.WriteFile(path.Join(env.OutDir, "ide_query.pb"), data, 0644)
+ if err != nil {
+ log.Fatalf("Failed to write result proto: %v", err)
+ }
+
+ for _, s := range sources {
+ fmt.Printf("%s: %v (Deps: %d, Generated: %d)\n", s.GetPath(), s.GetStatus(), len(s.GetDeps()), len(s.GetGenerated()))
+ }
+}
+
+// runMake runs Soong build for the given modules.
+func runMake(ctx context.Context, env Env, modules ...string) error {
+ args := []string{
+ "--make-mode",
+ "ANDROID_BUILD_ENVIRONMENT_CONFIG=googler-cog",
+ "TARGET_PRODUCT=" + env.LunchTarget.Product,
+ "TARGET_RELEASE=" + env.LunchTarget.Release,
+ "TARGET_BUILD_VARIANT=" + env.LunchTarget.Variant,
+ }
+ args = append(args, modules...)
+ cmd := exec.CommandContext(ctx, "build/soong/soong_ui.bash", args...)
+ cmd.Dir = env.RepoDir
+ cmd.Stdout = os.Stdout
+ cmd.Stderr = os.Stderr
+ return cmd.Run()
+}
+
+type javaModule struct {
+ Name string
+ Path []string `json:"path,omitempty"`
+ Deps []string `json:"dependencies,omitempty"`
+ Srcs []string `json:"srcs,omitempty"`
+ Jars []string `json:"jars,omitempty"`
+ SrcJars []string `json:"srcjars,omitempty"`
+}
+
+func loadJavaModules(path string) (map[string]*javaModule, error) {
+ data, err := os.ReadFile(path)
+ if err != nil {
+ return nil, err
+ }
+
+ var ret map[string]*javaModule // module name -> module
+ if err = json.Unmarshal(data, &ret); err != nil {
+ return nil, err
+ }
+
+ for name, module := range ret {
+ if strings.HasSuffix(name, "-jarjar") || strings.HasSuffix(name, ".impl") {
+ delete(ret, name)
+ continue
+ }
+
+ module.Name = name
+ }
+ return ret, nil
+}
+
+func transitiveDeps(m *javaModule, modules map[string]*javaModule) []string {
+ var ret []string
+ q := list.New()
+ q.PushBack(m.Name)
+ seen := make(map[string]bool) // module names -> true
+ for q.Len() > 0 {
+ name := q.Remove(q.Front()).(string)
+ mod := modules[name]
+ if mod == nil {
+ continue
+ }
+
+ ret = append(ret, mod.Srcs...)
+ ret = append(ret, mod.SrcJars...)
+ ret = append(ret, mod.Jars...)
+ for _, d := range mod.Deps {
+ if seen[d] {
+ continue
+ }
+ seen[d] = true
+ q.PushBack(d)
+ }
+ }
+ slices.Sort(ret)
+ ret = slices.Compact(ret)
+ return ret
+}
diff --git a/tools/ide_query/ide_query.sh b/tools/ide_query/ide_query.sh
new file mode 100755
index 0000000..663c4dc
--- /dev/null
+++ b/tools/ide_query/ide_query.sh
@@ -0,0 +1,12 @@
+#!/bin/bash -e
+
+cd $(dirname $BASH_SOURCE)
+source $(pwd)/../../shell_utils.sh
+require_top
+
+# Ensure cogsetup (out/ will be symlink outside the repo)
+. ${TOP}/build/make/cogsetup.sh
+
+export ANDROID_BUILD_TOP=$TOP
+export OUT_DIR=${OUT_DIR}
+exec "${TOP}/prebuilts/go/linux-x86/bin/go" "run" "ide_query" "$@"
diff --git a/tools/ide_query/ide_query_proto/ide_query.pb.go b/tools/ide_query/ide_query_proto/ide_query.pb.go
new file mode 100644
index 0000000..30571cc
--- /dev/null
+++ b/tools/ide_query/ide_query_proto/ide_query.pb.go
@@ -0,0 +1,522 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.30.0
+// protoc v3.21.12
+// source: ide_query.proto
+
+package ide_query_proto
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type Status_Code int32
+
+const (
+ Status_OK Status_Code = 0
+ Status_FAILURE Status_Code = 1
+)
+
+// Enum value maps for Status_Code.
+var (
+ Status_Code_name = map[int32]string{
+ 0: "OK",
+ 1: "FAILURE",
+ }
+ Status_Code_value = map[string]int32{
+ "OK": 0,
+ "FAILURE": 1,
+ }
+)
+
+func (x Status_Code) Enum() *Status_Code {
+ p := new(Status_Code)
+ *p = x
+ return p
+}
+
+func (x Status_Code) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (Status_Code) Descriptor() protoreflect.EnumDescriptor {
+ return file_ide_query_proto_enumTypes[0].Descriptor()
+}
+
+func (Status_Code) Type() protoreflect.EnumType {
+ return &file_ide_query_proto_enumTypes[0]
+}
+
+func (x Status_Code) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use Status_Code.Descriptor instead.
+func (Status_Code) EnumDescriptor() ([]byte, []int) {
+ return file_ide_query_proto_rawDescGZIP(), []int{0, 0}
+}
+
+// Indicates the success/failure for analysis.
+type Status struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Code Status_Code `protobuf:"varint,1,opt,name=code,proto3,enum=cider.build.companion.Status_Code" json:"code,omitempty"`
+ // Details about the status, might be displayed to user.
+ Message *string `protobuf:"bytes,2,opt,name=message,proto3,oneof" json:"message,omitempty"`
+}
+
+func (x *Status) Reset() {
+ *x = Status{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_ide_query_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Status) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Status) ProtoMessage() {}
+
+func (x *Status) ProtoReflect() protoreflect.Message {
+ mi := &file_ide_query_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Status.ProtoReflect.Descriptor instead.
+func (*Status) Descriptor() ([]byte, []int) {
+ return file_ide_query_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *Status) GetCode() Status_Code {
+ if x != nil {
+ return x.Code
+ }
+ return Status_OK
+}
+
+func (x *Status) GetMessage() string {
+ if x != nil && x.Message != nil {
+ return *x.Message
+ }
+ return ""
+}
+
+type GeneratedFile struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Path to the file relative to IdeAnalysis.build_artifact_root.
+ Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
+ // The text of the generated file, if not provided contents will be read
+ //
+ // from the path above in user's workstation.
+ Contents []byte `protobuf:"bytes,2,opt,name=contents,proto3,oneof" json:"contents,omitempty"`
+}
+
+func (x *GeneratedFile) Reset() {
+ *x = GeneratedFile{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_ide_query_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GeneratedFile) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GeneratedFile) ProtoMessage() {}
+
+func (x *GeneratedFile) ProtoReflect() protoreflect.Message {
+ mi := &file_ide_query_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GeneratedFile.ProtoReflect.Descriptor instead.
+func (*GeneratedFile) Descriptor() ([]byte, []int) {
+ return file_ide_query_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *GeneratedFile) GetPath() string {
+ if x != nil {
+ return x.Path
+ }
+ return ""
+}
+
+func (x *GeneratedFile) GetContents() []byte {
+ if x != nil {
+ return x.Contents
+ }
+ return nil
+}
+
+type SourceFile struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Repo root relative path to the source file in the tree.
+ Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
+ // Working directory used by the build system. All the relative
+ // paths in compiler_arguments should be relative to this path.
+ // Relative to workspace root.
+ WorkingDir string `protobuf:"bytes,2,opt,name=working_dir,json=workingDir,proto3" json:"working_dir,omitempty"`
+ // Compiler arguments to compile the source file. If multiple variants
+ // of the module being compiled are possible, the query script will choose
+ // one.
+ CompilerArguments []string `protobuf:"bytes,3,rep,name=compiler_arguments,json=compilerArguments,proto3" json:"compiler_arguments,omitempty"`
+ // Any generated files that are used in compiling the file.
+ Generated []*GeneratedFile `protobuf:"bytes,4,rep,name=generated,proto3" json:"generated,omitempty"`
+ // Paths to all of the sources, like build files, code generators,
+ // proto files etc. that were used during analysis. Used to figure
+ // out when a set of build artifacts are stale and the query tool
+ // must be re-run.
+ // Relative to workspace root.
+ Deps []string `protobuf:"bytes,5,rep,name=deps,proto3" json:"deps,omitempty"`
+ // Represensts analysis status for this particular file. e.g. not part
+ // of the build graph.
+ Status *Status `protobuf:"bytes,6,opt,name=status,proto3,oneof" json:"status,omitempty"`
+}
+
+func (x *SourceFile) Reset() {
+ *x = SourceFile{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_ide_query_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SourceFile) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SourceFile) ProtoMessage() {}
+
+func (x *SourceFile) ProtoReflect() protoreflect.Message {
+ mi := &file_ide_query_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SourceFile.ProtoReflect.Descriptor instead.
+func (*SourceFile) Descriptor() ([]byte, []int) {
+ return file_ide_query_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *SourceFile) GetPath() string {
+ if x != nil {
+ return x.Path
+ }
+ return ""
+}
+
+func (x *SourceFile) GetWorkingDir() string {
+ if x != nil {
+ return x.WorkingDir
+ }
+ return ""
+}
+
+func (x *SourceFile) GetCompilerArguments() []string {
+ if x != nil {
+ return x.CompilerArguments
+ }
+ return nil
+}
+
+func (x *SourceFile) GetGenerated() []*GeneratedFile {
+ if x != nil {
+ return x.Generated
+ }
+ return nil
+}
+
+func (x *SourceFile) GetDeps() []string {
+ if x != nil {
+ return x.Deps
+ }
+ return nil
+}
+
+func (x *SourceFile) GetStatus() *Status {
+ if x != nil {
+ return x.Status
+ }
+ return nil
+}
+
+type IdeAnalysis struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Path relative to workspace root, containing all the artifacts
+ // generated by the build system. GeneratedFile.path are always
+ // relative to this directory.
+ BuildArtifactRoot string `protobuf:"bytes,1,opt,name=build_artifact_root,json=buildArtifactRoot,proto3" json:"build_artifact_root,omitempty"`
+ Sources []*SourceFile `protobuf:"bytes,2,rep,name=sources,proto3" json:"sources,omitempty"`
+ // Status representing overall analysis.
+ // Should fail only when no analysis can be performed, e.g. workspace
+ // isn't setup.
+ Status *Status `protobuf:"bytes,3,opt,name=status,proto3,oneof" json:"status,omitempty"`
+}
+
+func (x *IdeAnalysis) Reset() {
+ *x = IdeAnalysis{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_ide_query_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *IdeAnalysis) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*IdeAnalysis) ProtoMessage() {}
+
+func (x *IdeAnalysis) ProtoReflect() protoreflect.Message {
+ mi := &file_ide_query_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use IdeAnalysis.ProtoReflect.Descriptor instead.
+func (*IdeAnalysis) Descriptor() ([]byte, []int) {
+ return file_ide_query_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *IdeAnalysis) GetBuildArtifactRoot() string {
+ if x != nil {
+ return x.BuildArtifactRoot
+ }
+ return ""
+}
+
+func (x *IdeAnalysis) GetSources() []*SourceFile {
+ if x != nil {
+ return x.Sources
+ }
+ return nil
+}
+
+func (x *IdeAnalysis) GetStatus() *Status {
+ if x != nil {
+ return x.Status
+ }
+ return nil
+}
+
+var File_ide_query_proto protoreflect.FileDescriptor
+
+var file_ide_query_proto_rawDesc = []byte{
+ 0x0a, 0x0f, 0x69, 0x64, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74,
+ 0x6f, 0x12, 0x15, 0x63, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2e, 0x63,
+ 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x69, 0x6f, 0x6e, 0x22, 0x88, 0x01, 0x0a, 0x06, 0x53, 0x74, 0x61,
+ 0x74, 0x75, 0x73, 0x12, 0x36, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x0e, 0x32, 0x22, 0x2e, 0x63, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2e,
+ 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
+ 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x1d, 0x0a, 0x07, 0x6d,
+ 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07,
+ 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x22, 0x1b, 0x0a, 0x04, 0x43, 0x6f,
+ 0x64, 0x65, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x46, 0x41,
+ 0x49, 0x4c, 0x55, 0x52, 0x45, 0x10, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6d, 0x65, 0x73, 0x73,
+ 0x61, 0x67, 0x65, 0x22, 0x51, 0x0a, 0x0d, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64,
+ 0x46, 0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74,
+ 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f,
+ 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x88, 0x01, 0x01, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x63, 0x6f,
+ 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x8f, 0x02, 0x0a, 0x0a, 0x53, 0x6f, 0x75, 0x72, 0x63,
+ 0x65, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x6f, 0x72,
+ 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x69, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
+ 0x77, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x72, 0x12, 0x2d, 0x0a, 0x12, 0x63, 0x6f,
+ 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x5f, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73,
+ 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72,
+ 0x41, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x42, 0x0a, 0x09, 0x67, 0x65, 0x6e,
+ 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63,
+ 0x69, 0x64, 0x65, 0x72, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x61,
+ 0x6e, 0x69, 0x6f, 0x6e, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69,
+ 0x6c, 0x65, 0x52, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x12, 0x12, 0x0a,
+ 0x04, 0x64, 0x65, 0x70, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x64, 0x65, 0x70,
+ 0x73, 0x12, 0x3a, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2e,
+ 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
+ 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a,
+ 0x07, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xc1, 0x01, 0x0a, 0x0b, 0x49, 0x64, 0x65,
+ 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x62, 0x75, 0x69, 0x6c,
+ 0x64, 0x5f, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x41, 0x72, 0x74, 0x69,
+ 0x66, 0x61, 0x63, 0x74, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x3b, 0x0a, 0x07, 0x73, 0x6f, 0x75, 0x72,
+ 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x69, 0x64, 0x65,
+ 0x72, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x69, 0x6f,
+ 0x6e, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x07, 0x73, 0x6f,
+ 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x3a, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18,
+ 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x62, 0x75,
+ 0x69, 0x6c, 0x64, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74,
+ 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x88, 0x01,
+ 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x1b, 0x5a, 0x19,
+ 0x69, 0x64, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x69, 0x64, 0x65, 0x5f, 0x71, 0x75,
+ 0x65, 0x72, 0x79, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+ 0x33,
+}
+
+var (
+ file_ide_query_proto_rawDescOnce sync.Once
+ file_ide_query_proto_rawDescData = file_ide_query_proto_rawDesc
+)
+
+func file_ide_query_proto_rawDescGZIP() []byte {
+ file_ide_query_proto_rawDescOnce.Do(func() {
+ file_ide_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_ide_query_proto_rawDescData)
+ })
+ return file_ide_query_proto_rawDescData
+}
+
+var file_ide_query_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
+var file_ide_query_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
+var file_ide_query_proto_goTypes = []interface{}{
+ (Status_Code)(0), // 0: cider.build.companion.Status.Code
+ (*Status)(nil), // 1: cider.build.companion.Status
+ (*GeneratedFile)(nil), // 2: cider.build.companion.GeneratedFile
+ (*SourceFile)(nil), // 3: cider.build.companion.SourceFile
+ (*IdeAnalysis)(nil), // 4: cider.build.companion.IdeAnalysis
+}
+var file_ide_query_proto_depIdxs = []int32{
+ 0, // 0: cider.build.companion.Status.code:type_name -> cider.build.companion.Status.Code
+ 2, // 1: cider.build.companion.SourceFile.generated:type_name -> cider.build.companion.GeneratedFile
+ 1, // 2: cider.build.companion.SourceFile.status:type_name -> cider.build.companion.Status
+ 3, // 3: cider.build.companion.IdeAnalysis.sources:type_name -> cider.build.companion.SourceFile
+ 1, // 4: cider.build.companion.IdeAnalysis.status:type_name -> cider.build.companion.Status
+ 5, // [5:5] is the sub-list for method output_type
+ 5, // [5:5] is the sub-list for method input_type
+ 5, // [5:5] is the sub-list for extension type_name
+ 5, // [5:5] is the sub-list for extension extendee
+ 0, // [0:5] is the sub-list for field type_name
+}
+
+func init() { file_ide_query_proto_init() }
+func file_ide_query_proto_init() {
+ if File_ide_query_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_ide_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Status); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_ide_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GeneratedFile); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_ide_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SourceFile); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_ide_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*IdeAnalysis); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ file_ide_query_proto_msgTypes[0].OneofWrappers = []interface{}{}
+ file_ide_query_proto_msgTypes[1].OneofWrappers = []interface{}{}
+ file_ide_query_proto_msgTypes[2].OneofWrappers = []interface{}{}
+ file_ide_query_proto_msgTypes[3].OneofWrappers = []interface{}{}
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_ide_query_proto_rawDesc,
+ NumEnums: 1,
+ NumMessages: 4,
+ NumExtensions: 0,
+ NumServices: 0,
+ },
+ GoTypes: file_ide_query_proto_goTypes,
+ DependencyIndexes: file_ide_query_proto_depIdxs,
+ EnumInfos: file_ide_query_proto_enumTypes,
+ MessageInfos: file_ide_query_proto_msgTypes,
+ }.Build()
+ File_ide_query_proto = out.File
+ file_ide_query_proto_rawDesc = nil
+ file_ide_query_proto_goTypes = nil
+ file_ide_query_proto_depIdxs = nil
+}
diff --git a/tools/ide_query/ide_query_proto/ide_query.proto b/tools/ide_query/ide_query_proto/ide_query.proto
new file mode 100644
index 0000000..63eea39
--- /dev/null
+++ b/tools/ide_query/ide_query_proto/ide_query.proto
@@ -0,0 +1,66 @@
+syntax = "proto3";
+
+package ide_query;
+option go_package = "ide_query/ide_query_proto";
+
+// Indicates the success/failure for analysis.
+message Status {
+ enum Code {
+ OK = 0;
+ FAILURE = 1;
+ }
+ Code code = 1;
+ // Details about the status, might be displayed to user.
+ optional string message = 2;
+}
+
+message GeneratedFile {
+ // Path to the file relative to IdeAnalysis.build_artifact_root.
+ string path = 1;
+
+ // The text of the generated file, if not provided contents will be read
+ // from the path above in user's workstation.
+ optional bytes contents = 2;
+}
+
+message SourceFile {
+ // Path to the source file relative to repository root.
+ string path = 1;
+
+ // Working directory used by the build system. All the relative
+ // paths in compiler_arguments should be relative to this path.
+ // Relative to repository root.
+ string working_dir = 2;
+
+ // Compiler arguments to compile the source file. If multiple variants
+ // of the module being compiled are possible, the query script will choose
+ // one.
+ repeated string compiler_arguments = 3;
+
+ // Any generated files that are used in compiling the file.
+ repeated GeneratedFile generated = 4;
+
+ // Paths to all of the sources, like build files, code generators,
+ // proto files etc. that were used during analysis. Used to figure
+ // out when a set of build artifacts are stale and the query tool
+ // must be re-run.
+ // Relative to repository root.
+ repeated string deps = 5;
+
+ // Represents analysis status for this particular file. e.g. not part
+ // of the build graph.
+ optional Status status = 6;
+}
+
+message IdeAnalysis {
+ // Path relative to repository root, containing all the artifacts
+ // generated by the build system. GeneratedFile.path are always
+ // relative to this directory.
+ string build_artifact_root = 1;
+
+ repeated SourceFile sources = 2;
+
+ // Status representing overall analysis.
+ // Should fail only when no analysis can be performed.
+ optional Status status = 3;
+}
diff --git a/tools/ide_query/ide_query_proto/regen.sh b/tools/ide_query/ide_query_proto/regen.sh
new file mode 100755
index 0000000..eec4f37
--- /dev/null
+++ b/tools/ide_query/ide_query_proto/regen.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+aprotoc --go_out=paths=source_relative:. ide_query.proto
diff --git a/tools/perf/benchmarks b/tools/perf/benchmarks
index ad34586..6998ecd 100755
--- a/tools/perf/benchmarks
+++ b/tools/perf/benchmarks
@@ -249,6 +249,21 @@
undo=lambda: orig.write()
)
+def ChangePublicApi():
+ change = AddJavaField("frameworks/base/core/java/android/provider/Settings.java",
+ "@android.annotation.SuppressLint(\"UnflaggedApi\") public")
+ orig_current_text = Snapshot("frameworks/base/core/api/current.txt")
+
+ def undo():
+ change.undo()
+ orig_current_text.write()
+
+ return Change(
+ label=change.label,
+ change=change.change,
+ undo=lambda: undo()
+ )
+
def AddJavaField(filename, prefix):
return Modify(filename,
lambda: f"{prefix} static final int BENCHMARK = {random.randint(0, 1000000)};\n",
@@ -740,9 +755,8 @@
),
Benchmark(id="framework_api",
title="Add API to Settings.java",
- change=AddJavaField("frameworks/base/core/java/android/provider/Settings.java",
- "@android.annotation.SuppressLint(\"UnflaggedApi\") public"),
- modules=["framework-minus-apex"],
+ change=ChangePublicApi(),
+ modules=["api-stubs-docs-non-updatable-update-current-api", "framework-minus-apex"],
preroll=1,
postroll=2,
),
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():