Merge "Revert "Check remaining bytes before attempting to read from buffer"" into main
diff --git a/ci/Android.bp b/ci/Android.bp
index 0dfbd37..2407c51 100644
--- a/ci/Android.bp
+++ b/ci/Android.bp
@@ -25,7 +25,7 @@
"build_test_suites_test.py",
],
libs: [
- "build_test_suites",
+ "build_test_suites_lib",
"pyfakefs",
"ci_test_lib",
],
@@ -56,7 +56,7 @@
"build_test_suites_local_test.py",
],
libs: [
- "build_test_suites",
+ "build_test_suites_lib",
"pyfakefs",
"ci_test_lib",
],
@@ -79,7 +79,7 @@
"optimized_targets_test.py",
],
libs: [
- "build_test_suites",
+ "build_test_suites_lib",
"pyfakefs",
],
test_options: {
@@ -95,7 +95,7 @@
},
}
-python_library_host {
+python_binary_host {
name: "build_test_suites",
srcs: [
"build_test_suites.py",
@@ -104,6 +104,26 @@
"build_context.py",
"test_discovery_agent.py",
],
+ main: "build_test_suites.py",
+ version: {
+ py3: {
+ embedded_launcher: true,
+ },
+ },
+ libs: [
+ "soong-metrics-proto-py",
+ ],
+}
+
+python_library_host {
+ name: "build_test_suites_lib",
+ srcs: [
+ "build_test_suites.py",
+ "optimized_targets.py",
+ "test_mapping_module_retriever.py",
+ "build_context.py",
+ "test_discovery_agent.py",
+ ],
}
python_library_host {
diff --git a/ci/build_test_suites.py b/ci/build_test_suites.py
index b8c4a38..9e56a20 100644
--- a/ci/build_test_suites.py
+++ b/ci/build_test_suites.py
@@ -209,3 +209,7 @@
filename=log_file,
)
sys.exit(build_test_suites(argv))
+
+
+if __name__ == '__main__':
+ main(sys.argv[1:])
diff --git a/ci/test_discovery_agent.py b/ci/test_discovery_agent.py
index 89d35d7..4eed28d 100644
--- a/ci/test_discovery_agent.py
+++ b/ci/test_discovery_agent.py
@@ -11,18 +11,33 @@
# 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.
+"""Test discovery agent that uses TradeFed to discover test artifacts."""
+import glob
+import json
+import logging
+import os
+import subprocess
+import buildbot
+
+
class TestDiscoveryAgent:
"""Test discovery agent."""
- _AOSP_TRADEFED_PREBUILT_JAR_RELATIVE_PATH = (
- "tools/tradefederation/prebuilts/filegroups/tradefed/"
+ _TRADEFED_PREBUILT_JAR_RELATIVE_PATH = (
+ "vendor/google_tradefederation/prebuilts/filegroups/google-tradefed/"
)
+ _TRADEFED_NO_POSSIBLE_TEST_DISCOVERY_KEY = "NoPossibleTestDiscovery"
+
+ _TRADEFED_TEST_ZIP_REGEXES_LIST_KEY = "TestZipRegexes"
+
+ _TRADEFED_DISCOVERY_OUTPUT_FILE_NAME = "test_discovery_agent.txt"
+
def __init__(
self,
tradefed_args: list[str],
- test_mapping_zip_path: str,
- tradefed_jar_revelant_files_path: str = _AOSP_TRADEFED_PREBUILT_JAR_RELATIVE_PATH,
+ test_mapping_zip_path: str = "",
+ tradefed_jar_revelant_files_path: str = _TRADEFED_PREBUILT_JAR_RELATIVE_PATH,
):
self.tradefed_args = tradefed_args
self.test_mapping_zip_path = test_mapping_zip_path
@@ -34,7 +49,46 @@
Returns:
A list of test zip regexes that TF is going to try to pull files from.
"""
- return []
+ test_discovery_output_file_name = os.path.join(
+ buildbot.OutDir(), self._TRADEFED_DISCOVERY_OUTPUT_FILE_NAME
+ )
+ with open(
+ test_discovery_output_file_name, mode="w+t"
+ ) as test_discovery_output_file:
+ java_args = []
+ java_args.append("prebuilts/jdk/jdk21/linux-x86/bin/java")
+ java_args.append("-cp")
+ java_args.append(
+ self.create_classpath(self.tradefed_jar_relevant_files_path)
+ )
+ java_args.append(
+ "com.android.tradefed.observatory.TestZipDiscoveryExecutor"
+ )
+ java_args.extend(self.tradefed_args)
+ env = os.environ.copy()
+ env.update({"DISCOVERY_OUTPUT_FILE": test_discovery_output_file.name})
+ logging.info(f"Calling test discovery with args: {java_args}")
+ try:
+ result = subprocess.run(args=java_args, env=env, text=True, check=True)
+ logging.info(f"Test zip discovery output: {result.stdout}")
+ except subprocess.CalledProcessError as e:
+ raise TestDiscoveryError(
+ f"Failed to run test discovery, strout: {e.stdout}, strerr:"
+ f" {e.stderr}, returncode: {e.returncode}"
+ )
+ data = json.loads(test_discovery_output_file.read())
+ logging.info(f"Test discovery result file content: {data}")
+ if (
+ self._TRADEFED_NO_POSSIBLE_TEST_DISCOVERY_KEY in data
+ and data[self._TRADEFED_NO_POSSIBLE_TEST_DISCOVERY_KEY]
+ ):
+ raise TestDiscoveryError("No possible test discovery")
+ if (
+ data[self._TRADEFED_TEST_ZIP_REGEXES_LIST_KEY] is None
+ or data[self._TRADEFED_TEST_ZIP_REGEXES_LIST_KEY] is []
+ ):
+ raise TestDiscoveryError("No test zip regexes returned")
+ return data[self._TRADEFED_TEST_ZIP_REGEXES_LIST_KEY]
def discover_test_modules(self) -> list[str]:
"""Discover test modules from TradeFed.
@@ -44,3 +98,24 @@
TradeFed test args.
"""
return []
+
+ def create_classpath(self, directory):
+ """Creates a classpath string from all .jar files in the given directory.
+
+ Args:
+ directory: The directory to search for .jar files.
+
+ Returns:
+ A string representing the classpath, with jar files separated by the
+ OS-specific path separator (e.g., ':' on Linux/macOS, ';' on Windows).
+ """
+ jar_files = glob.glob(os.path.join(directory, "*.jar"))
+ return os.pathsep.join(jar_files)
+
+
+class TestDiscoveryError(Exception):
+ """A TestDiscoveryErrorclass."""
+
+ def __init__(self, message):
+ super().__init__(message)
+ self.message = message
diff --git a/core/Makefile b/core/Makefile
index 25429e7..5e0d4df 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -192,6 +192,34 @@
unique_product_copy_files_pairs :=
unique_product_copy_files_destinations :=
+
+# Returns a list of EXTRA_INSTALL_ZIPS trios whose primary file is contained within $(1)
+# The trios will contain the primary installed file : the directory to unzip the zip to : the zip
+define relevant-extra-install-zips
+$(strip $(foreach p,$(EXTRA_INSTALL_ZIPS), \
+ $(if $(filter $(call word-colon,1,$(p)),$(1)), \
+ $(p))))
+endef
+
+# Writes a text file that contains all of the files that will be inside a partition.
+# All the file paths will be relative to the partition's staging directory.
+# It will also take into account files inside zips listed in EXTRA_INSTALL_ZIPS.
+#
+# Arguments:
+# $(1): Output file
+# $(2): The partition's staging directory
+# $(3): Files to include in the partition
+define write-partition-file-list
+$(1): PRIVATE_FILES := $(subst $(2)/,,$(filter $(2)/%,$(3)))
+$(1): PRIVATE_EXTRA_INSTALL_ZIPS := $(call relevant-extra-install-zips,$(filter $(2)/%,$(3)))
+$(1): $$(HOST_OUT_EXECUTABLES)/extra_install_zips_file_list $(foreach p,$(call relevant-extra-install-zips,$(filter $(2)/%,$(3))),$(call word-colon,3,$(p)))
+ @echo Writing $$@
+ rm -f $$@
+ echo -n > $$@
+ $$(foreach f,$$(PRIVATE_FILES),echo "$$(f)" >> $$@$$(newline))
+ $$(HOST_OUT_EXECUTABLES)/extra_install_zips_file_list $(2) $$(PRIVATE_EXTRA_INSTALL_ZIPS) >> $$@
+endef
+
# -----------------------------------------------------------------
# Returns the max allowed size for an image suitable for hash verification
# (e.g., boot.img, recovery.img, etc).
@@ -692,7 +720,7 @@
BOARD_KERNEL_MODULE_DIRS += top
-# Default to not generating modules.dep for kernel modules on system
+# Default to not generating modules.load for kernel modules on system
# side. We should only load these modules if they are depended by vendor
# side modules.
ifeq ($(BOARD_SYSTEM_KERNEL_MODULES_LOAD),)
@@ -1267,6 +1295,10 @@
endif
+
+ramdisk_intermediates :=$= $(call intermediates-dir-for,PACKAGING,ramdisk)
+$(eval $(call write-partition-file-list,$(ramdisk_intermediates)/file_list.txt,$(TARGET_RAMDISK_OUT),$(INTERNAL_RAMDISK_FILES)))
+
# The value of RAMDISK_NODE_LIST is defined in system/core/rootdir/Android.bp.
# This file contains /dev nodes description added to the generic ramdisk
@@ -3472,33 +3504,6 @@
FULL_SYSTEMIMAGE_DEPS += $(INTERNAL_ROOT_FILES) $(INSTALLED_FILES_FILE_ROOT)
-# Returns a list of EXTRA_INSTALL_ZIPS trios whose primary file is contained within $(1)
-# The trios will contain the primary installed file : the directory to unzip the zip to : the zip
-define relevant-extra-install-zips
-$(strip $(foreach p,$(EXTRA_INSTALL_ZIPS), \
- $(if $(filter $(call word-colon,1,$(p)),$(1)), \
- $(p))))
-endef
-
-# Writes a text file that contains all of the files that will be inside a partition.
-# All the file paths will be relative to the partition's staging directory.
-# It will also take into account files inside zips listed in EXTRA_INSTALL_ZIPS.
-#
-# Arguments:
-# $(1): Output file
-# $(2): The partition's staging directory
-# $(3): Files to include in the partition
-define write-partition-file-list
-$(1): PRIVATE_FILES := $(subst $(2)/,,$(filter $(2)/%,$(3)))
-$(1): PRIVATE_EXTRA_INSTALL_ZIPS := $(call relevant-extra-install-zips,$(filter $(2)/%,$(3)))
-$(1): $$(HOST_OUT_EXECUTABLES)/extra_install_zips_file_list $(foreach p,$(call relevant-extra-install-zips,$(filter $(2)/%,$(3))),$(call word-colon,3,$(p)))
- @echo Writing $$@
- rm -f $$@
- echo -n > $$@
- $$(foreach f,$$(PRIVATE_FILES),echo "$$(f)" >> $$@$$(newline))
- $$(HOST_OUT_EXECUTABLES)/extra_install_zips_file_list $(2) $$(PRIVATE_EXTRA_INSTALL_ZIPS) >> $$@
-endef
-
# -----------------------------------------------------------------
ifdef BUILDING_SYSTEM_IMAGE
@@ -6383,6 +6388,10 @@
endif
endif
+ifdef BUILDING_VENDOR_KERNEL_BOOT_IMAGE
+ $(BUILT_TARGET_FILES_DIR): $(INTERNAL_VENDOR_KERNEL_RAMDISK_FILES)
+endif
+
ifdef BUILDING_RECOVERY_IMAGE
# TODO(b/30414428): Can't depend on INTERNAL_RECOVERYIMAGE_FILES alone like other
# BUILT_TARGET_FILES_PACKAGE dependencies because currently there're cp/rsync/rm
@@ -7976,7 +7985,7 @@
# -----------------------------------------------------------------
# Desktop pack recovery image hook.
-ifneq (,$(strip $(PACK_DESKTOP_RECOVERY_IMAGE)))
+ifeq ($(BOARD_USES_DESKTOP_RECOVERY_IMAGE),true)
PACK_RECOVERY_IMAGE_TARGET := $(PRODUCT_OUT)/android-desktop_recovery_image.bin
PACK_RECOVERY_IMAGE_ARGS := --noarchive --recovery
@@ -7997,11 +8006,11 @@
.PHONY: pack-recovery-image
pack-recovery-image: $(PACK_RECOVERY_IMAGE_TARGET)
-endif # PACK_DESKTOP_RECOVERY_IMAGE
+endif # BOARD_USES_DESKTOP_RECOVERY_IMAGE
# -----------------------------------------------------------------
# Desktop pack update image hook.
-ifneq (,$(strip $(PACK_DESKTOP_UPDATE_IMAGE)))
+ifeq ($(BOARD_USES_DESKTOP_UPDATE_IMAGE),true)
PACK_UPDATE_IMAGE_TARGET := $(PRODUCT_OUT)/android-desktop_update_image.bin
PACK_UPDATE_IMAGE_ARGS := --noarchive --update
@@ -8022,7 +8031,7 @@
.PHONY: pack-update-image
pack-update-image: $(PACK_UPDATE_IMAGE_TARGET)
-endif # PACK_DESKTOP_UPDATE_IMAGE
+endif # BOARD_USES_DESKTOP_UPDATE_IMAGE
PACK_MIGRATION_IMAGE_SCRIPT := $(HOST_OUT_EXECUTABLES)/pack_migration_image
diff --git a/core/android_soong_config_vars.mk b/core/android_soong_config_vars.mk
index 0607b71..769a6f7 100644
--- a/core/android_soong_config_vars.mk
+++ b/core/android_soong_config_vars.mk
@@ -39,6 +39,7 @@
$(call add_soong_config_var,ANDROID,TARGET_DYNAMIC_64_32_DRMSERVER)
$(call add_soong_config_var,ANDROID,TARGET_ENABLE_MEDIADRM_64)
$(call add_soong_config_var,ANDROID,TARGET_DYNAMIC_64_32_MEDIASERVER)
+$(call add_soong_config_var,ANDROID,BOARD_GENFS_LABELS_VERSION)
$(call add_soong_config_var,ANDROID,ADDITIONAL_M4DEFS,$(if $(BOARD_SEPOLICY_M4DEFS),$(addprefix -D,$(BOARD_SEPOLICY_M4DEFS))))
@@ -71,6 +72,11 @@
# The default value of ART_BUILD_HOST_DEBUG is true
$(call soong_config_set_bool,art_module,art_build_host_debug,$(if $(filter false,$(ART_BUILD_HOST_DEBUG)),false,true))
+# For chre
+$(call soong_config_set_bool,chre,chre_daemon_lama_enabled,$(if $(filter true,$(CHRE_DAEMON_LPMA_ENABLED)),true,false))
+$(call soong_config_set_bool,chre,chre_dedicated_transport_channel_enabled,$(if $(filter true,$(CHRE_DEDICATED_TRANSPORT_CHANNEL_ENABLED)),true,false))
+$(call soong_config_set_bool,chre,chre_log_atom_extension_enabled,$(if $(filter true,$(CHRE_LOG_ATOM_EXTENSION_ENABLED)),true,false))
+
ifdef TARGET_BOARD_AUTO
$(call add_soong_config_var_value, ANDROID, target_board_auto, $(TARGET_BOARD_AUTO))
endif
@@ -224,21 +230,6 @@
$(call soong_config_set_bool,google_graphics,board_uses_scaler_m2m1shot,$(if $(filter true,$(BOARD_USES_SCALER_M2M1SHOT)),true,false))
$(call soong_config_set_bool,google_graphics,board_uses_align_restriction,$(if $(filter true,$(BOARD_USES_ALIGN_RESTRICTION)),true,false))
-# Export video_codec variables to soong for exynos modules
-$(call soong_config_set,video_codec,target_soc_name,$(TARGET_SOC_NAME))
-$(call soong_config_set_bool,video_codec,board_use_codec2_hidl_1_2,$(if $(filter true,$(BOARD_USE_CODEC2_HIDL_1_2)),true,false))
-$(call soong_config_set_bool,video_codec,board_support_mfc_enc_bt2020,$(if $(filter true,$(BOARD_SUPPORT_MFC_ENC_BT2020)),true,false))
-$(call soong_config_set_bool,video_codec,board_support_flexible_p010,$(if $(filter true,$(BOARD_SUPPORT_FLEXIBLE_P010)),true,false))
-$(call soong_config_set_bool,video_codec,board_use_codec2_aidl,$(if $(BOARD_USE_CODEC2_AIDL),true,false))
-$(call soong_config_set,video_codec,board_gpu_type,$(BOARD_GPU_TYPE))
-$(call soong_config_set_bool,video_codec,board_use_small_secure_memory,$(if $(filter true,$(BOARD_USE_SMALL_SECURE_MEMORY)),true,false))
-ifdef BOARD_SUPPORT_MFC_VERSION
- $(call soong_config_set,video_codec,board_support_mfc_version,$(BOARD_SUPPORT_MFC_VERSION))
-endif
-ifdef BOARD_USE_MAX_SECURE_RESOURCE
- $(call soong_config_set,video_codec,board_use_max_secure_resource,$(BOARD_USE_MAX_SECURE_RESOURCE))
-endif
-
# Export related variables to soong for hardware/google/graphics/common/libacryl:libacryl
ifdef BOARD_LIBACRYL_DEFAULT_COMPOSITOR
$(call soong_config_set,acryl,libacryl_default_compositor,$(BOARD_LIBACRYL_DEFAULT_COMPOSITOR))
@@ -263,3 +254,11 @@
$(call soong_config_set_bool,google_graphics,board_uses_decon_64bit_address,$(if $(filter true,$(BOARD_USES_DECON_64BIT_ADDRESS)),true,false))
$(call soong_config_set_bool,google_graphics,board_uses_hdrui_gles_conversion,$(if $(filter true,$(BOARD_USES_HDRUI_GLES_CONVERSION)),true,false))
$(call soong_config_set_bool,google_graphics,uses_idisplay_intf_sec,$(if $(filter true,$(USES_IDISPLAY_INTF_SEC)),true,false))
+
+# Variables for fs_config
+$(call soong_config_set_bool,fs_config,vendor,$(if $(BOARD_USES_VENDORIMAGE)$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),true,false))
+$(call soong_config_set_bool,fs_config,oem,$(if $(BOARD_USES_OEMIMAGE)$(BOARD_OEMIMAGE_FILE_SYSTEM_TYPE),true,false))
+$(call soong_config_set_bool,fs_config,odm,$(if $(BOARD_USES_ODMIMAGE)$(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE),true,false))
+$(call soong_config_set_bool,fs_config,vendor_dlkm,$(if $(BOARD_USES_VENDOR_DLKMIMAGE)$(BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE),true,false))
+$(call soong_config_set_bool,fs_config,odm_dlkm,$(if $(BOARD_USES_ODM_DLKMIMAGE)$(BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE),true,false))
+$(call soong_config_set_bool,fs_config,system_dlkm,$(if $(BOARD_USES_SYSTEM_DLKMIMAGE)$(BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE),true,false))
diff --git a/core/board_config.mk b/core/board_config.mk
index 38baa0a..ea0d022 100644
--- a/core/board_config.mk
+++ b/core/board_config.mk
@@ -924,6 +924,18 @@
endif
.KATI_READONLY := BOARD_USES_PVMFWIMAGE
+BOARD_USES_DESKTOP_RECOVERY_IMAGE :=
+ifeq ($(PRODUCT_BUILD_DESKTOP_RECOVERY_IMAGE),true)
+ BOARD_USES_DESKTOP_RECOVERY_IMAGE := true
+endif
+.KATI_READONLY := BOARD_USES_DESKTOP_RECOVERY_IMAGE
+
+BOARD_USES_DESKTOP_UPDATE_IMAGE :=
+ifeq ($(PRODUCT_BUILD_DESKTOP_UPDATE_IMAGE),true)
+ BOARD_USES_DESKTOP_UPDATE_IMAGE := true
+endif
+.KATI_READONLY := BOARD_USES_DESKTOP_UPDATE_IMAGE
+
###########################################
# Ensure consistency among TARGET_RECOVERY_UPDATER_LIBS, AB_OTA_UPDATER, and PRODUCT_OTA_FORCE_NON_AB_PACKAGE.
TARGET_RECOVERY_UPDATER_LIBS ?=
diff --git a/core/config.mk b/core/config.mk
index f9ba38c..485e8cc 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -894,6 +894,11 @@
PLATFORM_SEPOLICY_COMPAT_VERSIONS \
PLATFORM_SEPOLICY_VERSION \
+BOARD_GENFS_LABELS_VERSION ?= $(BOARD_API_LEVEL)
+ifeq ($(call math_gt,$(BOARD_API_LEVEL),$(BOARD_GENFS_LABELS_VERSION)),true)
+ $(error BOARD_GENFS_LABELS_VERSION ($(BOARD_GENFS_LABELS_VERSION)) must be greater than or equal to BOARD_API_LEVEL ($(BOARD_API_LEVEL)))
+endif
+
ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
ifneq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true)
$(error PRODUCT_USE_DYNAMIC_PARTITIONS must be true when PRODUCT_RETROFIT_DYNAMIC_PARTITIONS \
diff --git a/core/layoutlib_data.mk b/core/layoutlib_data.mk
index e420a00..06735df 100644
--- a/core/layoutlib_data.mk
+++ b/core/layoutlib_data.mk
@@ -31,8 +31,18 @@
$(hide) mkdir -p $(dir $@)
$(hide) cp -vf $< $@
-# List of all data files - font files, font configuration files, key character map files
-LAYOUTLIB_FILES := $(fonts_device) $(font_config) $(keyboards)
+HYPHEN_TEMP := $(call intermediates-dir-for,PACKAGING,hyphen,HOST,COMMON)
+
+# The hyphenation pattern files needed to support text hyphenation
+hyphen := $(filter $(TARGET_OUT)/usr/hyphen-data/%.hyb, $(INTERNAL_SYSTEMIMAGE_FILES))
+hyphen := $(addprefix $(HYPHEN_TEMP)/, $(notdir $(hyphen)))
+
+$(hyphen): $(HYPHEN_TEMP)/%: $(TARGET_OUT)/usr/hyphen-data/%
+ $(hide) mkdir -p $(dir $@)
+ $(hide) cp -vf $< $@
+
+# List of all data files - font files, font configuration files, key character map files, hyphenation pattern files
+LAYOUTLIB_FILES := $(fonts_device) $(font_config) $(keyboards) $(hyphen)
.PHONY: layoutlib layoutlib-tests
layoutlib layoutlib-tests: $(LAYOUTLIB_FILES)
@@ -40,6 +50,7 @@
$(call dist-for-goals, layoutlib, $(foreach m,$(fonts_device), $(m):layoutlib_native/fonts/$(notdir $(m))))
$(call dist-for-goals, layoutlib, $(foreach m,$(font_config), $(m):layoutlib_native/fonts/$(notdir $(m))))
$(call dist-for-goals, layoutlib, $(foreach m,$(keyboards), $(m):layoutlib_native/keyboards/$(notdir $(m))))
+$(call dist-for-goals, layoutlib, $(foreach m,$(hyphen), $(m):layoutlib_native/hyphen-data/$(notdir $(m))))
FONT_TEMP :=
font_config :=
diff --git a/core/main.mk b/core/main.mk
index 30ff0cc..f96cf04 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -277,11 +277,24 @@
# Include all of the makefiles in the system
#
-subdir_makefiles := $(SOONG_OUT_DIR)/installs-$(TARGET_PRODUCT)$(COVERAGE_SUFFIX).mk $(SOONG_ANDROID_MK)
+subdir_makefiles := \
+ $(SOONG_OUT_DIR)/installs-$(TARGET_PRODUCT)$(COVERAGE_SUFFIX).mk \
+ $(SOONG_ANDROID_MK) \
+ build/make/target/board/android-info.mk
# Android.mk files are only used on Linux builds, Mac only supports Android.bp
ifeq ($(HOST_OS),linux)
- subdir_makefiles += $(file <$(OUT_DIR)/.module_paths/Android.mk.list)
+ ifeq ($(PRODUCT_IGNORE_ALL_ANDROIDMK),true)
+ allowed_androidmk_files :=
+ ifdef PRODUCT_ANDROIDMK_ALLOWLIST_FILE
+ -include $(PRODUCT_ANDROIDMK_ALLOWLIST_FILE)
+ endif
+ allowed_androidmk_files += $(PRODUCT_ALLOWED_ANDROIDMK_FILES)
+ subdir_makefiles += $(filter $(allowed_androidmk_files),$(file <$(OUT_DIR)/.module_paths/Android.mk.list))
+ allowed_androidmk_files :=
+ else
+ subdir_makefiles += $(file <$(OUT_DIR)/.module_paths/Android.mk.list)
+ endif
endif
subdir_makefiles += $(SOONG_OUT_DIR)/late-$(TARGET_PRODUCT)$(COVERAGE_SUFFIX).mk
@@ -984,9 +997,7 @@
# variables being set.
define auto-included-modules
$(foreach vndk_ver,$(PRODUCT_EXTRA_VNDK_VERSIONS),com.android.vndk.v$(vndk_ver)) \
- $(filter-out $(LLNDK_MOVED_TO_APEX_LIBRARIES),$(LLNDK_LIBRARIES)) \
llndk.libraries.txt \
- $(if $(DEVICE_MANIFEST_FILE),vendor_manifest.xml) \
$(if $(DEVICE_MANIFEST_SKUS),$(foreach sku, $(DEVICE_MANIFEST_SKUS),vendor_manifest_$(sku).xml)) \
$(if $(ODM_MANIFEST_FILES),odm_manifest.xml) \
$(if $(ODM_MANIFEST_SKUS),$(foreach sku, $(ODM_MANIFEST_SKUS),odm_manifest_$(sku).xml)) \
diff --git a/core/product.mk b/core/product.mk
index 8fc40f8..9c567c3 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -366,6 +366,8 @@
_product_single_value_vars += PRODUCT_BUILD_VBMETA_IMAGE
_product_single_value_vars += PRODUCT_BUILD_SUPER_EMPTY_IMAGE
_product_single_value_vars += PRODUCT_BUILD_PVMFW_IMAGE
+_product_single_value_vars += PRODUCT_BUILD_DESKTOP_RECOVERY_IMAGE
+_product_single_value_vars += PRODUCT_BUILD_DESKTOP_UPDATE_IMAGE
# List of boot jars delivered via updatable APEXes, following the same format as
# PRODUCT_BOOT_JARS.
@@ -490,6 +492,13 @@
# should be included in the system_linker_config.
_product_list_vars += PRODUCT_EXTRA_STUB_LIBRARIES
+# If set to true, all Android.mk files will be ignored.
+_product_single_value_vars += PRODUCT_IGNORE_ALL_ANDROIDMK
+# When PRODUCT_IGNORE_ALL_ANDROIDMK is set to true, this variable will be used to allow some Android.mk files.
+_product_list_vars += PRODUCT_ALLOWED_ANDROIDMK_FILES
+# When PRODUCT_IGNORE_ALL_ANDROIDMK is set to true, path of file that contains a list of allowed Android.mk files
+_product_single_value_vars += PRODUCT_ANDROIDMK_ALLOWLIST_FILE
+
.KATI_READONLY := _product_single_value_vars _product_list_vars
_product_var_list :=$= $(_product_single_value_vars) $(_product_list_vars)
diff --git a/core/product_config.mk b/core/product_config.mk
index 3e1f120..abe6e38 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -424,10 +424,12 @@
endif
endif
-$(foreach pair,$(PRODUCT_APEX_BOOT_JARS), \
- $(eval jar := $(call word-colon,2,$(pair))) \
- $(if $(findstring $(jar), $(PRODUCT_BOOT_JARS)), \
- $(error A jar in PRODUCT_APEX_BOOT_JARS must not be in PRODUCT_BOOT_JARS, but $(jar) is)))
+$(foreach apexpair,$(PRODUCT_APEX_BOOT_JARS), \
+ $(foreach platformpair,$(PRODUCT_BOOT_JARS), \
+ $(eval apexjar := $(call word-colon,2,$(apexpair))) \
+ $(eval platformjar := $(call word-colon,2,$(platformpair))) \
+ $(if $(filter $(apexjar), $(platformjar)), \
+ $(error A jar in PRODUCT_APEX_BOOT_JARS must not be in PRODUCT_BOOT_JARS, but $(apexjar) is))))
ENFORCE_SYSTEM_CERTIFICATE := $(PRODUCT_ENFORCE_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT)
ENFORCE_SYSTEM_CERTIFICATE_ALLOW_LIST := $(PRODUCT_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT_ALLOW_LIST)
diff --git a/core/robolectric_test_config_template.xml b/core/robolectric_test_config_template.xml
index 257c820..1956b6e 100644
--- a/core/robolectric_test_config_template.xml
+++ b/core/robolectric_test_config_template.xml
@@ -22,6 +22,13 @@
<option name="exclude-paths" value="java" />
<option name="use-robolectric-resources" value="true" />
+ <!-- attempt to always show Tradefed errors -->
+ <option name="do-not-swallow-runner-errors" value="true" />
+
+ <!-- prevent Tradefed from hanging indefinitely in CI -->
+ <option name="socket-timeout" value="600000" />
+ <option name="test-case-timeout" value="2m" />
+
{EXTRA_CONFIGS}
<test class="com.android.tradefed.testtype.IsolatedHostTest" >
diff --git a/core/soong_config.mk b/core/soong_config.mk
index cc77b53..ee6a9f6 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -183,12 +183,16 @@
$(call add_json_bool, Uml, $(filter true,$(TARGET_USER_MODE_LINUX)))
$(call add_json_str, VendorPath, $(TARGET_COPY_OUT_VENDOR))
+$(call add_json_str, VendorDlkmPath, $(TARGET_COPY_OUT_VENDOR_DLKM))
$(call add_json_bool, BuildingVendorImage, $(BUILDING_VENDOR_IMAGE))
$(call add_json_str, OdmPath, $(TARGET_COPY_OUT_ODM))
$(call add_json_bool, BuildingOdmImage, $(BUILDING_ODM_IMAGE))
+$(call add_json_str, OdmDlkmPath, $(TARGET_COPY_OUT_ODM_DLKM))
$(call add_json_str, ProductPath, $(TARGET_COPY_OUT_PRODUCT))
$(call add_json_bool, BuildingProductImage, $(BUILDING_PRODUCT_IMAGE))
$(call add_json_str, SystemExtPath, $(TARGET_COPY_OUT_SYSTEM_EXT))
+$(call add_json_str, SystemDlkmPath, $(TARGET_COPY_OUT_SYSTEM_DLKM))
+$(call add_json_str, OemPath, $(TARGET_COPY_OUT_OEM))
$(call add_json_bool, MinimizeJavaDebugInfo, $(filter true,$(PRODUCT_MINIMIZE_JAVA_DEBUG_INFO)))
$(call add_json_bool, UseGoma, $(filter-out false,$(USE_GOMA)))
@@ -271,10 +275,6 @@
$(call add_json_bool, CompressedApex, $(filter true,$(PRODUCT_COMPRESSED_APEX)))
-ifndef APEX_BUILD_FOR_PRE_S_DEVICES
-$(call add_json_bool, TrimmedApex, $(filter true,$(PRODUCT_TRIMMED_APEX)))
-endif
-
$(call add_json_bool, BoardUsesRecoveryAsBoot, $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
$(call add_json_list, BoardKernelBinaries, $(BOARD_KERNEL_BINARIES))
@@ -421,6 +421,21 @@
$(call add_json_str, BoardExt4ShareDupBlocks, $(BOARD_EXT4_SHARE_DUP_BLOCKS))
$(call add_json_str, BoardFlashLogicalBlockSize, $(BOARD_FLASH_LOGICAL_BLOCK_SIZE))
$(call add_json_str, BoardFlashEraseBlockSize, $(BOARD_FLASH_ERASE_BLOCK_SIZE))
+ $(call add_json_bool, BuildingVbmetaImage, $(BUILDING_VBMETA_IMAGE))
+ $(call add_json_bool, BoardAvbEnable, $(filter true,$(BOARD_AVB_ENABLE)))
+ $(call add_json_str, BoardAvbAlgorithm, $(BOARD_AVB_ALGORITHM))
+ $(call add_json_str, BoardAvbKeyPath, $(BOARD_AVB_KEY_PATH))
+ $(call add_json_str, BoardAvbRollbackIndex, $(BOARD_AVB_ROLLBACK_INDEX))
+ $(call add_json_map, ChainedVbmetaPartitions)
+ $(foreach partition,system vendor $(BOARD_AVB_VBMETA_CUSTOM_PARTITIONS),\
+ $(call add_json_map, $(partition)) \
+ $(call add_json_list,Partitions,$(BOARD_AVB_VBMETA_$(call to-upper,$(partition)))) \
+ $(call add_json_str,Key,$(BOARD_AVB_VBMETA_$(call to-upper,$(partition))_KEY_PATH)) \
+ $(call add_json_str,Algorithm,$(BOARD_AVB_VBMETA_$(call to-upper,$(partition))_ALGORITHM)) \
+ $(call add_json_str,RollbackIndex,$(BOARD_AVB_VBMETA_$(call to-upper,$(partition))_ROLLBACK_INDEX)) \
+ $(call add_json_str,RollbackIndexLocation,$(BOARD_AVB_VBMETA_$(call to-upper,$(partition))_ROLLBACK_INDEX_LOCATION)) \
+ $(call end_json_map))
+ $(call end_json_map)
$(call add_json_bool, BoardUsesRecoveryAsBoot, $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
$(call add_json_bool, ProductUseDynamicPartitionSize, $(filter true,$(PRODUCT_USE_DYNAMIC_PARTITION_SIZE)))
@@ -436,11 +451,20 @@
# Used to generate _dlkm partitions
$(call add_json_bool, BuildingSystemDlkmImage, $(BUILDING_SYSTEM_DLKM_IMAGE))
$(call add_json_list, SystemKernelModules, $(BOARD_SYSTEM_KERNEL_MODULES))
+ $(call add_json_str, SystemKernelBlocklistFile, $(BOARD_SYSTEM_KERNEL_MODULES_BLOCKLIST_FILE))
+ $(call add_json_list, SystemKernelLoadModules, $(BOARD_SYSTEM_KERNEL_MODULES_LOAD))
+ $(call add_json_bool, BuildingVendorDlkmImage, $(BUILDING_VENDOR_DLKM_IMAGE))
+ $(call add_json_list, VendorKernelModules, $(BOARD_VENDOR_KERNEL_MODULES))
+ $(call add_json_str, VendorKernelBlocklistFile, $(BOARD_VENDOR_KERNEL_MODULES_BLOCKLIST_FILE))
+ $(call add_json_bool, BuildingOdmDlkmImage, $(BUILDING_ODM_DLKM_IMAGE))
+ $(call add_json_list, OdmKernelModules, $(BOARD_ODM_KERNEL_MODULES))
+ $(call add_json_str, OdmKernelBlocklistFile, $(BOARD_ODM_KERNEL_MODULES_BLOCKLIST_FILE))
- $(call add_json_map, ProductCopyFiles)
- $(foreach pair,$(PRODUCT_COPY_FILES),\
- $(call add_json_str,$(word 1,$(subst :, ,$(pair))),$(word 2,$(subst :, ,$(pair)))))
- $(call end_json_map)
+ # Used to generate /vendor/build.prop
+ $(call add_json_list, BoardInfoFiles, $(if $(TARGET_BOARD_INFO_FILES),$(TARGET_BOARD_INFO_FILES),$(firstword $(TARGET_BOARD_INFO_FILE) $(wildcard $(TARGET_DEVICE_DIR)/board-info.txt))))
+ $(call add_json_str, BootLoaderBoardName, $(TARGET_BOOTLOADER_BOARD_NAME))
+
+ $(call add_json_list, ProductCopyFiles, $(PRODUCT_COPY_FILES))
$(call end_json_map)
diff --git a/core/sysprop.mk b/core/sysprop.mk
index dc6f2c4..255b699 100644
--- a/core/sysprop.mk
+++ b/core/sysprop.mk
@@ -281,51 +281,17 @@
# ----------------------------------------------------------------
# vendor_dlkm/etc/build.prop
-#
+# odm_dlkm/etc/build.prop
+# system_dlkm/build.prop
+# These are built by Soong. See build/soong/Android.bp
INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR_DLKM)/etc/build.prop
-$(eval $(call build-properties,\
- vendor_dlkm,\
- $(INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET),\
- $(empty),\
- $(empty),\
- $(empty),\
- $(empty),\
- $(empty)))
-
-$(eval $(call declare-1p-target,$(INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET)))
-
-# ----------------------------------------------------------------
-# odm_dlkm/etc/build.prop
-#
-
INSTALLED_ODM_DLKM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM_DLKM)/etc/build.prop
-$(eval $(call build-properties,\
- odm_dlkm,\
- $(INSTALLED_ODM_DLKM_BUILD_PROP_TARGET),\
- $(empty),\
- $(empty),\
- $(empty),\
- $(empty),\
- $(empty)))
-
-$(eval $(call declare-1p-target,$(INSTALLED_ODM_DLKM_BUILD_PROP_TARGET)))
-
-# ----------------------------------------------------------------
-# system_dlkm/build.prop
-#
-
INSTALLED_SYSTEM_DLKM_BUILD_PROP_TARGET := $(TARGET_OUT_SYSTEM_DLKM)/etc/build.prop
-$(eval $(call build-properties,\
- system_dlkm,\
- $(INSTALLED_SYSTEM_DLKM_BUILD_PROP_TARGET),\
- $(empty),\
- $(empty),\
- $(empty),\
- $(empty),\
- $(empty)))
-
-$(eval $(call declare-1p-target,$(INSTALLED_SYSTEM_DLKM_BUILD_PROP_TARGET)))
+ALL_DEFAULT_INSTALLED_MODULES += \
+ $(INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET) \
+ $(INSTALLED_ODM_DLKM_BUILD_PROP_TARGET) \
+ $(INSTALLED_SYSTEM_DLKM_BUILD_PROP_TARGET) \
# -----------------------------------------------------------------
# system_ext/etc/build.prop
@@ -335,22 +301,12 @@
INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET := $(TARGET_OUT_SYSTEM_EXT)/etc/build.prop
-# ----------------------------------------------------------------
-# ramdisk/boot/etc/build.prop
-#
-
RAMDISK_BUILD_PROP_REL_PATH := system/etc/ramdisk/build.prop
+ifeq (true,$(BOARD_USES_RECOVERY_AS_BOOT))
+INSTALLED_RAMDISK_BUILD_PROP_TARGET := $(TARGET_RECOVERY_ROOT_OUT)/first_stage_ramdisk/$(RAMDISK_BUILD_PROP_REL_PATH)
+else
INSTALLED_RAMDISK_BUILD_PROP_TARGET := $(TARGET_RAMDISK_OUT)/$(RAMDISK_BUILD_PROP_REL_PATH)
-$(eval $(call build-properties,\
- bootimage,\
- $(INSTALLED_RAMDISK_BUILD_PROP_TARGET),\
- $(empty),\
- $(empty),\
- $(empty),\
- $(empty),\
- $(empty)))
-
-$(eval $(call declare-1p-target,$(INSTALLED_RAMDISK_BUILD_PROP_TARGET)))
+endif
ALL_INSTALLED_BUILD_PROP_FILES := \
$(INSTALLED_BUILD_PROP_TARGET) \
diff --git a/target/board/Android.mk b/target/board/android-info.mk
similarity index 100%
rename from target/board/Android.mk
rename to target/board/android-info.mk
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index eb4d497..3a7256e 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -18,6 +18,7 @@
PRODUCT_PACKAGES += \
abx \
aconfigd \
+ aconfigd-system \
adbd_system_api \
aflags \
am \
@@ -96,6 +97,7 @@
enhanced-confirmation.xml \
ExtShared \
flags_health_check \
+ framework-connectivity-b \
framework-graphics \
framework-location \
framework-minus-apex \
@@ -211,6 +213,7 @@
libwilhelm \
linker \
llkd \
+ llndk_libs \
lmkd \
LocalTransport \
locksettings \
@@ -350,6 +353,11 @@
com.android.ranging
endif
+ifeq ($(RELEASE_MEMORY_MANAGEMENT_DAEMON),true)
+ PRODUCT_PACKAGES += \
+ mm_daemon
+endif
+
# VINTF data for system image
PRODUCT_PACKAGES += \
system_manifest.xml \
diff --git a/target/product/base_vendor.mk b/target/product/base_vendor.mk
index b4e450e..16fc7fd 100644
--- a/target/product/base_vendor.mk
+++ b/target/product/base_vendor.mk
@@ -106,6 +106,7 @@
# VINTF data for vendor image
PRODUCT_PACKAGES += \
vendor_compatibility_matrix.xml \
+ vendor_manifest.xml \
# Base modules and settings for the debug ramdisk, which is then packed
# into a boot-debug.img and a vendor_boot-debug.img.
diff --git a/target/product/build_variables.mk b/target/product/build_variables.mk
index 9fc9ff9..7661e06 100644
--- a/target/product/build_variables.mk
+++ b/target/product/build_variables.mk
@@ -22,3 +22,6 @@
# Use the configured release of sqlite
$(call soong_config_set, libsqlite3, release_package_libsqlite3, $(RELEASE_PACKAGE_LIBSQLITE3))
+
+# Use the configured MessageQueue implementation
+$(call soong_config_set, messagequeue, release_package_messagequeue_implementation, $(RELEASE_PACKAGE_MESSAGEQUEUE_IMPLEMENTATION))
diff --git a/target/product/default_art_config.mk b/target/product/default_art_config.mk
index 668f054..83d9215 100644
--- a/target/product/default_art_config.mk
+++ b/target/product/default_art_config.mk
@@ -51,6 +51,7 @@
framework-minus-apex \
framework-graphics \
framework-location \
+ framework-connectivity-b \
ext \
telephony-common \
voip-common \
diff --git a/target/product/generic/Android.bp b/target/product/generic/Android.bp
index 84db9e1..ea49af4 100644
--- a/target/product/generic/Android.bp
+++ b/target/product/generic/Android.bp
@@ -1,4 +1,4 @@
-android_rootdirs = [
+generic_rootdirs = [
"acct",
"apex",
"bootstrap-apex",
@@ -15,19 +15,22 @@
"oem",
"postinstall",
"proc",
- "product",
"second_stage_resources",
"storage",
"sys",
"system",
"system_dlkm",
- "system_ext",
"tmp",
"vendor",
"vendor_dlkm",
]
-android_symlinks = [
+android_rootdirs = [
+ "system_ext",
+ "product",
+]
+
+generic_symlinks = [
{
target: "/system/bin/init",
name: "init",
@@ -41,18 +44,10 @@
name: "bin",
},
{
- target: "/product",
- name: "system/product",
- },
- {
target: "/vendor",
name: "system/vendor",
},
{
- target: "/system_ext",
- name: "system/system_ext",
- },
- {
target: "/system_dlkm/lib/modules",
name: "system/lib/modules",
},
@@ -121,6 +116,17 @@
},
]
+android_symlinks = [
+ {
+ target: "/product",
+ name: "system/product",
+ },
+ {
+ target: "/system_ext",
+ name: "system/system_ext",
+ },
+]
+
filegroup {
name: "generic_system_sign_key",
srcs: [":avb_testkey_rsa4096"],
@@ -340,15 +346,22 @@
],
}
-android_system_image {
- name: "generic_system_image",
+filegroup {
+ name: "system_image_erofs_compress_hints.txt",
+ srcs: ["erofs_compress_hints.txt"],
+}
+android_filesystem_defaults {
+ name: "system_image_defaults",
partition_name: "system",
base_dir: "system",
- dirs: android_rootdirs,
- symlinks: android_symlinks,
+ dirs: generic_rootdirs,
+ symlinks: generic_symlinks,
file_contexts: ":plat_file_contexts",
- linker_config_src: ":system_linker_config_json_file",
+ linker_config: {
+ gen_linker_config: true,
+ linker_config_srcs: [":system_linker_config_json_file"],
+ },
fsverity: {
inputs: [
"etc/boot-image.prof",
@@ -364,7 +377,7 @@
type: "erofs",
erofs: {
compressor: "lz4hc,9",
- compress_hints: "erofs_compress_hints.txt",
+ compress_hints: ":system_image_erofs_compress_hints.txt",
},
build_logtags: true,
gen_aconfig_flags_pb: true,
@@ -379,6 +392,7 @@
deps: [
"abx",
"aconfigd",
+ "aconfigd-system",
"aflags",
"am",
"android.software.credentials.prebuilt.xml", // generic_system
@@ -563,6 +577,11 @@
"trace_redactor", // base_system (RELEASE_PACKAGE_PROFILING_MODULE)
],
default: [],
+ }) + select(release_flag("RELEASE_MEMORY_MANAGEMENT_DAEMON"), {
+ true: [
+ "mm_daemon", // base_system (RELEASE_MEMORY_MANAGEMENT_DAEMON)
+ ],
+ default: [],
}) + select(product_variable("debuggable"), {
true: [
"adevice_fingerprint",
@@ -696,6 +715,7 @@
"framework-graphics", // base_system
"framework-location", // base_system
"framework-minus-apex-install-dependencies", // base_system
+ "framework-connectivity-b", // base_system
"framework_compatibility_matrix.device.xml",
"generic_system_fonts", // ok
"hwservicemanager_compat_symlink_module", // base_system
@@ -863,3 +883,10 @@
},
},
}
+
+android_system_image {
+ name: "generic_system_image",
+ defaults: ["system_image_defaults"],
+ dirs: android_rootdirs,
+ symlinks: android_symlinks,
+}
diff --git a/target/product/generic_ramdisk.mk b/target/product/generic_ramdisk.mk
index ebac62f..5ecb55f 100644
--- a/target/product/generic_ramdisk.mk
+++ b/target/product/generic_ramdisk.mk
@@ -23,6 +23,7 @@
PRODUCT_PACKAGES += \
init_first_stage \
snapuserd_ramdisk \
+ ramdisk-build.prop \
# Debug ramdisk
PRODUCT_PACKAGES += \
@@ -35,8 +36,6 @@
_my_paths := \
$(TARGET_COPY_OUT_RAMDISK)/ \
$(TARGET_COPY_OUT_DEBUG_RAMDISK)/ \
- system/usr/share/zoneinfo/tz_version \
- system/usr/share/zoneinfo/tzdata \
$(TARGET_COPY_OUT_RECOVERY)/root/first_stage_ramdisk/system \
diff --git a/target/product/gsi/Android.bp b/target/product/gsi/Android.bp
index f18f35a..1b8f2d7 100644
--- a/target/product/gsi/Android.bp
+++ b/target/product/gsi/Android.bp
@@ -61,3 +61,139 @@
system_ext_specific: true,
relative_install_path: "gsi",
}
+
+gsi_symlinks = [
+ {
+ target: "/system/system_ext",
+ name: "system_ext",
+ },
+ {
+ target: "/system/product",
+ name: "product",
+ },
+]
+
+android_system_image {
+ name: "android_gsi",
+ defaults: ["system_image_defaults"],
+ symlinks: gsi_symlinks,
+ deps: [
+ ///////////////////////////////////////////
+ // gsi_system_ext
+ ///////////////////////////////////////////
+
+ // handheld packages
+ "Launcher3QuickStep",
+ "Provision",
+ "Settings",
+ "StorageManager",
+ "SystemUI",
+
+ // telephony packages
+ "CarrierConfig",
+
+ // Install a copy of the debug policy to the system_ext partition, and allow
+ // init-second-stage to load debug policy from system_ext.
+ // This option is only meant to be set by compliance GSI targets.
+ "system_ext_userdebug_plat_sepolicy.cil",
+
+ ///////////////////////////////////////////
+ // base_system_ext
+ ///////////////////////////////////////////
+ "build_flag_system_ext",
+ "fs_config_dirs_system_ext",
+ "fs_config_files_system_ext",
+ "group_system_ext",
+ "passwd_system_ext",
+ "SatelliteClient",
+ "selinux_policy_system_ext",
+ "system_ext_manifest.xml",
+ "system_ext-build.prop",
+ // Base modules when shipping api level is less than or equal to 34
+ "hwservicemanager",
+ "android.hidl.allocator@1.0-service",
+
+ ///////////////////////////////////////////
+ // window_extensions_base
+ ///////////////////////////////////////////
+ "androidx.window.extensions",
+ "androidx.window.sidecar",
+
+ ///////////////////////////////////////////
+ // gsi_release
+ ///////////////////////////////////////////
+ "gsi_skip_mount.cfg",
+ "init.gsi.rc",
+ "init.vndk-nodef.rc",
+ // Overlay the GSI specific setting for framework and SystemUI
+ "gsi_overlay_framework",
+ "gsi_overlay_systemui",
+
+ ///////////////////////////////////////////
+ // VNDK
+ ///////////////////////////////////////////
+ "com.android.vndk.v30",
+ "com.android.vndk.v31",
+ "com.android.vndk.v32",
+ "com.android.vndk.v33",
+ "com.android.vndk.v34",
+
+ ///////////////////////////////////////////
+ // AVF
+ ///////////////////////////////////////////
+ "com.android.compos",
+ "features_com.android.virt.xml",
+
+ ///////////////////////////////////////////
+ // gsi_product
+ ///////////////////////////////////////////
+ "Browser2",
+ "Camera2",
+ "Dialer",
+ "LatinIME",
+ "apns-full-conf.xml",
+
+ ///////////////////////////////////////////
+ // media_product
+ ///////////////////////////////////////////
+ "webview",
+
+ ///////////////////////////////////////////
+ // base_product
+ ///////////////////////////////////////////
+
+ // Base modules and settings for the product partition.
+ "build_flag_product",
+ "fs_config_dirs_product",
+ "fs_config_files_product",
+ "group_product",
+ "ModuleMetadata",
+ "passwd_product",
+ "product_compatibility_matrix.xml",
+ "product_manifest.xml",
+ "selinux_policy_product",
+ "product-build.prop",
+
+ // AUDIO
+ "frameworks_sounds",
+
+ ///////////////////////////////////////////
+ // base_system
+ ///////////////////////////////////////////
+ "charger",
+ ] + select(product_variable("debuggable"), {
+ // Packages included only for eng or userdebug builds, previously debug tagged
+ true: ["adb_keys"],
+ default: [],
+ }),
+ multilib: {
+ both: {
+ // PRODUCT_PACKAGES_SHIPPING_API_LEVEL_34
+ deps: ["android.hidl.memory@1.0-impl"],
+ },
+ },
+ enabled: select(soong_config_variable("ANDROID", "PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT"), {
+ "true": true,
+ default: false,
+ }),
+}
diff --git a/target/product/security/Android.bp b/target/product/security/Android.bp
index 69d19a3..ffbec06 100644
--- a/target/product/security/Android.bp
+++ b/target/product/security/Android.bp
@@ -40,4 +40,5 @@
adb_keys {
name: "adb_keys",
+ product_specific: true,
}
diff --git a/teams/Android.bp b/teams/Android.bp
index 21f5222..6307f5c 100644
--- a/teams/Android.bp
+++ b/teams/Android.bp
@@ -70,13 +70,6 @@
}
team {
- name: "trendy_team_wear_wear_cloud_platform",
-
- // go/trendy/manage/engineers/5917762526281728
- trendy_team_id: "5917762526281728",
-}
-
-team {
name: "trendy_team_pixel_system_software",
// go/trendy/manage/engineers/4856005120622592
@@ -518,13 +511,6 @@
}
team {
- name: "trendy_team_wear_wear_notifications_alerts_attention_management",
-
- // go/trendy/manage/engineers/6267643681996800
- trendy_team_id: "6267643681996800",
-}
-
-team {
name: "trendy_team_fwk_nfc",
// go/trendy/manage/engineers/5962312512864256
@@ -532,13 +518,6 @@
}
team {
- name: "trendy_team_wear_personalization_developer_surfaces",
-
- // go/trendy/manage/engineers/4819890988810240
- trendy_team_id: "4819890988810240",
-}
-
-team {
name: "trendy_team_srajkumar_team",
// go/trendy/manage/engineers/5170053894012928
@@ -693,13 +672,6 @@
}
team {
- name: "trendy_team_test_eng_android_wear",
-
- // go/trendy/manage/engineers/4979150422933504
- trendy_team_id: "4979150422933504",
-}
-
-team {
name: "trendy_team_mesch_team",
// go/trendy/manage/engineers/5205465899368448
@@ -721,13 +693,6 @@
}
team {
- name: "trendy_team_wear_wear_developer_devx",
-
- // go/trendy/manage/engineers/4894890764697600
- trendy_team_id: "4894890764697600",
-}
-
-team {
name: "trendy_team_android_rust",
// go/trendy/manage/engineers/4844600586305536
@@ -931,13 +896,6 @@
}
team {
- name: "trendy_team_wear_wallet_on_wear",
-
- // go/trendy/manage/engineers/5724960437731328
- trendy_team_id: "5724960437731328",
-}
-
-team {
name: "trendy_team_glanceables",
// go/trendy/manage/engineers/4658222004600832
@@ -1071,13 +1029,6 @@
}
team {
- name: "trendy_team_wear_3xp",
-
- // go/trendy/manage/engineers/5692317612539904
- trendy_team_id: "5692317612539904",
-}
-
-team {
name: "trendy_team_clockwork",
// go/trendy/manage/engineers/4908781678755840
@@ -1211,13 +1162,6 @@
}
team {
- name: "trendy_team_wear_software_nti",
-
- // go/trendy/manage/engineers/5164973558759424
- trendy_team_id: "5164973558759424",
-}
-
-team {
name: "trendy_team_machine_learning",
// go/trendy/manage/engineers/5276568318246912
@@ -1309,13 +1253,6 @@
}
team {
- name: "trendy_team_wear_wear_power_emulator",
-
- // go/trendy/manage/engineers/5160338936725504
- trendy_team_id: "5160338936725504",
-}
-
-team {
name: "trendy_team_deprecated_framework_svetoslavganov",
// go/trendy/manage/engineers/6404117492531200
@@ -1330,13 +1267,6 @@
}
team {
- name: "trendy_team_wear_opus",
-
- // go/trendy/manage/engineers/5098351636676608
- trendy_team_id: "5098351636676608",
-}
-
-team {
name: "trendy_team_text_to_speech",
// go/trendy/manage/engineers/6368933120442368
@@ -1442,13 +1372,6 @@
}
team {
- name: "trendy_team_wear_developer_foundation",
-
- // go/trendy/manage/engineers/5239127108648960
- trendy_team_id: "5239127108648960",
-}
-
-team {
name: "trendy_team_tpm_tvc",
// go/trendy/manage/engineers/5390683333230592
@@ -1456,13 +1379,6 @@
}
team {
- name: "trendy_team_wear_wear_ux",
-
- // go/trendy/manage/engineers/5782097411080192
- trendy_team_id: "5782097411080192",
-}
-
-team {
name: "trendy_team_lse_desktop_os_experience",
// go/trendy/manage/engineers/5125234900434944
@@ -1673,13 +1589,6 @@
}
team {
- name: "trendy_team_wear_wear_assistant",
-
- // go/trendy/manage/engineers/5848075306172416
- trendy_team_id: "5848075306172416",
-}
-
-team {
name: "trendy_team_android_power_and_comms_infra",
// go/trendy/manage/engineers/5325547653332992
diff --git a/tools/aconfig/aconfig/src/codegen/java.rs b/tools/aconfig/aconfig/src/codegen/java.rs
index 067a3b4..bfdf1a7 100644
--- a/tools/aconfig/aconfig/src/codegen/java.rs
+++ b/tools/aconfig/aconfig/src/codegen/java.rs
@@ -513,6 +513,7 @@
package com.android.aconfig.test;
// TODO(b/303773055): Remove the annotation after access issue is resolved.
import android.compat.annotation.UnsupportedAppUsage;
+ import android.os.Binder;
import android.provider.DeviceConfig;
import android.provider.DeviceConfig.Properties;
import android.aconfig.storage.StorageInternalReader;
@@ -544,6 +545,7 @@
isCached = true;
}
private void load_overrides_aconfig_test() {
+ final long ident = Binder.clearCallingIdentity();
try {
Properties properties = DeviceConfig.getProperties("aconfig_test");
disabledRw =
@@ -563,11 +565,14 @@
);
} catch (SecurityException e) {
// for isolated process case, skip loading flag value from the storage, use the default
+ } finally {
+ Binder.restoreCallingIdentity(ident);
}
aconfig_test_is_cached = true;
}
private void load_overrides_other_namespace() {
+ final long ident = Binder.clearCallingIdentity();
try {
Properties properties = DeviceConfig.getProperties("other_namespace");
disabledRwInOtherNamespace =
@@ -583,6 +588,8 @@
);
} catch (SecurityException e) {
// for isolated process case, skip loading flag value from the storage, use the default
+ } finally {
+ Binder.restoreCallingIdentity(ident);
}
other_namespace_is_cached = true;
}
@@ -764,6 +771,7 @@
let expect_feature_flags_impl_content = r#"
package com.android.aconfig.test;
+ import android.os.Binder;
import android.provider.DeviceConfig;
import android.provider.DeviceConfig.Properties;
/** @hide */
@@ -774,6 +782,7 @@
private static boolean enabledRoExported = false;
private void load_overrides_aconfig_test() {
+ final long ident = Binder.clearCallingIdentity();
try {
Properties properties = DeviceConfig.getProperties("aconfig_test");
disabledRwExported =
@@ -793,6 +802,8 @@
);
} catch (SecurityException e) {
// for isolated process case, skip loading flag value from the storage, use the default
+ } finally {
+ Binder.restoreCallingIdentity(ident);
}
aconfig_test_is_cached = true;
}
diff --git a/tools/aconfig/aconfig/src/storage/flag_info.rs b/tools/aconfig/aconfig/src/storage/flag_info.rs
index 2532609..5d565e8 100644
--- a/tools/aconfig/aconfig/src/storage/flag_info.rs
+++ b/tools/aconfig/aconfig/src/storage/flag_info.rs
@@ -83,7 +83,7 @@
let flag_info_list = create_test_flag_info_list_from_source();
assert!(flag_info_list.is_ok());
let expected_flag_info_list =
- aconfig_storage_file::test_utils::create_test_flag_info_list();
+ aconfig_storage_file::test_utils::create_test_flag_info_list(DEFAULT_FILE_VERSION);
assert_eq!(flag_info_list.unwrap(), expected_flag_info_list);
}
}
diff --git a/tools/aconfig/aconfig/src/storage/flag_table.rs b/tools/aconfig/aconfig/src/storage/flag_table.rs
index 6046d7e..8856eb6 100644
--- a/tools/aconfig/aconfig/src/storage/flag_table.rs
+++ b/tools/aconfig/aconfig/src/storage/flag_table.rs
@@ -157,7 +157,8 @@
fn test_table_contents() {
let flag_table = create_test_flag_table_from_source();
assert!(flag_table.is_ok());
- let expected_flag_table = aconfig_storage_file::test_utils::create_test_flag_table();
+ let expected_flag_table =
+ aconfig_storage_file::test_utils::create_test_flag_table(DEFAULT_FILE_VERSION);
assert_eq!(flag_table.unwrap(), expected_flag_table);
}
}
diff --git a/tools/aconfig/aconfig/src/storage/flag_value.rs b/tools/aconfig/aconfig/src/storage/flag_value.rs
index 6a655b9..0dd5a9d 100644
--- a/tools/aconfig/aconfig/src/storage/flag_value.rs
+++ b/tools/aconfig/aconfig/src/storage/flag_value.rs
@@ -82,7 +82,7 @@
let flag_value_list = create_test_flag_value_list_from_source();
assert!(flag_value_list.is_ok());
let expected_flag_value_list =
- aconfig_storage_file::test_utils::create_test_flag_value_list();
+ aconfig_storage_file::test_utils::create_test_flag_value_list(DEFAULT_FILE_VERSION);
assert_eq!(flag_value_list.unwrap(), expected_flag_value_list);
}
}
diff --git a/tools/aconfig/aconfig/src/storage/mod.rs b/tools/aconfig/aconfig/src/storage/mod.rs
index 9e5dad5..c7fd55a 100644
--- a/tools/aconfig/aconfig/src/storage/mod.rs
+++ b/tools/aconfig/aconfig/src/storage/mod.rs
@@ -32,6 +32,7 @@
pub struct FlagPackage<'a> {
pub package_name: &'a str,
pub package_id: u32,
+ pub fingerprint: u64,
pub flag_names: HashSet<&'a str>,
pub boolean_flags: Vec<&'a ProtoParsedFlag>,
// The index of the first boolean flag in this aconfig package among all boolean
@@ -44,6 +45,7 @@
FlagPackage {
package_name,
package_id,
+ fingerprint: 0,
flag_names: HashSet::new(),
boolean_flags: vec![],
boolean_start_index: 0,
@@ -79,6 +81,8 @@
for p in packages.iter_mut() {
p.boolean_start_index = boolean_start_index;
boolean_start_index += p.boolean_flags.len() as u32;
+
+ // TODO: b/316357686 - Calculate fingerprint and add to package.
}
packages
diff --git a/tools/aconfig/aconfig/src/storage/package_table.rs b/tools/aconfig/aconfig/src/storage/package_table.rs
index 56559f8..e46607b 100644
--- a/tools/aconfig/aconfig/src/storage/package_table.rs
+++ b/tools/aconfig/aconfig/src/storage/package_table.rs
@@ -47,6 +47,7 @@
let node = PackageTableNode {
package_name: String::from(package.package_name),
package_id: package.package_id,
+ fingerprint: package.fingerprint,
boolean_start_index: package.boolean_start_index,
next_offset: None,
};
@@ -127,7 +128,8 @@
fn test_table_contents() {
let package_table = create_test_package_table_from_source();
assert!(package_table.is_ok());
- let expected_package_table = aconfig_storage_file::test_utils::create_test_package_table();
+ let expected_package_table =
+ aconfig_storage_file::test_utils::create_test_package_table(DEFAULT_FILE_VERSION);
assert_eq!(package_table.unwrap(), expected_package_table);
}
}
diff --git a/tools/aconfig/aconfig/templates/FeatureFlagsImpl.java.template b/tools/aconfig/aconfig/templates/FeatureFlagsImpl.java.template
index 15df902..cb52150 100644
--- a/tools/aconfig/aconfig/templates/FeatureFlagsImpl.java.template
+++ b/tools/aconfig/aconfig/templates/FeatureFlagsImpl.java.template
@@ -7,6 +7,7 @@
{{ -endif }}
{{ -if runtime_lookup_required }}
+import android.os.Binder;
import android.provider.DeviceConfig;
import android.provider.DeviceConfig.Properties;
@@ -57,6 +58,7 @@
{{ for namespace_with_flags in namespace_flags }}
private void load_overrides_{namespace_with_flags.namespace}() \{
+ final long ident = Binder.clearCallingIdentity();
try \{
Properties properties = DeviceConfig.getProperties("{namespace_with_flags.namespace}");
{{ -for flag in namespace_with_flags.flags }}
@@ -76,6 +78,8 @@
);
} catch (SecurityException e) \{
// for isolated process case, skip loading flag value from the storage, use the default
+ } finally \{
+ Binder.restoreCallingIdentity(ident);
}
{namespace_with_flags.namespace}_is_cached = true;
}
@@ -121,6 +125,7 @@
{{ -endif }}
{{ -if runtime_lookup_required }}
+import android.os.Binder;
import android.provider.DeviceConfig;
import android.provider.DeviceConfig.Properties;
{{ -endif }}
@@ -138,6 +143,7 @@
{{ -endfor }}
{{ for namespace_with_flags in namespace_flags }}
private void load_overrides_{namespace_with_flags.namespace}() \{
+ final long ident = Binder.clearCallingIdentity();
try \{
Properties properties = DeviceConfig.getProperties("{namespace_with_flags.namespace}");
{{ -for flag in namespace_with_flags.flags }}
@@ -155,6 +161,8 @@
+ "flag declaration.",
e
);
+ } finally \{
+ Binder.restoreCallingIdentity(ident);
}
{namespace_with_flags.namespace}_is_cached = true;
}
diff --git a/tools/aconfig/aconfig_flags/flags.aconfig b/tools/aconfig/aconfig_flags/flags.aconfig
index 0a004ca..b66d282 100644
--- a/tools/aconfig/aconfig_flags/flags.aconfig
+++ b/tools/aconfig/aconfig_flags/flags.aconfig
@@ -14,3 +14,11 @@
bug: "369808805"
description: "When enabled, launch aconfigd from config infra module."
}
+
+flag {
+ name: "enable_system_aconfigd_rust"
+ namespace: "core_experiments_team_internal"
+ bug: "378079539"
+ description: "When enabled, the aconfigd cc_binary target becomes a no-op, and the rust_binary aconfigd-system target starts up."
+ is_fixed_read_only: true
+}
diff --git a/tools/aconfig/aconfig_flags/src/lib.rs b/tools/aconfig/aconfig_flags/src/lib.rs
index 2e89127..b413c62 100644
--- a/tools/aconfig/aconfig_flags/src/lib.rs
+++ b/tools/aconfig/aconfig_flags/src/lib.rs
@@ -39,6 +39,11 @@
pub fn enable_aconfigd_from_mainline() -> bool {
aconfig_flags_rust::enable_only_new_storage()
}
+
+ /// Returns the value for the enable_system_aconfigd_rust flag.
+ pub fn enable_system_aconfigd_rust() -> bool {
+ aconfig_flags_rust::enable_system_aconfigd_rust()
+ }
}
/// Module used when building with cargo
@@ -55,4 +60,10 @@
// Used only to enable typechecking and testing with cargo
true
}
+
+ /// Returns a placeholder value for the enable_system_aconfigd_rust flag.
+ pub fn enable_system_aconfigd_rust() -> bool {
+ // Used only to enable typechecking and testing with cargo
+ true
+ }
}
diff --git a/tools/aconfig/aconfig_storage_file/src/flag_info.rs b/tools/aconfig/aconfig_storage_file/src/flag_info.rs
index f090396..cf16834 100644
--- a/tools/aconfig/aconfig_storage_file/src/flag_info.rs
+++ b/tools/aconfig/aconfig_storage_file/src/flag_info.rs
@@ -194,12 +194,15 @@
#[cfg(test)]
mod tests {
use super::*;
- use crate::test_utils::create_test_flag_info_list;
+ use crate::{
+ test_utils::create_test_flag_info_list, DEFAULT_FILE_VERSION, MAX_SUPPORTED_FILE_VERSION,
+ };
- #[test]
// this test point locks down the value list serialization
- fn test_serialization() {
- let flag_info_list = create_test_flag_info_list();
+ // TODO: b/376108268 - Use parameterized tests.
+ #[test]
+ fn test_serialization_default() {
+ let flag_info_list = create_test_flag_info_list(DEFAULT_FILE_VERSION);
let header: &FlagInfoHeader = &flag_info_list.header;
let reinterpreted_header = FlagInfoHeader::from_bytes(&header.into_bytes());
@@ -220,20 +223,42 @@
}
#[test]
- // this test point locks down that version number should be at the top of serialized
- // bytes
- fn test_version_number() {
- let flag_info_list = create_test_flag_info_list();
- let bytes = &flag_info_list.into_bytes();
- let mut head = 0;
- let version = read_u32_from_bytes(bytes, &mut head).unwrap();
- assert_eq!(version, 1);
+ fn test_serialization_max() {
+ let flag_info_list = create_test_flag_info_list(MAX_SUPPORTED_FILE_VERSION);
+
+ let header: &FlagInfoHeader = &flag_info_list.header;
+ let reinterpreted_header = FlagInfoHeader::from_bytes(&header.into_bytes());
+ assert!(reinterpreted_header.is_ok());
+ assert_eq!(header, &reinterpreted_header.unwrap());
+
+ let nodes: &Vec<FlagInfoNode> = &flag_info_list.nodes;
+ for node in nodes.iter() {
+ let reinterpreted_node = FlagInfoNode::from_bytes(&node.into_bytes()).unwrap();
+ assert_eq!(node, &reinterpreted_node);
+ }
+
+ let flag_info_bytes = flag_info_list.into_bytes();
+ let reinterpreted_info_list = FlagInfoList::from_bytes(&flag_info_bytes);
+ assert!(reinterpreted_info_list.is_ok());
+ assert_eq!(&flag_info_list, &reinterpreted_info_list.unwrap());
+ assert_eq!(flag_info_bytes.len() as u32, header.file_size);
}
+ // this test point locks down that version number should be at the top of serialized
+ // bytes
#[test]
+ fn test_version_number() {
+ let flag_info_list = create_test_flag_info_list(DEFAULT_FILE_VERSION);
+ let bytes = &flag_info_list.into_bytes();
+ let mut head = 0;
+ let version_from_file = read_u32_from_bytes(bytes, &mut head).unwrap();
+ assert_eq!(version_from_file, DEFAULT_FILE_VERSION);
+ }
+
// this test point locks down file type check
+ #[test]
fn test_file_type_check() {
- let mut flag_info_list = create_test_flag_info_list();
+ let mut flag_info_list = create_test_flag_info_list(DEFAULT_FILE_VERSION);
flag_info_list.header.file_type = 123u8;
let error = FlagInfoList::from_bytes(&flag_info_list.into_bytes()).unwrap_err();
assert_eq!(
diff --git a/tools/aconfig/aconfig_storage_file/src/flag_table.rs b/tools/aconfig/aconfig_storage_file/src/flag_table.rs
index 0588fe5..6fbee02 100644
--- a/tools/aconfig/aconfig_storage_file/src/flag_table.rs
+++ b/tools/aconfig/aconfig_storage_file/src/flag_table.rs
@@ -220,12 +220,15 @@
#[cfg(test)]
mod tests {
use super::*;
- use crate::test_utils::create_test_flag_table;
+ use crate::{
+ test_utils::create_test_flag_table, DEFAULT_FILE_VERSION, MAX_SUPPORTED_FILE_VERSION,
+ };
- #[test]
// this test point locks down the table serialization
- fn test_serialization() {
- let flag_table = create_test_flag_table();
+ // TODO: b/376108268 - Use parameterized tests.
+ #[test]
+ fn test_serialization_default() {
+ let flag_table = create_test_flag_table(DEFAULT_FILE_VERSION);
let header: &FlagTableHeader = &flag_table.header;
let reinterpreted_header = FlagTableHeader::from_bytes(&header.into_bytes());
@@ -246,20 +249,42 @@
}
#[test]
- // this test point locks down that version number should be at the top of serialized
- // bytes
- fn test_version_number() {
- let flag_table = create_test_flag_table();
- let bytes = &flag_table.into_bytes();
- let mut head = 0;
- let version = read_u32_from_bytes(bytes, &mut head).unwrap();
- assert_eq!(version, 1);
+ fn test_serialization_max() {
+ let flag_table = create_test_flag_table(MAX_SUPPORTED_FILE_VERSION);
+
+ let header: &FlagTableHeader = &flag_table.header;
+ let reinterpreted_header = FlagTableHeader::from_bytes(&header.into_bytes());
+ assert!(reinterpreted_header.is_ok());
+ assert_eq!(header, &reinterpreted_header.unwrap());
+
+ let nodes: &Vec<FlagTableNode> = &flag_table.nodes;
+ for node in nodes.iter() {
+ let reinterpreted_node = FlagTableNode::from_bytes(&node.into_bytes()).unwrap();
+ assert_eq!(node, &reinterpreted_node);
+ }
+
+ let flag_table_bytes = flag_table.into_bytes();
+ let reinterpreted_table = FlagTable::from_bytes(&flag_table_bytes);
+ assert!(reinterpreted_table.is_ok());
+ assert_eq!(&flag_table, &reinterpreted_table.unwrap());
+ assert_eq!(flag_table_bytes.len() as u32, header.file_size);
}
+ // this test point locks down that version number should be at the top of serialized
+ // bytes
#[test]
+ fn test_version_number() {
+ let flag_table = create_test_flag_table(DEFAULT_FILE_VERSION);
+ let bytes = &flag_table.into_bytes();
+ let mut head = 0;
+ let version_from_file = read_u32_from_bytes(bytes, &mut head).unwrap();
+ assert_eq!(version_from_file, DEFAULT_FILE_VERSION);
+ }
+
// this test point locks down file type check
+ #[test]
fn test_file_type_check() {
- let mut flag_table = create_test_flag_table();
+ let mut flag_table = create_test_flag_table(DEFAULT_FILE_VERSION);
flag_table.header.file_type = 123u8;
let error = FlagTable::from_bytes(&flag_table.into_bytes()).unwrap_err();
assert_eq!(
diff --git a/tools/aconfig/aconfig_storage_file/src/flag_value.rs b/tools/aconfig/aconfig_storage_file/src/flag_value.rs
index b64c10e..9a14bec 100644
--- a/tools/aconfig/aconfig_storage_file/src/flag_value.rs
+++ b/tools/aconfig/aconfig_storage_file/src/flag_value.rs
@@ -132,12 +132,32 @@
#[cfg(test)]
mod tests {
use super::*;
- use crate::test_utils::create_test_flag_value_list;
+ use crate::{
+ test_utils::create_test_flag_value_list, DEFAULT_FILE_VERSION, MAX_SUPPORTED_FILE_VERSION,
+ };
#[test]
// this test point locks down the value list serialization
- fn test_serialization() {
- let flag_value_list = create_test_flag_value_list();
+ // TODO: b/376108268 - Use parameterized tests.
+ fn test_serialization_default() {
+ let flag_value_list = create_test_flag_value_list(DEFAULT_FILE_VERSION);
+
+ let header: &FlagValueHeader = &flag_value_list.header;
+ let reinterpreted_header = FlagValueHeader::from_bytes(&header.into_bytes());
+ assert!(reinterpreted_header.is_ok());
+ assert_eq!(header, &reinterpreted_header.unwrap());
+
+ let flag_value_bytes = flag_value_list.into_bytes();
+ let reinterpreted_value_list = FlagValueList::from_bytes(&flag_value_bytes);
+ assert!(reinterpreted_value_list.is_ok());
+ assert_eq!(&flag_value_list, &reinterpreted_value_list.unwrap());
+ assert_eq!(flag_value_bytes.len() as u32, header.file_size);
+ }
+
+ #[test]
+ // this test point locks down the value list serialization
+ fn test_serialization_max() {
+ let flag_value_list = create_test_flag_value_list(MAX_SUPPORTED_FILE_VERSION);
let header: &FlagValueHeader = &flag_value_list.header;
let reinterpreted_header = FlagValueHeader::from_bytes(&header.into_bytes());
@@ -155,17 +175,17 @@
// this test point locks down that version number should be at the top of serialized
// bytes
fn test_version_number() {
- let flag_value_list = create_test_flag_value_list();
+ let flag_value_list = create_test_flag_value_list(DEFAULT_FILE_VERSION);
let bytes = &flag_value_list.into_bytes();
let mut head = 0;
- let version = read_u32_from_bytes(bytes, &mut head).unwrap();
- assert_eq!(version, 1);
+ let version_from_file = read_u32_from_bytes(bytes, &mut head).unwrap();
+ assert_eq!(version_from_file, DEFAULT_FILE_VERSION);
}
#[test]
// this test point locks down file type check
fn test_file_type_check() {
- let mut flag_value_list = create_test_flag_value_list();
+ let mut flag_value_list = create_test_flag_value_list(DEFAULT_FILE_VERSION);
flag_value_list.header.file_type = 123u8;
let error = FlagValueList::from_bytes(&flag_value_list.into_bytes()).unwrap_err();
assert_eq!(
diff --git a/tools/aconfig/aconfig_storage_file/src/lib.rs b/tools/aconfig/aconfig_storage_file/src/lib.rs
index 1d92ba4..e991320 100644
--- a/tools/aconfig/aconfig_storage_file/src/lib.rs
+++ b/tools/aconfig/aconfig_storage_file/src/lib.rs
@@ -536,10 +536,15 @@
// this test point locks down the flag list api
fn test_list_flag() {
let package_table =
- write_bytes_to_temp_file(&create_test_package_table().into_bytes()).unwrap();
- let flag_table = write_bytes_to_temp_file(&create_test_flag_table().into_bytes()).unwrap();
- let flag_value_list =
- write_bytes_to_temp_file(&create_test_flag_value_list().into_bytes()).unwrap();
+ write_bytes_to_temp_file(&create_test_package_table(DEFAULT_FILE_VERSION).into_bytes())
+ .unwrap();
+ let flag_table =
+ write_bytes_to_temp_file(&create_test_flag_table(DEFAULT_FILE_VERSION).into_bytes())
+ .unwrap();
+ let flag_value_list = write_bytes_to_temp_file(
+ &create_test_flag_value_list(DEFAULT_FILE_VERSION).into_bytes(),
+ )
+ .unwrap();
let package_table_path = package_table.path().display().to_string();
let flag_table_path = flag_table.path().display().to_string();
@@ -604,12 +609,19 @@
// this test point locks down the flag list with info api
fn test_list_flag_with_info() {
let package_table =
- write_bytes_to_temp_file(&create_test_package_table().into_bytes()).unwrap();
- let flag_table = write_bytes_to_temp_file(&create_test_flag_table().into_bytes()).unwrap();
- let flag_value_list =
- write_bytes_to_temp_file(&create_test_flag_value_list().into_bytes()).unwrap();
- let flag_info_list =
- write_bytes_to_temp_file(&create_test_flag_info_list().into_bytes()).unwrap();
+ write_bytes_to_temp_file(&create_test_package_table(DEFAULT_FILE_VERSION).into_bytes())
+ .unwrap();
+ let flag_table =
+ write_bytes_to_temp_file(&create_test_flag_table(DEFAULT_FILE_VERSION).into_bytes())
+ .unwrap();
+ let flag_value_list = write_bytes_to_temp_file(
+ &create_test_flag_value_list(DEFAULT_FILE_VERSION).into_bytes(),
+ )
+ .unwrap();
+ let flag_info_list = write_bytes_to_temp_file(
+ &create_test_flag_info_list(DEFAULT_FILE_VERSION).into_bytes(),
+ )
+ .unwrap();
let package_table_path = package_table.path().display().to_string();
let flag_table_path = flag_table.path().display().to_string();
diff --git a/tools/aconfig/aconfig_storage_file/src/package_table.rs b/tools/aconfig/aconfig_storage_file/src/package_table.rs
index af39fbc..21357c7 100644
--- a/tools/aconfig/aconfig_storage_file/src/package_table.rs
+++ b/tools/aconfig/aconfig_storage_file/src/package_table.rs
@@ -100,6 +100,7 @@
pub struct PackageTableNode {
pub package_name: String,
pub package_id: u32,
+ pub fingerprint: u64,
// The index of the first boolean flag in this aconfig package among all boolean
// flags in this container.
pub boolean_start_index: u32,
@@ -111,8 +112,12 @@
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(
f,
- "Package: {}, Id: {}, Boolean flag start index: {}, Next: {:?}",
- self.package_name, self.package_id, self.boolean_start_index, self.next_offset
+ "Package: {}, Id: {}, Fingerprint: {}, Boolean flag start index: {}, Next: {:?}",
+ self.package_name,
+ self.package_id,
+ self.fingerprint,
+ self.boolean_start_index,
+ self.next_offset
)?;
Ok(())
}
@@ -146,9 +151,7 @@
result.extend_from_slice(&(name_bytes.len() as u32).to_le_bytes());
result.extend_from_slice(name_bytes);
result.extend_from_slice(&self.package_id.to_le_bytes());
- // V2 storage files have a fingerprint. Current struct (v1) does not, so
- // we write 0.
- result.extend_from_slice(&0u64.to_le_bytes());
+ result.extend_from_slice(&self.fingerprint.to_le_bytes());
result.extend_from_slice(&self.boolean_start_index.to_le_bytes());
result.extend_from_slice(&self.next_offset.unwrap_or(0).to_le_bytes());
result
@@ -172,13 +175,15 @@
let mut head = 0;
let package_name = read_str_from_bytes(bytes, &mut head)?;
let package_id = read_u32_from_bytes(bytes, &mut head)?;
+ // v1 does not have fingerprint, so just set to 0.
+ let fingerprint: u64 = 0;
let boolean_start_index = read_u32_from_bytes(bytes, &mut head)?;
let next_offset = match read_u32_from_bytes(bytes, &mut head)? {
0 => None,
val => Some(val),
};
- let node = Self { package_name, package_id, boolean_start_index, next_offset };
+ let node = Self { package_name, package_id, fingerprint, boolean_start_index, next_offset };
Ok(node)
}
@@ -186,18 +191,14 @@
let mut head = 0;
let package_name = read_str_from_bytes(bytes, &mut head)?;
let package_id = read_u32_from_bytes(bytes, &mut head)?;
-
- // Fingerprint is unused in the current struct (v1), but we need to read
- // the bytes if the storage file type is v2 or else the subsequent
- // fields will be inaccurate.
- let _fingerprint = read_u64_from_bytes(bytes, &mut head)?;
+ let fingerprint = read_u64_from_bytes(bytes, &mut head)?;
let boolean_start_index = read_u32_from_bytes(bytes, &mut head)?;
let next_offset = match read_u32_from_bytes(bytes, &mut head)? {
0 => None,
val => Some(val),
};
- let node = Self { package_name, package_id, boolean_start_index, next_offset };
+ let node = Self { package_name, package_id, fingerprint, boolean_start_index, next_offset };
Ok(node)
}
@@ -281,13 +282,37 @@
#[cfg(test)]
mod tests {
use super::*;
- use crate::read_u32_from_start_of_bytes;
- use crate::{test_utils::create_test_package_table, DEFAULT_FILE_VERSION};
+ use crate::test_utils::create_test_package_table;
+ use crate::{read_u32_from_start_of_bytes, DEFAULT_FILE_VERSION, MAX_SUPPORTED_FILE_VERSION};
#[test]
// this test point locks down the table serialization
- fn test_serialization() {
- let package_table = create_test_package_table();
+ // TODO: b/376108268 - Use parameterized tests.
+ fn test_serialization_default() {
+ let package_table = create_test_package_table(DEFAULT_FILE_VERSION);
+ let header: &PackageTableHeader = &package_table.header;
+ let reinterpreted_header = PackageTableHeader::from_bytes(&header.into_bytes());
+ assert!(reinterpreted_header.is_ok());
+ assert_eq!(header, &reinterpreted_header.unwrap());
+
+ let nodes: &Vec<PackageTableNode> = &package_table.nodes;
+ for node in nodes.iter() {
+ let reinterpreted_node =
+ PackageTableNode::from_bytes(&node.into_bytes(header.version), header.version)
+ .unwrap();
+ assert_eq!(node, &reinterpreted_node);
+ }
+
+ let package_table_bytes = package_table.into_bytes();
+ let reinterpreted_table = PackageTable::from_bytes(&package_table_bytes);
+ assert!(reinterpreted_table.is_ok());
+ assert_eq!(&package_table, &reinterpreted_table.unwrap());
+ assert_eq!(package_table_bytes.len() as u32, header.file_size);
+ }
+
+ #[test]
+ fn test_serialization_max() {
+ let package_table = create_test_package_table(MAX_SUPPORTED_FILE_VERSION);
let header: &PackageTableHeader = &package_table.header;
let reinterpreted_header = PackageTableHeader::from_bytes(&header.into_bytes());
assert!(reinterpreted_header.is_ok());
@@ -312,44 +337,36 @@
// this test point locks down that version number should be at the top of serialized
// bytes
fn test_version_number() {
- let package_table = create_test_package_table();
+ let package_table = create_test_package_table(DEFAULT_FILE_VERSION);
let bytes = &package_table.into_bytes();
- let version = read_u32_from_start_of_bytes(bytes).unwrap();
- assert_eq!(version, DEFAULT_FILE_VERSION);
+ let unpacked_version = read_u32_from_start_of_bytes(bytes).unwrap();
+ assert_eq!(unpacked_version, DEFAULT_FILE_VERSION);
}
#[test]
- fn test_round_trip_v1() {
- let table_v1: PackageTable = create_test_package_table();
- let table_bytes_v1 = table_v1.into_bytes();
+ fn test_round_trip_default() {
+ let table: PackageTable = create_test_package_table(DEFAULT_FILE_VERSION);
+ let table_bytes = table.into_bytes();
- // Will automatically read from version 2 as the version code is encoded
- // into the bytes.
- let reinterpreted_table = PackageTable::from_bytes(&table_bytes_v1).unwrap();
+ let reinterpreted_table = PackageTable::from_bytes(&table_bytes).unwrap();
- assert_eq!(table_v1, reinterpreted_table);
+ assert_eq!(table, reinterpreted_table);
}
#[test]
- fn test_round_trip_v2() {
- // Have to fake v2 because though we will set the version to v2
- // and write the bytes as v2, we don't have the ability to actually set
- // the fingerprint yet.
- let mut fake_table_v2 = create_test_package_table();
- fake_table_v2.header.version = 2;
- let table_bytes_v2 = fake_table_v2.into_bytes();
+ fn test_round_trip_max() {
+ let table: PackageTable = create_test_package_table(MAX_SUPPORTED_FILE_VERSION);
+ let table_bytes = table.into_bytes();
- // Will automatically read from version 2 as the version code is encoded
- // into the bytes.
- let reinterpreted_table = PackageTable::from_bytes(&table_bytes_v2).unwrap();
+ let reinterpreted_table = PackageTable::from_bytes(&table_bytes).unwrap();
- assert_eq!(fake_table_v2, reinterpreted_table);
+ assert_eq!(table, reinterpreted_table);
}
#[test]
// this test point locks down file type check
fn test_file_type_check() {
- let mut package_table = create_test_package_table();
+ let mut package_table = create_test_package_table(DEFAULT_FILE_VERSION);
package_table.header.file_type = 123u8;
let error = PackageTable::from_bytes(&package_table.into_bytes()).unwrap_err();
assert_eq!(
diff --git a/tools/aconfig/aconfig_storage_file/src/test_utils.rs b/tools/aconfig/aconfig_storage_file/src/test_utils.rs
index 5c364f6..55780ed 100644
--- a/tools/aconfig/aconfig_storage_file/src/test_utils.rs
+++ b/tools/aconfig/aconfig_storage_file/src/test_utils.rs
@@ -18,38 +18,53 @@
use crate::flag_table::{FlagTable, FlagTableHeader, FlagTableNode};
use crate::flag_value::{FlagValueHeader, FlagValueList};
use crate::package_table::{PackageTable, PackageTableHeader, PackageTableNode};
-use crate::{AconfigStorageError, StorageFileType, StoredFlagType, DEFAULT_FILE_VERSION};
+use crate::{AconfigStorageError, StorageFileType, StoredFlagType};
use anyhow::anyhow;
use std::io::Write;
use tempfile::NamedTempFile;
-pub fn create_test_package_table() -> PackageTable {
+pub fn create_test_package_table(version: u32) -> PackageTable {
let header = PackageTableHeader {
- version: DEFAULT_FILE_VERSION,
+ version: version,
container: String::from("mockup"),
file_type: StorageFileType::PackageMap as u8,
- file_size: 209,
+ file_size: match version {
+ 1 => 209,
+ 2 => 233,
+ _ => panic!("Unsupported version."),
+ },
num_packages: 3,
bucket_offset: 31,
node_offset: 59,
};
- let buckets: Vec<Option<u32>> = vec![Some(59), None, None, Some(109), None, None, None];
+ let buckets: Vec<Option<u32>> = match version {
+ 1 => vec![Some(59), None, None, Some(109), None, None, None],
+ 2 => vec![Some(59), None, None, Some(117), None, None, None],
+ _ => panic!("Unsupported version."),
+ };
let first_node = PackageTableNode {
package_name: String::from("com.android.aconfig.storage.test_2"),
package_id: 1,
+ fingerprint: 0,
boolean_start_index: 3,
next_offset: None,
};
let second_node = PackageTableNode {
package_name: String::from("com.android.aconfig.storage.test_1"),
package_id: 0,
+ fingerprint: 0,
boolean_start_index: 0,
- next_offset: Some(159),
+ next_offset: match version {
+ 1 => Some(159),
+ 2 => Some(175),
+ _ => panic!("Unsupported version."),
+ },
};
let third_node = PackageTableNode {
package_name: String::from("com.android.aconfig.storage.test_4"),
package_id: 2,
+ fingerprint: 0,
boolean_start_index: 6,
next_offset: None,
};
@@ -76,9 +91,9 @@
}
}
-pub fn create_test_flag_table() -> FlagTable {
+pub fn create_test_flag_table(version: u32) -> FlagTable {
let header = FlagTableHeader {
- version: DEFAULT_FILE_VERSION,
+ version: version,
container: String::from("mockup"),
file_type: StorageFileType::FlagMap as u8,
file_size: 321,
@@ -118,9 +133,9 @@
FlagTable { header, buckets, nodes }
}
-pub fn create_test_flag_value_list() -> FlagValueList {
+pub fn create_test_flag_value_list(version: u32) -> FlagValueList {
let header = FlagValueHeader {
- version: DEFAULT_FILE_VERSION,
+ version: version,
container: String::from("mockup"),
file_type: StorageFileType::FlagVal as u8,
file_size: 35,
@@ -131,9 +146,9 @@
FlagValueList { header, booleans }
}
-pub fn create_test_flag_info_list() -> FlagInfoList {
+pub fn create_test_flag_info_list(version: u32) -> FlagInfoList {
let header = FlagInfoHeader {
- version: DEFAULT_FILE_VERSION,
+ version: version,
container: String::from("mockup"),
file_type: StorageFileType::FlagInfo as u8,
file_size: 35,
diff --git a/tools/aconfig/aconfig_storage_file/srcs/android/aconfig/storage/AconfigStorageException.java b/tools/aconfig/aconfig_storage_file/srcs/android/aconfig/storage/AconfigStorageException.java
index 86a75f2..b1c7ee7 100644
--- a/tools/aconfig/aconfig_storage_file/srcs/android/aconfig/storage/AconfigStorageException.java
+++ b/tools/aconfig/aconfig_storage_file/srcs/android/aconfig/storage/AconfigStorageException.java
@@ -16,12 +16,118 @@
package android.aconfig.storage;
+/**
+ * Exception thrown when an error occurs while accessing Aconfig Storage.
+ *
+ * <p>This exception indicates a general problem with Aconfig Storage, such as an inability to read
+ * or write data.
+ */
public class AconfigStorageException extends RuntimeException {
+
+ /** Generic error code indicating an unspecified Aconfig Storage error. */
+ public static final int ERROR_GENERIC = 0;
+
+ /** Error code indicating that the Aconfig Storage system is not found on the device. */
+ public static final int ERROR_STORAGE_SYSTEM_NOT_FOUND = 1;
+
+ /** Error code indicating that the requested configuration package is not found. */
+ public static final int ERROR_PACKAGE_NOT_FOUND = 2;
+
+ /** Error code indicating that the specified container is not found. */
+ public static final int ERROR_CONTAINER_NOT_FOUND = 3;
+
+ /** Error code indicating that there was an error reading the Aconfig Storage file. */
+ public static final int ERROR_CANNOT_READ_STORAGE_FILE = 4;
+
+ private final int mErrorCode;
+
+ /**
+ * Constructs a new {@code AconfigStorageException} with a generic error code and the specified
+ * detail message.
+ *
+ * @param msg The detail message for this exception.
+ */
public AconfigStorageException(String msg) {
super(msg);
+ mErrorCode = ERROR_GENERIC;
}
+ /**
+ * Constructs a new {@code AconfigStorageException} with a generic error code, the specified
+ * detail message, and cause.
+ *
+ * @param msg The detail message for this exception.
+ * @param cause The cause of this exception.
+ */
public AconfigStorageException(String msg, Throwable cause) {
super(msg, cause);
+ mErrorCode = ERROR_GENERIC;
+ }
+
+ /**
+ * Constructs a new {@code AconfigStorageException} with the specified error code and detail
+ * message.
+ *
+ * @param errorCode The error code for this exception.
+ * @param msg The detail message for this exception.
+ */
+ public AconfigStorageException(int errorCode, String msg) {
+ super(msg);
+ mErrorCode = errorCode;
+ }
+
+ /**
+ * Constructs a new {@code AconfigStorageException} with the specified error code, detail
+ * message, and cause.
+ *
+ * @param errorCode The error code for this exception.
+ * @param msg The detail message for this exception.
+ * @param cause The cause of this exception.
+ */
+ public AconfigStorageException(int errorCode, String msg, Throwable cause) {
+ super(msg, cause);
+ mErrorCode = errorCode;
+ }
+
+ /**
+ * Returns the error code associated with this exception.
+ *
+ * @return The error code.
+ */
+ public int getErrorCode() {
+ return mErrorCode;
+ }
+
+ /**
+ * Returns the error message for this exception, including the error code and the original
+ * message.
+ *
+ * @return The error message.
+ */
+ @Override
+ public String getMessage() {
+ return errorString() + ": " + super.getMessage();
+ }
+
+ /**
+ * Returns a string representation of the error code.
+ *
+ * @return The error code string.
+ */
+ private String errorString() {
+ switch (mErrorCode) {
+ case ERROR_GENERIC:
+ return "ERROR_GENERIC";
+ case ERROR_STORAGE_SYSTEM_NOT_FOUND:
+ return "ERROR_STORAGE_SYSTEM_NOT_FOUND";
+ case ERROR_PACKAGE_NOT_FOUND:
+ return "ERROR_PACKAGE_NOT_FOUND";
+ case ERROR_CONTAINER_NOT_FOUND:
+ return "ERROR_CONTAINER_NOT_FOUND";
+ case ERROR_CANNOT_READ_STORAGE_FILE:
+ return "ERROR_CANNOT_READ_STORAGE_FILE";
+ default:
+ return "<Unknown error code " + mErrorCode + ">";
+ }
}
}
diff --git a/tools/aconfig/aconfig_storage_read_api/srcs/android/aconfig/storage/StorageFileProvider.java b/tools/aconfig/aconfig_storage_file/srcs/android/aconfig/storage/StorageFileProvider.java
similarity index 91%
rename from tools/aconfig/aconfig_storage_read_api/srcs/android/aconfig/storage/StorageFileProvider.java
rename to tools/aconfig/aconfig_storage_file/srcs/android/aconfig/storage/StorageFileProvider.java
index 1f84a51..8306cc6 100644
--- a/tools/aconfig/aconfig_storage_read_api/srcs/android/aconfig/storage/StorageFileProvider.java
+++ b/tools/aconfig/aconfig_storage_file/srcs/android/aconfig/storage/StorageFileProvider.java
@@ -21,6 +21,7 @@
import java.nio.channels.FileChannel;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
@@ -51,14 +52,6 @@
}
/** @hide */
- public boolean containerFileExists(String container) {
- if (container == null) {
- return Files.exists(Paths.get(mMapPath));
- }
- return Files.exists(Paths.get(mMapPath, container + PMAP_FILE_EXT));
- }
-
- /** @hide */
public List<Path> listPackageMapFiles() {
List<Path> result = new ArrayList<>();
try {
@@ -66,8 +59,9 @@
Files.newDirectoryStream(Paths.get(mMapPath), "*" + PMAP_FILE_EXT);
for (Path entry : stream) {
result.add(entry);
- // sb.append(entry. toString());
}
+ } catch (NoSuchFileException e) {
+ return result;
} catch (Exception e) {
throw new AconfigStorageException(
String.format("Fail to list map files in path %s", mMapPath), e);
@@ -105,7 +99,9 @@
return channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
} catch (Exception e) {
throw new AconfigStorageException(
- String.format("Fail to mmap storage file %s", file), e);
+ AconfigStorageException.ERROR_CANNOT_READ_STORAGE_FILE,
+ String.format("Fail to mmap storage file %s", file),
+ e);
} finally {
quietlyDispose(channel);
}
diff --git a/tools/aconfig/aconfig_storage_file/tests/Android.bp b/tools/aconfig/aconfig_storage_file/tests/Android.bp
index 13d3214..bd46d5f 100644
--- a/tools/aconfig/aconfig_storage_file/tests/Android.bp
+++ b/tools/aconfig/aconfig_storage_file/tests/Android.bp
@@ -10,10 +10,14 @@
"libbase",
],
data: [
- "data/v1/package.map",
- "data/v1/flag.map",
- "data/v1/flag.val",
- "data/v1/flag.info",
+ "data/v1/package_v1.map",
+ "data/v1/flag_v1.map",
+ "data/v1/flag_v1.val",
+ "data/v1/flag_v1.info",
+ "data/v2/package_v2.map",
+ "data/v2/flag_v2.map",
+ "data/v2/flag_v2.val",
+ "data/v2/flag_v2.info",
],
test_suites: [
"device-tests",
@@ -35,10 +39,14 @@
test_config: "AndroidStorageJaveTest.xml",
sdk_version: "test_current",
data: [
- "data/v1/package.map",
- "data/v1/flag.map",
- "data/v1/flag.val",
- "data/v1/flag.info",
+ "data/v1/package_v1.map",
+ "data/v1/flag_v1.map",
+ "data/v1/flag_v1.val",
+ "data/v1/flag_v1.info",
+ "data/v2/package_v2.map",
+ "data/v2/flag_v2.map",
+ "data/v2/flag_v2.val",
+ "data/v2/flag_v2.info",
],
test_suites: [
"general-tests",
diff --git a/tools/aconfig/aconfig_storage_file/tests/AndroidStorageJaveTest.xml b/tools/aconfig/aconfig_storage_file/tests/AndroidStorageJaveTest.xml
index 2d52d44..bfc238e 100644
--- a/tools/aconfig/aconfig_storage_file/tests/AndroidStorageJaveTest.xml
+++ b/tools/aconfig/aconfig_storage_file/tests/AndroidStorageJaveTest.xml
@@ -21,13 +21,18 @@
</target_preparer>
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
<option name="cleanup" value="true" />
- <option name="push" value="package.map->/data/local/tmp/aconfig_storage_file_test_java/testdata/package.map" />
- <option name="push" value="flag.map->/data/local/tmp/aconfig_storage_file_test_java/testdata/flag.map" />
- <option name="push" value="flag.val->/data/local/tmp/aconfig_storage_file_test_java/testdata/flag.val" />
- <option name="push" value="flag.info->/data/local/tmp/aconfig_storage_file_test_java/testdata/flag.info" />
+ <option name="push" value="package_v1.map->/data/local/tmp/aconfig_storage_file_test_java/testdata/mock.v1.package.map" />
+ <option name="push" value="flag_v1.map->/data/local/tmp/aconfig_storage_file_test_java/testdata/mock.v1.flag.map" />
+ <option name="push" value="flag_v1.val->/data/local/tmp/aconfig_storage_file_test_java/testdata/mock.v1.val" />
+ <option name="push" value="flag_v1.info->/data/local/tmp/aconfig_storage_file_test_java/testdata/mock.v1.info" />
+ <option name="push" value="package_v2.map->/data/local/tmp/aconfig_storage_file_test_java/testdata/mock.v2.package.map" />
+ <option name="push" value="flag_v2.map->/data/local/tmp/aconfig_storage_file_test_java/testdata/mock.v2.flag.map" />
+ <option name="push" value="flag_v2.val->/data/local/tmp/aconfig_storage_file_test_java/testdata/mock.v2.val" />
+ <option name="push" value="flag_v2.info->/data/local/tmp/aconfig_storage_file_test_java/testdata/mock.v2.info" />
+ <option name="post-push" value="chmod +r /data/local/tmp/aconfig_storage_file_test_java/testdata/" />
</target_preparer>
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
<option name="package" value="android.aconfig.storage.test" />
<option name="runtime-hint" value="1m" />
</test>
-</configuration>
\ No newline at end of file
+</configuration>
diff --git a/tools/aconfig/aconfig_storage_file/tests/data/v1/flag.info b/tools/aconfig/aconfig_storage_file/tests/data/v1/flag_v1.info
similarity index 100%
rename from tools/aconfig/aconfig_storage_file/tests/data/v1/flag.info
rename to tools/aconfig/aconfig_storage_file/tests/data/v1/flag_v1.info
Binary files differ
diff --git a/tools/aconfig/aconfig_storage_file/tests/data/v1/flag.map b/tools/aconfig/aconfig_storage_file/tests/data/v1/flag_v1.map
similarity index 100%
rename from tools/aconfig/aconfig_storage_file/tests/data/v1/flag.map
rename to tools/aconfig/aconfig_storage_file/tests/data/v1/flag_v1.map
Binary files differ
diff --git a/tools/aconfig/aconfig_storage_file/tests/data/v1/flag.val b/tools/aconfig/aconfig_storage_file/tests/data/v1/flag_v1.val
similarity index 100%
rename from tools/aconfig/aconfig_storage_file/tests/data/v1/flag.val
rename to tools/aconfig/aconfig_storage_file/tests/data/v1/flag_v1.val
Binary files differ
diff --git a/tools/aconfig/aconfig_storage_file/tests/data/v1/package.map b/tools/aconfig/aconfig_storage_file/tests/data/v1/package_v1.map
similarity index 100%
rename from tools/aconfig/aconfig_storage_file/tests/data/v1/package.map
rename to tools/aconfig/aconfig_storage_file/tests/data/v1/package_v1.map
Binary files differ
diff --git a/tools/aconfig/aconfig_storage_file/tests/data/v2/flag_v2.info b/tools/aconfig/aconfig_storage_file/tests/data/v2/flag_v2.info
new file mode 100644
index 0000000..9db7fde
--- /dev/null
+++ b/tools/aconfig/aconfig_storage_file/tests/data/v2/flag_v2.info
Binary files differ
diff --git a/tools/aconfig/aconfig_storage_file/tests/data/v2/flag_v2.map b/tools/aconfig/aconfig_storage_file/tests/data/v2/flag_v2.map
new file mode 100644
index 0000000..cf4685c
--- /dev/null
+++ b/tools/aconfig/aconfig_storage_file/tests/data/v2/flag_v2.map
Binary files differ
diff --git a/tools/aconfig/aconfig_storage_file/tests/data/v2/flag_v2.val b/tools/aconfig/aconfig_storage_file/tests/data/v2/flag_v2.val
new file mode 100644
index 0000000..37d4750
--- /dev/null
+++ b/tools/aconfig/aconfig_storage_file/tests/data/v2/flag_v2.val
Binary files differ
diff --git a/tools/aconfig/aconfig_storage_file/tests/data/v2/package_v2.map b/tools/aconfig/aconfig_storage_file/tests/data/v2/package_v2.map
new file mode 100644
index 0000000..16f4054
--- /dev/null
+++ b/tools/aconfig/aconfig_storage_file/tests/data/v2/package_v2.map
Binary files differ
diff --git a/tools/aconfig/aconfig_storage_file/tests/jarjar.txt b/tools/aconfig/aconfig_storage_file/tests/jarjar.txt
index a6c17fa..24952ec 100644
--- a/tools/aconfig/aconfig_storage_file/tests/jarjar.txt
+++ b/tools/aconfig/aconfig_storage_file/tests/jarjar.txt
@@ -7,6 +7,8 @@
rule android.aconfig.storage.FileType android.aconfig.storage.test.FileType
rule android.aconfig.storage.FlagValueList android.aconfig.storage.test.FlagValueList
rule android.aconfig.storage.TableUtils android.aconfig.storage.test.TableUtils
+rule android.aconfig.storage.AconfigPackageImpl android.aconfig.storage.test.AconfigPackageImpl
+rule android.aconfig.storage.StorageFileProvider android.aconfig.storage.test.StorageFileProvider
rule android.aconfig.storage.FlagTable$* android.aconfig.storage.test.FlagTable$@1
diff --git a/tools/aconfig/aconfig_storage_file/tests/srcs/FlagTableTest.java b/tools/aconfig/aconfig_storage_file/tests/srcs/FlagTableTest.java
index fd40d4c..dc465b6 100644
--- a/tools/aconfig/aconfig_storage_file/tests/srcs/FlagTableTest.java
+++ b/tools/aconfig/aconfig_storage_file/tests/srcs/FlagTableTest.java
@@ -31,7 +31,7 @@
@Test
public void testFlagTable_rightHeader() throws Exception {
- FlagTable flagTable = FlagTable.fromBytes(TestDataUtils.getTestFlagMapByteBuffer());
+ FlagTable flagTable = FlagTable.fromBytes(TestDataUtils.getTestFlagMapByteBuffer(1));
FlagTable.Header header = flagTable.getHeader();
assertEquals(1, header.getVersion());
assertEquals("mockup", header.getContainer());
@@ -44,7 +44,7 @@
@Test
public void testFlagTable_rightNode() throws Exception {
- FlagTable flagTable = FlagTable.fromBytes(TestDataUtils.getTestFlagMapByteBuffer());
+ FlagTable flagTable = FlagTable.fromBytes(TestDataUtils.getTestFlagMapByteBuffer(1));
FlagTable.Node node1 = flagTable.get(0, "enabled_ro");
FlagTable.Node node2 = flagTable.get(0, "enabled_rw");
diff --git a/tools/aconfig/aconfig_storage_file/tests/srcs/FlagValueListTest.java b/tools/aconfig/aconfig_storage_file/tests/srcs/FlagValueListTest.java
index 1b0de63..306df7d 100644
--- a/tools/aconfig/aconfig_storage_file/tests/srcs/FlagValueListTest.java
+++ b/tools/aconfig/aconfig_storage_file/tests/srcs/FlagValueListTest.java
@@ -34,7 +34,7 @@
@Test
public void testFlagValueList_rightHeader() throws Exception {
FlagValueList flagValueList =
- FlagValueList.fromBytes(TestDataUtils.getTestFlagValByteBuffer());
+ FlagValueList.fromBytes(TestDataUtils.getTestFlagValByteBuffer(1));
FlagValueList.Header header = flagValueList.getHeader();
assertEquals(1, header.getVersion());
assertEquals("mockup", header.getContainer());
@@ -47,7 +47,7 @@
@Test
public void testFlagValueList_rightNode() throws Exception {
FlagValueList flagValueList =
- FlagValueList.fromBytes(TestDataUtils.getTestFlagValByteBuffer());
+ FlagValueList.fromBytes(TestDataUtils.getTestFlagValByteBuffer(1));
boolean[] expected = new boolean[] {false, true, true, false, true, true, true, true};
assertEquals(expected.length, flagValueList.size());
@@ -60,11 +60,11 @@
@Test
public void testFlagValueList_getValue() throws Exception {
PackageTable packageTable =
- PackageTable.fromBytes(TestDataUtils.getTestPackageMapByteBuffer());
- FlagTable flagTable = FlagTable.fromBytes(TestDataUtils.getTestFlagMapByteBuffer());
+ PackageTable.fromBytes(TestDataUtils.getTestPackageMapByteBuffer(1));
+ FlagTable flagTable = FlagTable.fromBytes(TestDataUtils.getTestFlagMapByteBuffer(1));
FlagValueList flagValueList =
- FlagValueList.fromBytes(TestDataUtils.getTestFlagValByteBuffer());
+ FlagValueList.fromBytes(TestDataUtils.getTestFlagValByteBuffer(1));
PackageTable.Node pNode = packageTable.get("com.android.aconfig.storage.test_1");
FlagTable.Node fNode = flagTable.get(pNode.getPackageId(), "enabled_rw");
diff --git a/tools/aconfig/aconfig_storage_file/tests/srcs/PackageTableTest.java b/tools/aconfig/aconfig_storage_file/tests/srcs/PackageTableTest.java
index dc2ad92..4d7ab2a 100644
--- a/tools/aconfig/aconfig_storage_file/tests/srcs/PackageTableTest.java
+++ b/tools/aconfig/aconfig_storage_file/tests/srcs/PackageTableTest.java
@@ -18,6 +18,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import android.aconfig.storage.FileType;
import android.aconfig.storage.PackageTable;
@@ -32,7 +33,7 @@
@Test
public void testPackageTable_rightHeader() throws Exception {
PackageTable packageTable =
- PackageTable.fromBytes(TestDataUtils.getTestPackageMapByteBuffer());
+ PackageTable.fromBytes(TestDataUtils.getTestPackageMapByteBuffer(1));
PackageTable.Header header = packageTable.getHeader();
assertEquals(1, header.getVersion());
assertEquals("mockup", header.getContainer());
@@ -44,9 +45,23 @@
}
@Test
+ public void testPackageTable_rightHeader_v2() throws Exception {
+ PackageTable packageTable =
+ PackageTable.fromBytes(TestDataUtils.getTestPackageMapByteBuffer(2));
+ PackageTable.Header header = packageTable.getHeader();
+ assertEquals(2, header.getVersion());
+ assertEquals("mockup", header.getContainer());
+ assertEquals(FileType.PACKAGE_MAP, header.getFileType());
+ assertEquals(233, header.getFileSize());
+ assertEquals(3, header.getNumPackages());
+ assertEquals(31, header.getBucketOffset());
+ assertEquals(59, header.getNodeOffset());
+ }
+
+ @Test
public void testPackageTable_rightNode() throws Exception {
PackageTable packageTable =
- PackageTable.fromBytes(TestDataUtils.getTestPackageMapByteBuffer());
+ PackageTable.fromBytes(TestDataUtils.getTestPackageMapByteBuffer(1));
PackageTable.Node node1 = packageTable.get("com.android.aconfig.storage.test_1");
PackageTable.Node node2 = packageTable.get("com.android.aconfig.storage.test_2");
@@ -72,4 +87,34 @@
assertFalse(node2.hasPackageFingerprint());
assertFalse(node4.hasPackageFingerprint());
}
+
+ @Test
+ public void testPackageTable_rightNode_v2() throws Exception {
+ PackageTable packageTable =
+ PackageTable.fromBytes(TestDataUtils.getTestPackageMapByteBuffer(2));
+
+ PackageTable.Node node1 = packageTable.get("com.android.aconfig.storage.test_1");
+ PackageTable.Node node2 = packageTable.get("com.android.aconfig.storage.test_2");
+ PackageTable.Node node4 = packageTable.get("com.android.aconfig.storage.test_4");
+
+ assertEquals("com.android.aconfig.storage.test_1", node1.getPackageName());
+ assertEquals("com.android.aconfig.storage.test_2", node2.getPackageName());
+ assertEquals("com.android.aconfig.storage.test_4", node4.getPackageName());
+
+ assertEquals(0, node1.getPackageId());
+ assertEquals(1, node2.getPackageId());
+ assertEquals(2, node4.getPackageId());
+
+ assertEquals(0, node1.getBooleanStartIndex());
+ assertEquals(3, node2.getBooleanStartIndex());
+ assertEquals(6, node4.getBooleanStartIndex());
+
+ assertEquals(175, node1.getNextOffset());
+ assertEquals(-1, node2.getNextOffset());
+ assertEquals(-1, node4.getNextOffset());
+
+ assertTrue(node1.hasPackageFingerprint());
+ assertTrue(node2.hasPackageFingerprint());
+ assertTrue(node4.hasPackageFingerprint());
+ }
}
diff --git a/tools/aconfig/aconfig_storage_read_api/tests/java/StorageFileProviderTest.java b/tools/aconfig/aconfig_storage_file/tests/srcs/StorageFileProviderTest.java
similarity index 63%
rename from tools/aconfig/aconfig_storage_read_api/tests/java/StorageFileProviderTest.java
rename to tools/aconfig/aconfig_storage_file/tests/srcs/StorageFileProviderTest.java
index ba1ae9e..4e90e6c 100644
--- a/tools/aconfig/aconfig_storage_read_api/tests/java/StorageFileProviderTest.java
+++ b/tools/aconfig/aconfig_storage_file/tests/srcs/StorageFileProviderTest.java
@@ -17,7 +17,6 @@
package android.aconfig.storage.test;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -38,43 +37,31 @@
public class StorageFileProviderTest {
@Test
- public void testContainerFileExists() throws Exception {
- StorageFileProvider p =
- new StorageFileProvider(TestDataUtils.TESTDATA_PATH, TestDataUtils.TESTDATA_PATH);
- assertTrue(p.containerFileExists(null));
- assertTrue(p.containerFileExists("mockup"));
- assertFalse(p.containerFileExists("fake"));
- }
-
- @Test
public void testListpackageMapFiles() throws Exception {
StorageFileProvider p =
new StorageFileProvider(TestDataUtils.TESTDATA_PATH, TestDataUtils.TESTDATA_PATH);
- // throw new Exception(Environment.getExternalStorageDirectory().getAbsolutePath());
List<Path> file = p.listPackageMapFiles();
- assertEquals(1, file.size());
- assertTrue(
- file.get(0)
- .equals(
- Paths.get(
- TestDataUtils.TESTDATA_PATH,
- TestDataUtils.TEST_PACKAGE_MAP_PATH)));
+ assertEquals(2, file.size());
+
+ p = new StorageFileProvider("fake/path/", "fake/path/");
+ file = p.listPackageMapFiles();
+ assertTrue(file.isEmpty());
}
@Test
public void testLoadFiles() throws Exception {
StorageFileProvider p =
new StorageFileProvider(TestDataUtils.TESTDATA_PATH, TestDataUtils.TESTDATA_PATH);
- PackageTable pt = p.getPackageTable("mockup");
+ PackageTable pt = p.getPackageTable("mock.v1");
assertNotNull(pt);
pt =
StorageFileProvider.getPackageTable(
Paths.get(
- TestDataUtils.TESTDATA_PATH, TestDataUtils.TEST_PACKAGE_MAP_PATH));
+ TestDataUtils.TESTDATA_PATH, "mock.v1.package.map"));
assertNotNull(pt);
- FlagTable f = p.getFlagTable("mockup");
+ FlagTable f = p.getFlagTable("mock.v1");
assertNotNull(f);
- FlagValueList v = p.getFlagValueList("mockup");
+ FlagValueList v = p.getFlagValueList("mock.v1");
assertNotNull(v);
}
}
diff --git a/tools/aconfig/aconfig_storage_file/tests/srcs/TestDataUtils.java b/tools/aconfig/aconfig_storage_file/tests/srcs/TestDataUtils.java
index f35952d..388971e 100644
--- a/tools/aconfig/aconfig_storage_file/tests/srcs/TestDataUtils.java
+++ b/tools/aconfig/aconfig_storage_file/tests/srcs/TestDataUtils.java
@@ -21,28 +21,27 @@
import java.nio.ByteBuffer;
public final class TestDataUtils {
- private static final String TEST_PACKAGE_MAP_PATH = "package.map";
- private static final String TEST_FLAG_MAP_PATH = "flag.map";
- private static final String TEST_FLAG_VAL_PATH = "flag.val";
- private static final String TEST_FLAG_INFO_PATH = "flag.info";
+ private static final String TEST_PACKAGE_MAP_PATH = "mock.v%d.package.map";
+ private static final String TEST_FLAG_MAP_PATH = "mock.v%d.flag.map";
+ private static final String TEST_FLAG_VAL_PATH = "mock.v%d.val";
+ private static final String TEST_FLAG_INFO_PATH = "mock.v%d.info";
- private static final String TESTDATA_PATH =
- "/data/local/tmp/aconfig_storage_file_test_java/testdata/";
+ public static final String TESTDATA_PATH = "/data/local/tmp/aconfig_storage_file_test_java/testdata/";
- public static ByteBuffer getTestPackageMapByteBuffer() throws Exception {
- return readFile(TESTDATA_PATH + TEST_PACKAGE_MAP_PATH);
+ public static ByteBuffer getTestPackageMapByteBuffer(int version) throws Exception {
+ return readFile(TESTDATA_PATH + String.format(TEST_PACKAGE_MAP_PATH, version));
}
- public static ByteBuffer getTestFlagMapByteBuffer() throws Exception {
- return readFile(TESTDATA_PATH + TEST_FLAG_MAP_PATH);
+ public static ByteBuffer getTestFlagMapByteBuffer(int version) throws Exception {
+ return readFile(TESTDATA_PATH + String.format(TEST_FLAG_MAP_PATH, version));
}
- public static ByteBuffer getTestFlagValByteBuffer() throws Exception {
- return readFile(TESTDATA_PATH + TEST_FLAG_VAL_PATH);
+ public static ByteBuffer getTestFlagValByteBuffer(int version) throws Exception {
+ return readFile(TESTDATA_PATH + String.format(TEST_FLAG_VAL_PATH, version));
}
- public static ByteBuffer getTestFlagInfoByteBuffer() throws Exception {
- return readFile(TESTDATA_PATH + TEST_FLAG_INFO_PATH);
+ public static ByteBuffer getTestFlagInfoByteBuffer(int version) throws Exception {
+ return readFile(TESTDATA_PATH + String.format(TEST_FLAG_INFO_PATH, version));
}
private static ByteBuffer readFile(String fileName) throws Exception {
diff --git a/tools/aconfig/aconfig_storage_file/tests/storage_file_test.cpp b/tools/aconfig/aconfig_storage_file/tests/storage_file_test.cpp
index 3626f72..5c008af 100644
--- a/tools/aconfig/aconfig_storage_file/tests/storage_file_test.cpp
+++ b/tools/aconfig/aconfig_storage_file/tests/storage_file_test.cpp
@@ -24,10 +24,8 @@
using namespace android::base;
using namespace aconfig_storage;
-void verify_value(const FlagValueSummary& flag,
- const std::string& package_name,
- const std::string& flag_name,
- const std::string& flag_val,
+void verify_value(const FlagValueSummary& flag, const std::string& package_name,
+ const std::string& flag_name, const std::string& flag_val,
const std::string& value_type) {
ASSERT_EQ(flag.package_name, package_name);
ASSERT_EQ(flag.flag_name, flag_name);
@@ -39,10 +37,8 @@
const std::string& package_name,
const std::string& flag_name,
const std::string& flag_val,
- const std::string& value_type,
- bool is_readwrite,
- bool has_server_override,
- bool has_local_override) {
+ const std::string& value_type, bool is_readwrite,
+ bool has_server_override, bool has_local_override) {
ASSERT_EQ(flag.package_name, package_name);
ASSERT_EQ(flag.flag_name, flag_name);
ASSERT_EQ(flag.flag_value, flag_val);
@@ -52,63 +48,137 @@
ASSERT_EQ(flag.has_local_override, has_local_override);
}
-TEST(AconfigStorageFileTest, test_list_flag) {
+Result<std::vector<FlagValueSummary>> get_flag_list_result(
+ const std::string version) {
auto const test_base_dir = GetExecutableDirectory();
- auto const test_dir = test_base_dir + "/data/v1";
- auto const package_map = test_dir + "/package.map";
- auto const flag_map = test_dir + "/flag.map";
- auto const flag_val = test_dir + "/flag.val";
- auto flag_list_result = aconfig_storage::list_flags(
- package_map, flag_map, flag_val);
+ auto const test_dir = test_base_dir + "/data/v" + version;
+ auto const package_map = test_dir + "/package_v" + version + ".map";
+ auto const flag_map = test_dir + "/flag_v" + version + ".map";
+ auto const flag_val = test_dir + "/flag_v" + version + ".val";
+ return aconfig_storage::list_flags(package_map, flag_map, flag_val);
+}
+
+Result<std::vector<FlagValueAndInfoSummary>> get_flag_list_result_with_info(
+ const std::string version) {
+ auto const test_base_dir = GetExecutableDirectory();
+ auto const test_dir = test_base_dir + "/data/v" + version;
+ auto const package_map = test_dir + "/package_v" + version + ".map";
+ auto const flag_map = test_dir + "/flag_v" + version + ".map";
+ auto const flag_val = test_dir + "/flag_v" + version + ".val";
+ auto const flag_info = test_dir + "/flag_v" + version + ".info";
+ return aconfig_storage::list_flags_with_info(package_map, flag_map, flag_val,
+ flag_info);
+}
+
+TEST(AconfigStorageFileTest, test_list_flag) {
+ auto flag_list_result = get_flag_list_result("1");
ASSERT_TRUE(flag_list_result.ok());
auto const& flag_list = *flag_list_result;
ASSERT_EQ(flag_list.size(), 8);
- verify_value(flag_list[0], "com.android.aconfig.storage.test_1", "disabled_rw",
- "false", "ReadWriteBoolean");
+ verify_value(flag_list[0], "com.android.aconfig.storage.test_1",
+ "disabled_rw", "false", "ReadWriteBoolean");
verify_value(flag_list[1], "com.android.aconfig.storage.test_1", "enabled_ro",
"true", "ReadOnlyBoolean");
verify_value(flag_list[2], "com.android.aconfig.storage.test_1", "enabled_rw",
"true", "ReadWriteBoolean");
- verify_value(flag_list[3], "com.android.aconfig.storage.test_2", "disabled_rw",
- "false", "ReadWriteBoolean");
- verify_value(flag_list[4], "com.android.aconfig.storage.test_2", "enabled_fixed_ro",
- "true", "FixedReadOnlyBoolean");
+ verify_value(flag_list[3], "com.android.aconfig.storage.test_2",
+ "disabled_rw", "false", "ReadWriteBoolean");
+ verify_value(flag_list[4], "com.android.aconfig.storage.test_2",
+ "enabled_fixed_ro", "true", "FixedReadOnlyBoolean");
verify_value(flag_list[5], "com.android.aconfig.storage.test_2", "enabled_ro",
"true", "ReadOnlyBoolean");
- verify_value(flag_list[6], "com.android.aconfig.storage.test_4", "enabled_fixed_ro",
- "true", "FixedReadOnlyBoolean");
+ verify_value(flag_list[6], "com.android.aconfig.storage.test_4",
+ "enabled_fixed_ro", "true", "FixedReadOnlyBoolean");
+ verify_value(flag_list[7], "com.android.aconfig.storage.test_4", "enabled_rw",
+ "true", "ReadWriteBoolean");
+}
+
+// TODO: b/376256472 - Use parameterized tests.
+TEST(AconfigStorageFileTest, test_list_flag_v2) {
+ auto flag_list_result = get_flag_list_result("2");
+ ASSERT_TRUE(flag_list_result.ok());
+
+ auto const& flag_list = *flag_list_result;
+ ASSERT_EQ(flag_list.size(), 8);
+ verify_value(flag_list[0], "com.android.aconfig.storage.test_1",
+ "disabled_rw", "false", "ReadWriteBoolean");
+ verify_value(flag_list[1], "com.android.aconfig.storage.test_1", "enabled_ro",
+ "true", "ReadOnlyBoolean");
+ verify_value(flag_list[2], "com.android.aconfig.storage.test_1", "enabled_rw",
+ "true", "ReadWriteBoolean");
+ verify_value(flag_list[3], "com.android.aconfig.storage.test_2",
+ "disabled_rw", "false", "ReadWriteBoolean");
+ verify_value(flag_list[4], "com.android.aconfig.storage.test_2",
+ "enabled_fixed_ro", "true", "FixedReadOnlyBoolean");
+ verify_value(flag_list[5], "com.android.aconfig.storage.test_2", "enabled_ro",
+ "true", "ReadOnlyBoolean");
+ verify_value(flag_list[6], "com.android.aconfig.storage.test_4",
+ "enabled_fixed_ro", "true", "FixedReadOnlyBoolean");
verify_value(flag_list[7], "com.android.aconfig.storage.test_4", "enabled_rw",
"true", "ReadWriteBoolean");
}
TEST(AconfigStorageFileTest, test_list_flag_with_info) {
- auto const base_test_dir = GetExecutableDirectory();
- auto const test_dir = base_test_dir + "/data/v1";
- auto const package_map = test_dir + "/package.map";
- auto const flag_map = test_dir + "/flag.map";
- auto const flag_val = test_dir + "/flag.val";
- auto const flag_info = test_dir + "/flag.info";
- auto flag_list_result = aconfig_storage::list_flags_with_info(
- package_map, flag_map, flag_val, flag_info);
+ auto flag_list_result = get_flag_list_result_with_info("1");
ASSERT_TRUE(flag_list_result.ok());
auto const& flag_list = *flag_list_result;
ASSERT_EQ(flag_list.size(), 8);
- verify_value_info(flag_list[0], "com.android.aconfig.storage.test_1", "disabled_rw",
- "false", "ReadWriteBoolean", true, false, false);
- verify_value_info(flag_list[1], "com.android.aconfig.storage.test_1", "enabled_ro",
- "true", "ReadOnlyBoolean", false, false, false);
- verify_value_info(flag_list[2], "com.android.aconfig.storage.test_1", "enabled_rw",
- "true", "ReadWriteBoolean", true, false, false);
- verify_value_info(flag_list[3], "com.android.aconfig.storage.test_2", "disabled_rw",
- "false", "ReadWriteBoolean", true, false, false);
- verify_value_info(flag_list[4], "com.android.aconfig.storage.test_2", "enabled_fixed_ro",
- "true", "FixedReadOnlyBoolean", false, false, false);
- verify_value_info(flag_list[5], "com.android.aconfig.storage.test_2", "enabled_ro",
- "true", "ReadOnlyBoolean", false, false, false);
- verify_value_info(flag_list[6], "com.android.aconfig.storage.test_4", "enabled_fixed_ro",
- "true", "FixedReadOnlyBoolean", false, false, false);
- verify_value_info(flag_list[7], "com.android.aconfig.storage.test_4", "enabled_rw",
- "true", "ReadWriteBoolean", true, false, false);
+ verify_value_info(flag_list[0], "com.android.aconfig.storage.test_1",
+ "disabled_rw", "false", "ReadWriteBoolean", true, false,
+ false);
+ verify_value_info(flag_list[1], "com.android.aconfig.storage.test_1",
+ "enabled_ro", "true", "ReadOnlyBoolean", false, false,
+ false);
+ verify_value_info(flag_list[2], "com.android.aconfig.storage.test_1",
+ "enabled_rw", "true", "ReadWriteBoolean", true, false,
+ false);
+ verify_value_info(flag_list[3], "com.android.aconfig.storage.test_2",
+ "disabled_rw", "false", "ReadWriteBoolean", true, false,
+ false);
+ verify_value_info(flag_list[4], "com.android.aconfig.storage.test_2",
+ "enabled_fixed_ro", "true", "FixedReadOnlyBoolean", false,
+ false, false);
+ verify_value_info(flag_list[5], "com.android.aconfig.storage.test_2",
+ "enabled_ro", "true", "ReadOnlyBoolean", false, false,
+ false);
+ verify_value_info(flag_list[6], "com.android.aconfig.storage.test_4",
+ "enabled_fixed_ro", "true", "FixedReadOnlyBoolean", false,
+ false, false);
+ verify_value_info(flag_list[7], "com.android.aconfig.storage.test_4",
+ "enabled_rw", "true", "ReadWriteBoolean", true, false,
+ false);
+}
+
+TEST(AconfigStorageFileTest, test_list_flag_with_info_v2) {
+ auto flag_list_result = get_flag_list_result_with_info("2");
+ ASSERT_TRUE(flag_list_result.ok());
+
+ auto const& flag_list = *flag_list_result;
+ ASSERT_EQ(flag_list.size(), 8);
+ verify_value_info(flag_list[0], "com.android.aconfig.storage.test_1",
+ "disabled_rw", "false", "ReadWriteBoolean", true, false,
+ false);
+ verify_value_info(flag_list[1], "com.android.aconfig.storage.test_1",
+ "enabled_ro", "true", "ReadOnlyBoolean", false, false,
+ false);
+ verify_value_info(flag_list[2], "com.android.aconfig.storage.test_1",
+ "enabled_rw", "true", "ReadWriteBoolean", true, false,
+ false);
+ verify_value_info(flag_list[3], "com.android.aconfig.storage.test_2",
+ "disabled_rw", "false", "ReadWriteBoolean", true, false,
+ false);
+ verify_value_info(flag_list[4], "com.android.aconfig.storage.test_2",
+ "enabled_fixed_ro", "true", "FixedReadOnlyBoolean", false,
+ false, false);
+ verify_value_info(flag_list[5], "com.android.aconfig.storage.test_2",
+ "enabled_ro", "true", "ReadOnlyBoolean", false, false,
+ false);
+ verify_value_info(flag_list[6], "com.android.aconfig.storage.test_4",
+ "enabled_fixed_ro", "true", "FixedReadOnlyBoolean", false,
+ false, false);
+ verify_value_info(flag_list[7], "com.android.aconfig.storage.test_4",
+ "enabled_rw", "true", "ReadWriteBoolean", true, false,
+ false);
}
diff --git a/tools/aconfig/aconfig_storage_read_api/Android.bp b/tools/aconfig/aconfig_storage_read_api/Android.bp
index 666c5ba..3238d79 100644
--- a/tools/aconfig/aconfig_storage_read_api/Android.bp
+++ b/tools/aconfig/aconfig_storage_read_api/Android.bp
@@ -36,10 +36,10 @@
"librand",
],
data: [
- "tests/data/v1/package.map",
- "tests/data/v1/flag.map",
- "tests/data/v1/flag.val",
- "tests/data/v1/flag.info",
+ "tests/data/v1/package_v1.map",
+ "tests/data/v1/flag_v1.map",
+ "tests/data/v1/flag_v1.val",
+ "tests/data/v1/flag_v1.info",
],
}
@@ -155,7 +155,6 @@
name: "aconfig_storage_reader_java",
srcs: [
"srcs/android/aconfig/storage/AconfigPackageImpl.java",
- "srcs/android/aconfig/storage/StorageFileProvider.java",
"srcs/android/aconfig/storage/StorageInternalReader.java",
],
libs: [
@@ -178,7 +177,6 @@
name: "aconfig_storage_reader_java_none",
srcs: [
"srcs/android/aconfig/storage/AconfigPackageImpl.java",
- "srcs/android/aconfig/storage/StorageFileProvider.java",
"srcs/android/aconfig/storage/StorageInternalReader.java",
],
libs: [
diff --git a/tools/aconfig/aconfig_storage_read_api/src/flag_info_query.rs b/tools/aconfig/aconfig_storage_read_api/src/flag_info_query.rs
index fe57a6d..68b6193 100644
--- a/tools/aconfig/aconfig_storage_read_api/src/flag_info_query.rs
+++ b/tools/aconfig/aconfig_storage_read_api/src/flag_info_query.rs
@@ -55,12 +55,14 @@
#[cfg(test)]
mod tests {
use super::*;
- use aconfig_storage_file::{test_utils::create_test_flag_info_list, FlagInfoBit};
+ use aconfig_storage_file::{
+ test_utils::create_test_flag_info_list, FlagInfoBit, DEFAULT_FILE_VERSION,
+ };
#[test]
// this test point locks down query if flag has server override
fn test_is_flag_sticky() {
- let flag_info_list = create_test_flag_info_list().into_bytes();
+ let flag_info_list = create_test_flag_info_list(DEFAULT_FILE_VERSION).into_bytes();
for offset in 0..8 {
let attribute =
find_flag_attribute(&flag_info_list[..], FlagValueType::Boolean, offset).unwrap();
@@ -71,7 +73,7 @@
#[test]
// this test point locks down query if flag is readwrite
fn test_is_flag_readwrite() {
- let flag_info_list = create_test_flag_info_list().into_bytes();
+ let flag_info_list = create_test_flag_info_list(DEFAULT_FILE_VERSION).into_bytes();
let baseline: Vec<bool> = vec![true, false, true, true, false, false, false, true];
for offset in 0..8 {
let attribute =
@@ -86,7 +88,7 @@
#[test]
// this test point locks down query if flag has local override
fn test_flag_has_override() {
- let flag_info_list = create_test_flag_info_list().into_bytes();
+ let flag_info_list = create_test_flag_info_list(DEFAULT_FILE_VERSION).into_bytes();
for offset in 0..8 {
let attribute =
find_flag_attribute(&flag_info_list[..], FlagValueType::Boolean, offset).unwrap();
@@ -97,7 +99,7 @@
#[test]
// this test point locks down query beyond the end of boolean section
fn test_boolean_out_of_range() {
- let flag_info_list = create_test_flag_info_list().into_bytes();
+ let flag_info_list = create_test_flag_info_list(DEFAULT_FILE_VERSION).into_bytes();
let error =
find_flag_attribute(&flag_info_list[..], FlagValueType::Boolean, 8).unwrap_err();
assert_eq!(
@@ -109,7 +111,7 @@
#[test]
// this test point locks down query error when file has a higher version
fn test_higher_version_storage_file() {
- let mut info_list = create_test_flag_info_list();
+ let mut info_list = create_test_flag_info_list(DEFAULT_FILE_VERSION);
info_list.header.version = MAX_SUPPORTED_FILE_VERSION + 1;
let flag_info = info_list.into_bytes();
let error = find_flag_attribute(&flag_info[..], FlagValueType::Boolean, 4).unwrap_err();
diff --git a/tools/aconfig/aconfig_storage_read_api/src/flag_table_query.rs b/tools/aconfig/aconfig_storage_read_api/src/flag_table_query.rs
index e9bc604..3e87acc 100644
--- a/tools/aconfig/aconfig_storage_read_api/src/flag_table_query.rs
+++ b/tools/aconfig/aconfig_storage_read_api/src/flag_table_query.rs
@@ -74,12 +74,12 @@
#[cfg(test)]
mod tests {
use super::*;
- use aconfig_storage_file::test_utils::create_test_flag_table;
+ use aconfig_storage_file::{test_utils::create_test_flag_table, DEFAULT_FILE_VERSION};
#[test]
// this test point locks down table query
fn test_flag_query() {
- let flag_table = create_test_flag_table().into_bytes();
+ let flag_table = create_test_flag_table(DEFAULT_FILE_VERSION).into_bytes();
let baseline = vec![
(0, "enabled_ro", StoredFlagType::ReadOnlyBoolean, 1u16),
(0, "enabled_rw", StoredFlagType::ReadWriteBoolean, 2u16),
@@ -101,7 +101,7 @@
#[test]
// this test point locks down table query of a non exist flag
fn test_not_existed_flag_query() {
- let flag_table = create_test_flag_table().into_bytes();
+ let flag_table = create_test_flag_table(DEFAULT_FILE_VERSION).into_bytes();
let flag_context = find_flag_read_context(&flag_table[..], 1, "disabled_fixed_ro").unwrap();
assert_eq!(flag_context, None);
let flag_context = find_flag_read_context(&flag_table[..], 2, "disabled_rw").unwrap();
@@ -111,7 +111,7 @@
#[test]
// this test point locks down query error when file has a higher version
fn test_higher_version_storage_file() {
- let mut table = create_test_flag_table();
+ let mut table = create_test_flag_table(DEFAULT_FILE_VERSION);
table.header.version = MAX_SUPPORTED_FILE_VERSION + 1;
let flag_table = table.into_bytes();
let error = find_flag_read_context(&flag_table[..], 0, "enabled_ro").unwrap_err();
diff --git a/tools/aconfig/aconfig_storage_read_api/src/flag_value_query.rs b/tools/aconfig/aconfig_storage_read_api/src/flag_value_query.rs
index 12c1e83..35f5692 100644
--- a/tools/aconfig/aconfig_storage_read_api/src/flag_value_query.rs
+++ b/tools/aconfig/aconfig_storage_read_api/src/flag_value_query.rs
@@ -48,12 +48,12 @@
#[cfg(test)]
mod tests {
use super::*;
- use aconfig_storage_file::test_utils::create_test_flag_value_list;
+ use aconfig_storage_file::{test_utils::create_test_flag_value_list, DEFAULT_FILE_VERSION};
#[test]
// this test point locks down flag value query
fn test_flag_value_query() {
- let flag_value_list = create_test_flag_value_list().into_bytes();
+ let flag_value_list = create_test_flag_value_list(DEFAULT_FILE_VERSION).into_bytes();
let baseline: Vec<bool> = vec![false, true, true, false, true, true, true, true];
for (offset, expected_value) in baseline.into_iter().enumerate() {
let flag_value = find_boolean_flag_value(&flag_value_list[..], offset as u32).unwrap();
@@ -64,7 +64,7 @@
#[test]
// this test point locks down query beyond the end of boolean section
fn test_boolean_out_of_range() {
- let flag_value_list = create_test_flag_value_list().into_bytes();
+ let flag_value_list = create_test_flag_value_list(DEFAULT_FILE_VERSION).into_bytes();
let error = find_boolean_flag_value(&flag_value_list[..], 8).unwrap_err();
assert_eq!(
format!("{:?}", error),
@@ -75,7 +75,7 @@
#[test]
// this test point locks down query error when file has a higher version
fn test_higher_version_storage_file() {
- let mut value_list = create_test_flag_value_list();
+ let mut value_list = create_test_flag_value_list(DEFAULT_FILE_VERSION);
value_list.header.version = MAX_SUPPORTED_FILE_VERSION + 1;
let flag_value = value_list.into_bytes();
let error = find_boolean_flag_value(&flag_value[..], 4).unwrap_err();
diff --git a/tools/aconfig/aconfig_storage_read_api/src/lib.rs b/tools/aconfig/aconfig_storage_read_api/src/lib.rs
index 5104cd0..6e98fe9 100644
--- a/tools/aconfig/aconfig_storage_read_api/src/lib.rs
+++ b/tools/aconfig/aconfig_storage_read_api/src/lib.rs
@@ -413,10 +413,10 @@
let flag_map = storage_dir.clone() + "/maps/mockup.flag.map";
let flag_val = storage_dir.clone() + "/boot/mockup.val";
let flag_info = storage_dir.clone() + "/boot/mockup.info";
- fs::copy("./tests/data/v1/package.map", &package_map).unwrap();
- fs::copy("./tests/data/v1/flag.map", &flag_map).unwrap();
- fs::copy("./tests/data/v1/flag.val", &flag_val).unwrap();
- fs::copy("./tests/data/v1/flag.info", &flag_info).unwrap();
+ fs::copy("./tests/data/v1/package_v1.map", &package_map).unwrap();
+ fs::copy("./tests/data/v1/flag_v1.map", &flag_map).unwrap();
+ fs::copy("./tests/data/v1/flag_v1.val", &flag_val).unwrap();
+ fs::copy("./tests/data/v1/flag_v1.info", &flag_info).unwrap();
return storage_dir;
}
@@ -508,9 +508,9 @@
#[test]
// this test point locks down flag storage file version number query api
fn test_storage_version_query() {
- assert_eq!(get_storage_file_version("./tests/data/v1/package.map").unwrap(), 1);
- assert_eq!(get_storage_file_version("./tests/data/v1/flag.map").unwrap(), 1);
- assert_eq!(get_storage_file_version("./tests/data/v1/flag.val").unwrap(), 1);
- assert_eq!(get_storage_file_version("./tests/data/v1/flag.info").unwrap(), 1);
+ assert_eq!(get_storage_file_version("./tests/data/v1/package_v1.map").unwrap(), 1);
+ assert_eq!(get_storage_file_version("./tests/data/v1/flag_v1.map").unwrap(), 1);
+ assert_eq!(get_storage_file_version("./tests/data/v1/flag_v1.val").unwrap(), 1);
+ assert_eq!(get_storage_file_version("./tests/data/v1/flag_v1.info").unwrap(), 1);
}
}
diff --git a/tools/aconfig/aconfig_storage_read_api/src/mapped_file.rs b/tools/aconfig/aconfig_storage_read_api/src/mapped_file.rs
index 2c1884a..f4e269e 100644
--- a/tools/aconfig/aconfig_storage_read_api/src/mapped_file.rs
+++ b/tools/aconfig/aconfig_storage_read_api/src/mapped_file.rs
@@ -97,10 +97,10 @@
let flag_map = storage_dir.clone() + "/maps/mockup.flag.map";
let flag_val = storage_dir.clone() + "/boot/mockup.val";
let flag_info = storage_dir.clone() + "/boot/mockup.info";
- fs::copy("./tests/data/v1/package.map", &package_map).unwrap();
- fs::copy("./tests/data/v1/flag.map", &flag_map).unwrap();
- fs::copy("./tests/data/v1/flag.val", &flag_val).unwrap();
- fs::copy("./tests/data/v1/flag.info", &flag_info).unwrap();
+ fs::copy("./tests/data/v1/package_v1.map", &package_map).unwrap();
+ fs::copy("./tests/data/v1/flag_v1.map", &flag_map).unwrap();
+ fs::copy("./tests/data/v1/flag_v1.val", &flag_val).unwrap();
+ fs::copy("./tests/data/v1/flag_v1.info", &flag_info).unwrap();
return storage_dir;
}
@@ -108,9 +108,9 @@
#[test]
fn test_mapped_file_contents() {
let storage_dir = create_test_storage_files();
- map_and_verify(&storage_dir, StorageFileType::PackageMap, "./tests/data/v1/package.map");
- map_and_verify(&storage_dir, StorageFileType::FlagMap, "./tests/data/v1/flag.map");
- map_and_verify(&storage_dir, StorageFileType::FlagVal, "./tests/data/v1/flag.val");
- map_and_verify(&storage_dir, StorageFileType::FlagInfo, "./tests/data/v1/flag.info");
+ map_and_verify(&storage_dir, StorageFileType::PackageMap, "./tests/data/v1/package_v1.map");
+ map_and_verify(&storage_dir, StorageFileType::FlagMap, "./tests/data/v1/flag_v1.map");
+ map_and_verify(&storage_dir, StorageFileType::FlagVal, "./tests/data/v1/flag_v1.val");
+ map_and_verify(&storage_dir, StorageFileType::FlagInfo, "./tests/data/v1/flag_v1.info");
}
}
diff --git a/tools/aconfig/aconfig_storage_read_api/src/package_table_query.rs b/tools/aconfig/aconfig_storage_read_api/src/package_table_query.rs
index acb60f6..a4b63ab 100644
--- a/tools/aconfig/aconfig_storage_read_api/src/package_table_query.rs
+++ b/tools/aconfig/aconfig_storage_read_api/src/package_table_query.rs
@@ -74,12 +74,12 @@
#[cfg(test)]
mod tests {
use super::*;
- use aconfig_storage_file::test_utils::create_test_package_table;
+ use aconfig_storage_file::{test_utils::create_test_package_table, DEFAULT_FILE_VERSION};
#[test]
// this test point locks down table query
fn test_package_query() {
- let package_table = create_test_package_table().into_bytes();
+ let package_table = create_test_package_table(DEFAULT_FILE_VERSION).into_bytes();
let package_context =
find_package_read_context(&package_table[..], "com.android.aconfig.storage.test_1")
.unwrap()
@@ -104,7 +104,7 @@
// this test point locks down table query of a non exist package
fn test_not_existed_package_query() {
// this will land at an empty bucket
- let package_table = create_test_package_table().into_bytes();
+ let package_table = create_test_package_table(DEFAULT_FILE_VERSION).into_bytes();
let package_context =
find_package_read_context(&package_table[..], "com.android.aconfig.storage.test_3")
.unwrap();
@@ -119,7 +119,7 @@
#[test]
// this test point locks down query error when file has a higher version
fn test_higher_version_storage_file() {
- let mut table = create_test_package_table();
+ let mut table = create_test_package_table(DEFAULT_FILE_VERSION);
table.header.version = MAX_SUPPORTED_FILE_VERSION + 1;
let package_table = table.into_bytes();
let error =
diff --git a/tools/aconfig/aconfig_storage_read_api/srcs/android/aconfig/storage/AconfigPackageImpl.java b/tools/aconfig/aconfig_storage_read_api/srcs/android/aconfig/storage/AconfigPackageImpl.java
index 5d8e7cb..6bf4e05 100644
--- a/tools/aconfig/aconfig_storage_read_api/srcs/android/aconfig/storage/AconfigPackageImpl.java
+++ b/tools/aconfig/aconfig_storage_read_api/srcs/android/aconfig/storage/AconfigPackageImpl.java
@@ -25,107 +25,98 @@
private FlagTable mFlagTable;
private FlagValueList mFlagValueList;
private PackageTable.Node mPNode;
+ private final int mPackageId;
+ private final int mBooleanStartIndex;
- /** @hide */
- public static final int ERROR_NEW_STORAGE_SYSTEM_NOT_FOUND = 1;
-
- /** @hide */
- public static final int ERROR_PACKAGE_NOT_FOUND = 2;
-
- /** @hide */
- public static final int ERROR_CONTAINER_NOT_FOUND = 3;
-
- /** @hide */
- public AconfigPackageImpl() {}
-
- /** @hide */
- public int load(String packageName, StorageFileProvider fileProvider) {
- return init(null, packageName, fileProvider);
+ private AconfigPackageImpl(
+ FlagTable flagTable,
+ FlagValueList flagValueList,
+ int packageId,
+ int booleanStartIndex) {
+ this.mFlagTable = flagTable;
+ this.mFlagValueList = flagValueList;
+ this.mPackageId = packageId;
+ this.mBooleanStartIndex = booleanStartIndex;
}
- /** @hide */
- public int load(String container, String packageName, StorageFileProvider fileProvider) {
- if (container == null) {
- return ERROR_CONTAINER_NOT_FOUND;
- }
-
- return init(container, packageName, fileProvider);
- }
-
- /** @hide */
- public boolean getBooleanFlagValue(String flagName, boolean defaultValue) {
- FlagTable.Node fNode = mFlagTable.get(mPNode.getPackageId(), flagName);
- // no such flag in this package
- if (fNode == null) return defaultValue;
- int index = fNode.getFlagIndex() + mPNode.getBooleanStartIndex();
- return mFlagValueList.getBoolean(index);
- }
-
- /** @hide */
- public boolean getBooleanFlagValue(int index) {
- return mFlagValueList.getBoolean(index + mPNode.getBooleanStartIndex());
- }
-
- /** @hide */
- public long getPackageFingerprint() {
- return mPNode.getPackageFingerprint();
- }
-
- /** @hide */
- public boolean hasPackageFingerprint() {
- return mPNode.hasPackageFingerprint();
- }
-
- private int init(String containerName, String packageName, StorageFileProvider fileProvider) {
+ public static AconfigPackageImpl load(String packageName, StorageFileProvider fileProvider) {
StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
- String container = containerName;
+ PackageTable.Node pNode = null;
try {
- // for devices don't have new storage directly return
- if (!fileProvider.containerFileExists(null)) {
- return ERROR_NEW_STORAGE_SYSTEM_NOT_FOUND;
- }
- PackageTable.Node pNode = null;
-
- if (container == null) {
- // Check if the device has flag files on the system partition.
- // If the device does, search the system partition first.
- container = "system";
- if (fileProvider.containerFileExists(container)) {
- pNode = fileProvider.getPackageTable(container).get(packageName);
- }
-
- if (pNode == null) {
- // Search all package map files if not found in the system partition.
- for (Path p : fileProvider.listPackageMapFiles()) {
- PackageTable pTable = StorageFileProvider.getPackageTable(p);
- pNode = pTable.get(packageName);
- if (pNode != null) {
- container = pTable.getHeader().getContainer();
- break;
- }
- }
- }
- } else {
- if (!fileProvider.containerFileExists(container)) {
- return ERROR_CONTAINER_NOT_FOUND;
- }
- pNode = fileProvider.getPackageTable(container).get(packageName);
- }
-
- if (pNode == null) {
- // for the case package is not found in all container, return instead of throwing
- // error
- return ERROR_PACKAGE_NOT_FOUND;
- }
-
- mFlagTable = fileProvider.getFlagTable(container);
- mFlagValueList = fileProvider.getFlagValueList(container);
- mPNode = pNode;
+ // First try to find the package in the "system" container.
+ pNode = fileProvider.getPackageTable("system").get(packageName);
} catch (Exception e) {
+ //
+ }
+ try {
+ if (pNode != null) {
+ return new AconfigPackageImpl(
+ fileProvider.getFlagTable("system"),
+ fileProvider.getFlagValueList("system"),
+ pNode.getPackageId(),
+ pNode.getBooleanStartIndex());
+ }
+
+ // If not found in "system", search all package map files.
+ for (Path p : fileProvider.listPackageMapFiles()) {
+ PackageTable pTable = fileProvider.getPackageTable(p);
+ pNode = pTable.get(packageName);
+ if (pNode != null) {
+ return new AconfigPackageImpl(
+ fileProvider.getFlagTable(pTable.getHeader().getContainer()),
+ fileProvider.getFlagValueList(pTable.getHeader().getContainer()),
+ pNode.getPackageId(),
+ pNode.getBooleanStartIndex());
+ }
+ }
+ } catch (AconfigStorageException e) {
+ // Consider logging the exception.
throw e;
} finally {
StrictMode.setThreadPolicy(oldPolicy);
}
- return 0;
+ // Package not found.
+ throw new AconfigStorageException(
+ AconfigStorageException.ERROR_PACKAGE_NOT_FOUND,
+ "Package " + packageName + " not found.");
+ }
+
+ public static AconfigPackageImpl load(
+ String container, String packageName, StorageFileProvider fileProvider) {
+
+ StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
+ try {
+ PackageTable.Node pNode = fileProvider.getPackageTable(container).get(packageName);
+ if (pNode != null) {
+ return new AconfigPackageImpl(
+ fileProvider.getFlagTable(container),
+ fileProvider.getFlagValueList(container),
+ pNode.getPackageId(),
+ pNode.getBooleanStartIndex());
+ }
+ } catch (AconfigStorageException e) {
+ // Consider logging the exception.
+ throw e;
+ } finally {
+ StrictMode.setThreadPolicy(oldPolicy);
+ }
+
+ throw new AconfigStorageException(
+ AconfigStorageException.ERROR_PACKAGE_NOT_FOUND,
+ "package "
+ + packageName
+ + " in container "
+ + container
+ + " cannot be found on the device");
+ }
+
+ public boolean getBooleanFlagValue(String flagName, boolean defaultValue) {
+ FlagTable.Node fNode = mFlagTable.get(mPackageId, flagName);
+ if (fNode == null) return defaultValue;
+ return mFlagValueList.getBoolean(fNode.getFlagIndex() + mBooleanStartIndex);
+ }
+
+ public boolean getBooleanFlagValue(int index) {
+ return mFlagValueList.getBoolean(index + mBooleanStartIndex);
}
}
diff --git a/tools/aconfig/aconfig_storage_read_api/tests/Android.bp b/tools/aconfig/aconfig_storage_read_api/tests/Android.bp
index b8e510d..6b8942b 100644
--- a/tools/aconfig/aconfig_storage_read_api/tests/Android.bp
+++ b/tools/aconfig/aconfig_storage_read_api/tests/Android.bp
@@ -1,10 +1,14 @@
filegroup {
name: "read_api_test_storage_files",
srcs: [
- "data/v1/package.map",
- "data/v1/flag.map",
- "data/v1/flag.val",
- "data/v1/flag.info",
+ "data/v1/package_v1.map",
+ "data/v1/flag_v1.map",
+ "data/v1/flag_v1.val",
+ "data/v1/flag_v1.info",
+ "data/v2/package_v2.map",
+ "data/v2/flag_v2.map",
+ "data/v2/flag_v2.val",
+ "data/v2/flag_v2.info",
],
}
diff --git a/tools/aconfig/aconfig_storage_read_api/tests/data/v1/flag.info b/tools/aconfig/aconfig_storage_read_api/tests/data/v1/flag_v1.info
similarity index 100%
rename from tools/aconfig/aconfig_storage_read_api/tests/data/v1/flag.info
rename to tools/aconfig/aconfig_storage_read_api/tests/data/v1/flag_v1.info
Binary files differ
diff --git a/tools/aconfig/aconfig_storage_read_api/tests/data/v1/flag.map b/tools/aconfig/aconfig_storage_read_api/tests/data/v1/flag_v1.map
similarity index 100%
rename from tools/aconfig/aconfig_storage_read_api/tests/data/v1/flag.map
rename to tools/aconfig/aconfig_storage_read_api/tests/data/v1/flag_v1.map
Binary files differ
diff --git a/tools/aconfig/aconfig_storage_read_api/tests/data/v1/flag.val b/tools/aconfig/aconfig_storage_read_api/tests/data/v1/flag_v1.val
similarity index 100%
rename from tools/aconfig/aconfig_storage_read_api/tests/data/v1/flag.val
rename to tools/aconfig/aconfig_storage_read_api/tests/data/v1/flag_v1.val
Binary files differ
diff --git a/tools/aconfig/aconfig_storage_read_api/tests/data/v1/package.map b/tools/aconfig/aconfig_storage_read_api/tests/data/v1/package_v1.map
similarity index 100%
rename from tools/aconfig/aconfig_storage_read_api/tests/data/v1/package.map
rename to tools/aconfig/aconfig_storage_read_api/tests/data/v1/package_v1.map
Binary files differ
diff --git a/tools/aconfig/aconfig_storage_read_api/tests/data/v2/flag_v2.info b/tools/aconfig/aconfig_storage_read_api/tests/data/v2/flag_v2.info
new file mode 100644
index 0000000..9db7fde
--- /dev/null
+++ b/tools/aconfig/aconfig_storage_read_api/tests/data/v2/flag_v2.info
Binary files differ
diff --git a/tools/aconfig/aconfig_storage_read_api/tests/data/v2/flag_v2.map b/tools/aconfig/aconfig_storage_read_api/tests/data/v2/flag_v2.map
new file mode 100644
index 0000000..cf4685c
--- /dev/null
+++ b/tools/aconfig/aconfig_storage_read_api/tests/data/v2/flag_v2.map
Binary files differ
diff --git a/tools/aconfig/aconfig_storage_read_api/tests/data/v2/flag_v2.val b/tools/aconfig/aconfig_storage_read_api/tests/data/v2/flag_v2.val
new file mode 100644
index 0000000..37d4750
--- /dev/null
+++ b/tools/aconfig/aconfig_storage_read_api/tests/data/v2/flag_v2.val
Binary files differ
diff --git a/tools/aconfig/aconfig_storage_read_api/tests/data/v2/package_v2.map b/tools/aconfig/aconfig_storage_read_api/tests/data/v2/package_v2.map
new file mode 100644
index 0000000..16f4054
--- /dev/null
+++ b/tools/aconfig/aconfig_storage_read_api/tests/data/v2/package_v2.map
Binary files differ
diff --git a/tools/aconfig/aconfig_storage_read_api/tests/java/AconfigPackageImplTest.java b/tools/aconfig/aconfig_storage_read_api/tests/java/AconfigPackageImplTest.java
index 8a72f0a..80c0994 100644
--- a/tools/aconfig/aconfig_storage_read_api/tests/java/AconfigPackageImplTest.java
+++ b/tools/aconfig/aconfig_storage_read_api/tests/java/AconfigPackageImplTest.java
@@ -43,53 +43,73 @@
@Test
public void testLoad_onlyPackageName() throws Exception {
- AconfigPackageImpl p = new AconfigPackageImpl();
- p.load("com.android.aconfig.storage.test_1", pr);
+ AconfigPackageImpl p = AconfigPackageImpl.load("com.android.aconfig.storage.test_1", pr);
assertNotNull(p);
}
@Test
public void testLoad_groupNameFingerprint() throws Exception {
- AconfigPackageImpl p = new AconfigPackageImpl();
- p.load("mockup", "com.android.aconfig.storage.test_1", pr);
+ AconfigPackageImpl p =
+ AconfigPackageImpl.load("mockup", "com.android.aconfig.storage.test_1", pr);
assertNotNull(p);
}
@Test
public void testLoad_error() throws Exception {
- AconfigPackageImpl p = new AconfigPackageImpl();
+ AconfigPackageImpl p;
// cannot find package
- assertEquals(
- AconfigPackageImpl.ERROR_PACKAGE_NOT_FOUND,
- p.load("mockup", "com.android.aconfig.storage.test_10", pr));
+ AconfigStorageException e =
+ assertThrows(
+ AconfigStorageException.class,
+ () ->
+ AconfigPackageImpl.load(
+ "mockup", "com.android.aconfig.storage.test_10", pr));
+ assertEquals(AconfigStorageException.ERROR_PACKAGE_NOT_FOUND, e.getErrorCode());
// cannot find package
- assertEquals(
- AconfigPackageImpl.ERROR_PACKAGE_NOT_FOUND,
- p.load("com.android.aconfig.storage.test_10", pr));
+ e =
+ assertThrows(
+ AconfigStorageException.class,
+ () -> AconfigPackageImpl.load("com.android.aconfig.storage.test_10", pr));
+ assertEquals(AconfigStorageException.ERROR_PACKAGE_NOT_FOUND, e.getErrorCode());
// cannot find container
- assertEquals(
- AconfigPackageImpl.ERROR_CONTAINER_NOT_FOUND,
- p.load(null, "com.android.aconfig.storage.test_1", pr));
- assertEquals(
- AconfigPackageImpl.ERROR_CONTAINER_NOT_FOUND,
- p.load("test", "com.android.aconfig.storage.test_1", pr));
+ e =
+ assertThrows(
+ AconfigStorageException.class,
+ () ->
+ AconfigPackageImpl.load(
+ null, "com.android.aconfig.storage.test_1", pr));
+ assertEquals(AconfigStorageException.ERROR_CANNOT_READ_STORAGE_FILE, e.getErrorCode());
+ e =
+ assertThrows(
+ AconfigStorageException.class,
+ () ->
+ AconfigPackageImpl.load(
+ "test", "com.android.aconfig.storage.test_1", pr));
+ assertEquals(AconfigStorageException.ERROR_CANNOT_READ_STORAGE_FILE, e.getErrorCode());
// new storage doesn't exist
pr = new StorageFileProvider("fake/path/", "fake/path/");
- assertEquals(
- AconfigPackageImpl.ERROR_NEW_STORAGE_SYSTEM_NOT_FOUND, p.load("fake_package", pr));
+ e =
+ assertThrows(
+ AconfigStorageException.class,
+ () -> AconfigPackageImpl.load("fake_package", pr));
+ assertEquals(AconfigStorageException.ERROR_PACKAGE_NOT_FOUND, e.getErrorCode());
// file read issue
pr = new StorageFileProvider(TestDataUtils.TESTDATA_PATH, "fake/path/");
- assertThrows(
- AconfigStorageException.class,
- () -> p.load("mockup", "com.android.aconfig.storage.test_1", pr));
+ e =
+ assertThrows(
+ AconfigStorageException.class,
+ () ->
+ AconfigPackageImpl.load(
+ "mockup", "com.android.aconfig.storage.test_1", pr));
+ assertEquals(AconfigStorageException.ERROR_CANNOT_READ_STORAGE_FILE, e.getErrorCode());
}
@Test
public void testGetBooleanFlagValue_flagName() throws Exception {
- AconfigPackageImpl p = new AconfigPackageImpl();
- p.load("mockup", "com.android.aconfig.storage.test_1", pr);
+ AconfigPackageImpl p =
+ AconfigPackageImpl.load("mockup", "com.android.aconfig.storage.test_1", pr);
assertFalse(p.getBooleanFlagValue("disabled_rw", true));
assertTrue(p.getBooleanFlagValue("enabled_ro", false));
assertTrue(p.getBooleanFlagValue("enabled_rw", false));
@@ -98,17 +118,10 @@
@Test
public void testGetBooleanFlagValue_index() throws Exception {
- AconfigPackageImpl p = new AconfigPackageImpl();
- p.load("mockup", "com.android.aconfig.storage.test_1", pr);
+ AconfigPackageImpl p =
+ AconfigPackageImpl.load("mockup", "com.android.aconfig.storage.test_1", pr);
assertFalse(p.getBooleanFlagValue(0));
assertTrue(p.getBooleanFlagValue(1));
assertTrue(p.getBooleanFlagValue(2));
}
-
- @Test
- public void testHasPackageFingerprint() throws Exception {
- AconfigPackageImpl p = new AconfigPackageImpl();
- p.load("mockup", "com.android.aconfig.storage.test_1", pr);
- assertFalse(p.hasPackageFingerprint());
- }
}
diff --git a/tools/aconfig/aconfig_storage_read_api/tests/java/Android.bp b/tools/aconfig/aconfig_storage_read_api/tests/java/Android.bp
index 9c88122..0de34a6 100644
--- a/tools/aconfig/aconfig_storage_read_api/tests/java/Android.bp
+++ b/tools/aconfig/aconfig_storage_read_api/tests/java/Android.bp
@@ -28,7 +28,6 @@
team: "trendy_team_android_core_experiments",
srcs: [
"AconfigPackageImplTest.java",
- "StorageFileProviderTest.java",
"TestDataUtils.java",
],
static_libs: [
diff --git a/tools/aconfig/aconfig_storage_read_api/tests/java/AndroidStorageJaveTest.xml b/tools/aconfig/aconfig_storage_read_api/tests/java/AndroidStorageJaveTest.xml
index 3d5bb8e..861b9b5 100644
--- a/tools/aconfig/aconfig_storage_read_api/tests/java/AndroidStorageJaveTest.xml
+++ b/tools/aconfig/aconfig_storage_read_api/tests/java/AndroidStorageJaveTest.xml
@@ -21,14 +21,14 @@
</target_preparer>
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
<option name="cleanup" value="true" />
- <option name="push" value="package.map->/data/local/tmp/aconfig_storage_package/testdata/mockup.package.map" />
- <option name="push" value="flag.map->/data/local/tmp/aconfig_storage_package/testdata/mockup.flag.map" />
- <option name="push" value="flag.val->/data/local/tmp/aconfig_storage_package/testdata/mockup.val" />
- <option name="push" value="flag.info->/data/local/tmp/aconfig_storage_package/testdata/mockup.info" />
+ <option name="push" value="package_v1.map->/data/local/tmp/aconfig_storage_package/testdata/mockup.package.map" />
+ <option name="push" value="flag_v1.map->/data/local/tmp/aconfig_storage_package/testdata/mockup.flag.map" />
+ <option name="push" value="flag_v1.val->/data/local/tmp/aconfig_storage_package/testdata/mockup.val" />
+ <option name="push" value="flag_v1.info->/data/local/tmp/aconfig_storage_package/testdata/mockup.info" />
<option name="post-push" value="chmod +r /data/local/tmp/aconfig_storage_package/testdata/" />
</target_preparer>
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
<option name="package" value="android.aconfig.storage.test" />
<option name="runtime-hint" value="1m" />
</test>
-</configuration>
\ No newline at end of file
+</configuration>
diff --git a/tools/aconfig/aconfig_storage_read_api/tests/java/AndroidTest.xml b/tools/aconfig/aconfig_storage_read_api/tests/java/AndroidTest.xml
index 99c9e25..7ffa18c 100644
--- a/tools/aconfig/aconfig_storage_read_api/tests/java/AndroidTest.xml
+++ b/tools/aconfig/aconfig_storage_read_api/tests/java/AndroidTest.xml
@@ -35,11 +35,11 @@
<target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
<option name="cleanup" value="true" />
<option name="abort-on-push-failure" value="true" />
- <option name="push-file" key="package.map"
+ <option name="push-file" key="package_v1.map"
value="/data/local/tmp/aconfig_java_api_test/maps/mockup.package.map" />
- <option name="push-file" key="flag.map"
+ <option name="push-file" key="flag_v1.map"
value="/data/local/tmp/aconfig_java_api_test/maps/mockup.flag.map" />
- <option name="push-file" key="flag.val"
+ <option name="push-file" key="flag_v1.val"
value="/data/local/tmp/aconfig_java_api_test/boot/mockup.val" />
</target_preparer>
diff --git a/tools/aconfig/aconfig_storage_read_api/tests/storage_read_api_test.cpp b/tools/aconfig/aconfig_storage_read_api/tests/storage_read_api_test.cpp
index 7537643..5289faa 100644
--- a/tools/aconfig/aconfig_storage_read_api/tests/storage_read_api_test.cpp
+++ b/tools/aconfig/aconfig_storage_read_api/tests/storage_read_api_test.cpp
@@ -56,10 +56,10 @@
flag_map = std::string(maps_dir) + "/mockup.flag.map";
flag_val = std::string(boot_dir) + "/mockup.val";
flag_info = std::string(boot_dir) + "/mockup.info";
- copy_file(test_dir + "/package.map", package_map);
- copy_file(test_dir + "/flag.map", flag_map);
- copy_file(test_dir + "/flag.val", flag_val);
- copy_file(test_dir + "/flag.info", flag_info);
+ copy_file(test_dir + "/package_v1.map", package_map);
+ copy_file(test_dir + "/flag_v1.map", flag_map);
+ copy_file(test_dir + "/flag_v1.val", flag_val);
+ copy_file(test_dir + "/flag_v1.info", flag_info);
}
void TearDown() override {
diff --git a/tools/aconfig/aconfig_storage_read_api/tests/storage_read_api_test.rs b/tools/aconfig/aconfig_storage_read_api/tests/storage_read_api_test.rs
index 0d943f8..5605a41 100644
--- a/tools/aconfig/aconfig_storage_read_api/tests/storage_read_api_test.rs
+++ b/tools/aconfig/aconfig_storage_read_api/tests/storage_read_api_test.rs
@@ -9,7 +9,7 @@
use rand::Rng;
use std::fs;
- fn create_test_storage_files() -> String {
+ fn create_test_storage_files(version: u32) -> String {
let mut rng = rand::thread_rng();
let number: u32 = rng.gen();
let storage_dir = String::from("/tmp/") + &number.to_string();
@@ -26,17 +26,17 @@
let flag_map = storage_dir.clone() + "/maps/mockup.flag.map";
let flag_val = storage_dir.clone() + "/boot/mockup.val";
let flag_info = storage_dir.clone() + "/boot/mockup.info";
- fs::copy("./data/v1/package.map", package_map).unwrap();
- fs::copy("./data/v1/flag.map", flag_map).unwrap();
- fs::copy("./data/v1/flag.val", flag_val).unwrap();
- fs::copy("./data/v1/flag.info", flag_info).unwrap();
+ fs::copy(format!("./data/v{0}/package_v{0}.map", version), package_map).unwrap();
+ fs::copy(format!("./data/v{0}/flag_v{0}.map", version), flag_map).unwrap();
+ fs::copy(format!("./data/v{}/flag_v{0}.val", version), flag_val).unwrap();
+ fs::copy(format!("./data/v{}/flag_v{0}.info", version), flag_info).unwrap();
storage_dir
}
#[test]
- fn test_unavailable_stoarge() {
- let storage_dir = create_test_storage_files();
+ fn test_unavailable_storage() {
+ let storage_dir = create_test_storage_files(1);
// SAFETY:
// The safety here is ensured as the test process will not write to temp storage file
let err = unsafe {
@@ -53,7 +53,7 @@
#[test]
fn test_package_context_query() {
- let storage_dir = create_test_storage_files();
+ let storage_dir = create_test_storage_files(1);
// SAFETY:
// The safety here is ensured as the test process will not write to temp storage file
let package_mapped_file = unsafe {
@@ -84,7 +84,7 @@
#[test]
fn test_none_exist_package_context_query() {
- let storage_dir = create_test_storage_files();
+ let storage_dir = create_test_storage_files(1);
// SAFETY:
// The safety here is ensured as the test process will not write to temp storage file
let package_mapped_file = unsafe {
@@ -99,7 +99,7 @@
#[test]
fn test_flag_context_query() {
- let storage_dir = create_test_storage_files();
+ let storage_dir = create_test_storage_files(1);
// SAFETY:
// The safety here is ensured as the test process will not write to temp storage file
let flag_mapped_file =
@@ -125,7 +125,7 @@
#[test]
fn test_none_exist_flag_context_query() {
- let storage_dir = create_test_storage_files();
+ let storage_dir = create_test_storage_files(1);
// SAFETY:
// The safety here is ensured as the test process will not write to temp storage file
let flag_mapped_file =
@@ -141,7 +141,7 @@
#[test]
fn test_boolean_flag_value_query() {
- let storage_dir = create_test_storage_files();
+ let storage_dir = create_test_storage_files(1);
// SAFETY:
// The safety here is ensured as the test process will not write to temp storage file
let flag_value_file =
@@ -155,7 +155,7 @@
#[test]
fn test_invalid_boolean_flag_value_query() {
- let storage_dir = create_test_storage_files();
+ let storage_dir = create_test_storage_files(1);
// SAFETY:
// The safety here is ensured as the test process will not write to temp storage file
let flag_value_file =
@@ -169,7 +169,7 @@
#[test]
fn test_flag_info_query() {
- let storage_dir = create_test_storage_files();
+ let storage_dir = create_test_storage_files(1);
// SAFETY:
// The safety here is ensured as the test process will not write to temp storage file
let flag_info_file =
@@ -186,7 +186,7 @@
#[test]
fn test_invalid_boolean_flag_info_query() {
- let storage_dir = create_test_storage_files();
+ let storage_dir = create_test_storage_files(1);
// SAFETY:
// The safety here is ensured as the test process will not write to temp storage file
let flag_info_file =
@@ -199,10 +199,18 @@
}
#[test]
- fn test_storage_version_query() {
- assert_eq!(get_storage_file_version("./data/v1/package.map").unwrap(), 1);
- assert_eq!(get_storage_file_version("./data/v1/flag.map").unwrap(), 1);
- assert_eq!(get_storage_file_version("./data/v1/flag.val").unwrap(), 1);
- assert_eq!(get_storage_file_version("./data/v1/flag.info").unwrap(), 1);
+ fn test_storage_version_query_v1() {
+ assert_eq!(get_storage_file_version("./data/v1/package_v1.map").unwrap(), 1);
+ assert_eq!(get_storage_file_version("./data/v1/flag_v1.map").unwrap(), 1);
+ assert_eq!(get_storage_file_version("./data/v1/flag_v1.val").unwrap(), 1);
+ assert_eq!(get_storage_file_version("./data/v1/flag_v1.info").unwrap(), 1);
+ }
+
+ #[test]
+ fn test_storage_version_query_v2() {
+ assert_eq!(get_storage_file_version("./data/v2/package_v2.map").unwrap(), 2);
+ assert_eq!(get_storage_file_version("./data/v2/flag_v2.map").unwrap(), 2);
+ assert_eq!(get_storage_file_version("./data/v2/flag_v2.val").unwrap(), 2);
+ assert_eq!(get_storage_file_version("./data/v2/flag_v2.info").unwrap(), 2);
}
}
diff --git a/tools/aconfig/aconfig_storage_write_api/src/flag_info_update.rs b/tools/aconfig/aconfig_storage_write_api/src/flag_info_update.rs
index 5640922..5721105 100644
--- a/tools/aconfig/aconfig_storage_write_api/src/flag_info_update.rs
+++ b/tools/aconfig/aconfig_storage_write_api/src/flag_info_update.rs
@@ -94,13 +94,13 @@
#[cfg(test)]
mod tests {
use super::*;
- use aconfig_storage_file::test_utils::create_test_flag_info_list;
+ use aconfig_storage_file::{test_utils::create_test_flag_info_list, DEFAULT_FILE_VERSION};
use aconfig_storage_read_api::flag_info_query::find_flag_attribute;
#[test]
// this test point locks down has server override update
fn test_update_flag_has_server_override() {
- let flag_info_list = create_test_flag_info_list();
+ let flag_info_list = create_test_flag_info_list(DEFAULT_FILE_VERSION);
let mut buf = flag_info_list.into_bytes();
for i in 0..flag_info_list.header.num_flags {
update_flag_has_server_override(&mut buf, FlagValueType::Boolean, i, true).unwrap();
@@ -115,7 +115,7 @@
#[test]
// this test point locks down has local override update
fn test_update_flag_has_local_override() {
- let flag_info_list = create_test_flag_info_list();
+ let flag_info_list = create_test_flag_info_list(DEFAULT_FILE_VERSION);
let mut buf = flag_info_list.into_bytes();
for i in 0..flag_info_list.header.num_flags {
update_flag_has_local_override(&mut buf, FlagValueType::Boolean, i, true).unwrap();
diff --git a/tools/aconfig/aconfig_storage_write_api/src/flag_value_update.rs b/tools/aconfig/aconfig_storage_write_api/src/flag_value_update.rs
index 06a9b15..9772db9 100644
--- a/tools/aconfig/aconfig_storage_write_api/src/flag_value_update.rs
+++ b/tools/aconfig/aconfig_storage_write_api/src/flag_value_update.rs
@@ -49,12 +49,12 @@
#[cfg(test)]
mod tests {
use super::*;
- use aconfig_storage_file::test_utils::create_test_flag_value_list;
+ use aconfig_storage_file::{test_utils::create_test_flag_value_list, DEFAULT_FILE_VERSION};
#[test]
// this test point locks down flag value update
fn test_boolean_flag_value_update() {
- let flag_value_list = create_test_flag_value_list();
+ let flag_value_list = create_test_flag_value_list(DEFAULT_FILE_VERSION);
let value_offset = flag_value_list.header.boolean_value_offset;
let mut content = flag_value_list.into_bytes();
let true_byte = u8::from(true).to_le_bytes()[0];
@@ -72,7 +72,7 @@
#[test]
// this test point locks down update beyond the end of boolean section
fn test_boolean_out_of_range() {
- let mut flag_value_list = create_test_flag_value_list().into_bytes();
+ let mut flag_value_list = create_test_flag_value_list(DEFAULT_FILE_VERSION).into_bytes();
let error = update_boolean_flag_value(&mut flag_value_list[..], 8, true).unwrap_err();
assert_eq!(
format!("{:?}", error),
@@ -83,7 +83,7 @@
#[test]
// this test point locks down query error when file has a higher version
fn test_higher_version_storage_file() {
- let mut value_list = create_test_flag_value_list();
+ let mut value_list = create_test_flag_value_list(DEFAULT_FILE_VERSION);
value_list.header.version = MAX_SUPPORTED_FILE_VERSION + 1;
let mut flag_value = value_list.into_bytes();
let error = update_boolean_flag_value(&mut flag_value[..], 4, true).unwrap_err();
diff --git a/tools/aconfig/aflags/src/aconfig_storage_source.rs b/tools/aconfig/aflags/src/aconfig_storage_source.rs
index 68edf7d..3f593fe 100644
--- a/tools/aconfig/aflags/src/aconfig_storage_source.rs
+++ b/tools/aconfig/aflags/src/aconfig_storage_source.rs
@@ -93,7 +93,12 @@
special_fields: SpecialFields::new(),
};
- let mut socket = UnixStream::connect("/dev/socket/aconfigd")?;
+ let socket_name = if aconfig_flags::auto_generated::enable_system_aconfigd_rust() {
+ "/dev/socket/aconfigd_system"
+ } else {
+ "/dev/socket/aconfigd"
+ };
+ let mut socket = UnixStream::connect(socket_name)?;
let message_buffer = messages.write_to_bytes()?;
let mut message_length_buffer: [u8; 4] = [0; 4];
diff --git a/tools/aconfig/fake_device_config/src/android/os/Binder.java b/tools/aconfig/fake_device_config/src/android/os/Binder.java
new file mode 100644
index 0000000..8a2313d
--- /dev/null
+++ b/tools/aconfig/fake_device_config/src/android/os/Binder.java
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+package android.os;
+
+public class Binder {
+ public static final long clearCallingIdentity() {
+ throw new UnsupportedOperationException("Stub!");
+ }
+ public static final void restoreCallingIdentity(long token) {
+ throw new UnsupportedOperationException("Stub!");
+ }
+}
diff --git a/tools/edit_monitor/daemon_manager.py b/tools/edit_monitor/daemon_manager.py
index 9a0abb6..da85c11 100644
--- a/tools/edit_monitor/daemon_manager.py
+++ b/tools/edit_monitor/daemon_manager.py
@@ -33,7 +33,7 @@
DEFAULT_PROCESS_TERMINATION_TIMEOUT_SECONDS = 5
DEFAULT_MONITOR_INTERVAL_SECONDS = 5
-DEFAULT_MEMORY_USAGE_THRESHOLD = 2 * 1024 # 2GB
+DEFAULT_MEMORY_USAGE_THRESHOLD = 3 * 1024 # 3GB
DEFAULT_CPU_USAGE_THRESHOLD = 200
DEFAULT_REBOOT_TIMEOUT_SECONDS = 60 * 60 * 24
BLOCK_SIGN_FILE = "edit_monitor_block_sign"
@@ -83,8 +83,8 @@
if not utils.is_feature_enabled(
"edit_monitor",
self.user_name,
- "ENABLE_EDIT_MONITOR",
- "EDIT_MONITOR_ROLLOUT_PERCENTAGE",
+ "ENABLE_ANDROID_EDIT_MONITOR",
+ 10,
):
logging.warning("Edit monitor is disabled, exiting...")
return
@@ -141,17 +141,11 @@
# Logging the error and continue.
logging.warning("Failed to monitor daemon process with error: %s", e)
- if (
- self.max_memory_usage >= memory_threshold
- or self.max_cpu_usage >= cpu_threshold
- ):
- logging.error(
- "Daemon process is consuming too much resource, killing..."
- ),
- self._send_error_event_to_clearcut(
- edit_event_pb2.EditEvent.KILLED_DUE_TO_EXCEEDED_RESOURCE_USAGE
- )
- self._terminate_process(self.daemon_process.pid)
+ if self.max_memory_usage >= memory_threshold:
+ self._handle_resource_exhausted_error("memory")
+
+ if self.max_cpu_usage >= cpu_threshold:
+ self._handle_resource_exhausted_error("cpu")
logging.info(
"Daemon process %d terminated. Max memory usage: %f, Max cpu"
@@ -392,6 +386,20 @@
return pids
+ def _handle_resource_exhausted_error(self, resource_type:str):
+ if resource_type == "memory":
+ self._send_error_event_to_clearcut(
+ edit_event_pb2.EditEvent.KILLED_DUE_TO_EXCEEDED_MEMORY_USAGE
+ )
+ else:
+ self._send_error_event_to_clearcut(
+ edit_event_pb2.EditEvent.KILLED_DUE_TO_EXCEEDED_CPU_USAGE
+ )
+ logging.error(
+ "Daemon process is consuming too much %s, killing...", resource_type
+ ),
+ self._terminate_process(self.daemon_process.pid)
+
def _send_error_event_to_clearcut(self, error_type):
edit_monitor_error_event_proto = edit_event_pb2.EditEvent(
user_name=self.user_name,
diff --git a/tools/edit_monitor/daemon_manager_test.py b/tools/edit_monitor/daemon_manager_test.py
index 407d94e..12aaab3 100644
--- a/tools/edit_monitor/daemon_manager_test.py
+++ b/tools/edit_monitor/daemon_manager_test.py
@@ -81,7 +81,8 @@
# Sets the tempdir under the working dir so any temp files created during
# tests will be cleaned.
tempfile.tempdir = self.working_dir.name
- self.patch = mock.patch.dict(os.environ, {'ENABLE_EDIT_MONITOR': 'true'})
+ self.patch = mock.patch.dict(
+ os.environ, {'ENABLE_ANDROID_EDIT_MONITOR': 'true'})
self.patch.start()
def tearDown(self):
@@ -136,7 +137,7 @@
# Verify no daemon process is started.
self.assertIsNone(dm.daemon_process)
- @mock.patch.dict(os.environ, {'ENABLE_EDIT_MONITOR': 'false'}, clear=True)
+ @mock.patch.dict(os.environ, {'ENABLE_ANDROID_EDIT_MONITOR': 'false'}, clear=True)
def test_start_return_directly_if_disabled(self):
dm = daemon_manager.DaemonManager(TEST_BINARY_FILE)
dm.start()
@@ -216,7 +217,7 @@
self.assert_no_subprocess_running()
self._assert_error_event_logged(
fake_cclient,
- edit_event_pb2.EditEvent.KILLED_DUE_TO_EXCEEDED_RESOURCE_USAGE,
+ edit_event_pb2.EditEvent.KILLED_DUE_TO_EXCEEDED_MEMORY_USAGE,
)
def test_monitor_daemon_subprocess_killed_high_cpu_usage(self):
@@ -234,7 +235,7 @@
self.assert_no_subprocess_running()
self._assert_error_event_logged(
fake_cclient,
- edit_event_pb2.EditEvent.KILLED_DUE_TO_EXCEEDED_RESOURCE_USAGE,
+ edit_event_pb2.EditEvent.KILLED_DUE_TO_EXCEEDED_CPU_USAGE,
)
@mock.patch('subprocess.check_output')
diff --git a/tools/edit_monitor/edit_monitor_integration_test.py b/tools/edit_monitor/edit_monitor_integration_test.py
index 5f3d7e5..3d28274 100644
--- a/tools/edit_monitor/edit_monitor_integration_test.py
+++ b/tools/edit_monitor/edit_monitor_integration_test.py
@@ -48,7 +48,8 @@
)
self.root_monitoring_path.mkdir()
self.edit_monitor_binary_path = self._import_executable("edit_monitor")
- self.patch = mock.patch.dict(os.environ, {'ENABLE_EDIT_MONITOR': 'true'})
+ self.patch = mock.patch.dict(
+ os.environ, {'ENABLE_ANDROID_EDIT_MONITOR': 'true'})
self.patch.start()
def tearDown(self):
diff --git a/tools/edit_monitor/proto/edit_event.proto b/tools/edit_monitor/proto/edit_event.proto
index dc3d3f6..9acc2e7 100644
--- a/tools/edit_monitor/proto/edit_event.proto
+++ b/tools/edit_monitor/proto/edit_event.proto
@@ -16,8 +16,9 @@
FAILED_TO_START_EDIT_MONITOR = 1;
FAILED_TO_STOP_EDIT_MONITOR = 2;
FAILED_TO_REBOOT_EDIT_MONITOR = 3;
- KILLED_DUE_TO_EXCEEDED_RESOURCE_USAGE = 4;
+ KILLED_DUE_TO_EXCEEDED_MEMORY_USAGE = 4;
FORCE_CLEANUP = 5;
+ KILLED_DUE_TO_EXCEEDED_CPU_USAGE = 6;
}
// Event that logs a single edit
diff --git a/tools/edit_monitor/utils.py b/tools/edit_monitor/utils.py
index 1a3275c..b88949d 100644
--- a/tools/edit_monitor/utils.py
+++ b/tools/edit_monitor/utils.py
@@ -21,7 +21,7 @@
feature_name: str,
user_name: str,
enable_flag: str = None,
- rollout_flag: str = None,
+ rollout_percent: int = 100,
) -> bool:
"""Determine whether the given feature is enabled.
@@ -46,26 +46,8 @@
logging.info("feature: %s is enabled", feature_name)
return True
- if not rollout_flag:
- return True
-
hash_object = hashlib.sha256()
hash_object.update((user_name + feature_name).encode("utf-8"))
hash_number = int(hash_object.hexdigest(), 16) % 100
- roll_out_percentage = os.environ.get(rollout_flag, "0")
- try:
- percentage = int(roll_out_percentage)
- if percentage < 0 or percentage > 100:
- logging.warning(
- "Rollout percentage: %s out of range, disable the feature.",
- roll_out_percentage,
- )
- return False
- return hash_number < percentage
- except ValueError:
- logging.warning(
- "Invalid rollout percentage: %s, disable the feature.",
- roll_out_percentage,
- )
- return False
+ return hash_number < rollout_percent
diff --git a/tools/edit_monitor/utils_test.py b/tools/edit_monitor/utils_test.py
index 7d7e4b2..1c30aa1 100644
--- a/tools/edit_monitor/utils_test.py
+++ b/tools/edit_monitor/utils_test.py
@@ -46,60 +46,23 @@
)
)
- @mock.patch.dict(
- os.environ, {ROLLOUT_TEST_FEATURE_FLAG: 'invalid'}, clear=True
- )
- def test_feature_disabled_with_invalid_rollout_percentage(self):
- self.assertFalse(
- utils.is_feature_enabled(
- TEST_FEATURE,
- TEST_USER,
- ENABLE_TEST_FEATURE_FLAG,
- ROLLOUT_TEST_FEATURE_FLAG,
- )
- )
-
- @mock.patch.dict(os.environ, {ROLLOUT_TEST_FEATURE_FLAG: '101'}, clear=True)
- def test_feature_disabled_with_rollout_percentage_too_high(self):
- self.assertFalse(
- utils.is_feature_enabled(
- TEST_FEATURE,
- TEST_USER,
- ENABLE_TEST_FEATURE_FLAG,
- ROLLOUT_TEST_FEATURE_FLAG,
- )
- )
-
- @mock.patch.dict(os.environ, {ROLLOUT_TEST_FEATURE_FLAG: '-1'}, clear=True)
- def test_feature_disabled_with_rollout_percentage_too_low(self):
- self.assertFalse(
- utils.is_feature_enabled(
- TEST_FEATURE,
- TEST_USER,
- ENABLE_TEST_FEATURE_FLAG,
- ROLLOUT_TEST_FEATURE_FLAG,
- )
- )
-
- @mock.patch.dict(os.environ, {ROLLOUT_TEST_FEATURE_FLAG: '90'}, clear=True)
def test_feature_enabled_with_rollout_percentage(self):
self.assertTrue(
utils.is_feature_enabled(
TEST_FEATURE,
TEST_USER,
ENABLE_TEST_FEATURE_FLAG,
- ROLLOUT_TEST_FEATURE_FLAG,
+ 90,
)
)
- @mock.patch.dict(os.environ, {ROLLOUT_TEST_FEATURE_FLAG: '10'}, clear=True)
def test_feature_disabled_with_rollout_percentage(self):
self.assertFalse(
utils.is_feature_enabled(
TEST_FEATURE,
TEST_USER,
ENABLE_TEST_FEATURE_FLAG,
- ROLLOUT_TEST_FEATURE_FLAG,
+ 10,
)
)
diff --git a/tools/filelistdiff/file_list_diff.py b/tools/filelistdiff/file_list_diff.py
index fbbfedf..a6408e8 100644
--- a/tools/filelistdiff/file_list_diff.py
+++ b/tools/filelistdiff/file_list_diff.py
@@ -76,7 +76,7 @@
parser.add_argument('kati_installed_file_list')
parser.add_argument('soong_installed_file_list')
parser.add_argument('system_module_name')
- parser.add_argument('--allowlists', nargs='+')
+ parser.add_argument('--allowlists', nargs='*', default=[])
args = parser.parse_args()
find_unique_items(args.kati_installed_file_list, args.soong_installed_file_list, args.system_module_name, args.allowlists)
\ No newline at end of file
diff --git a/tools/fs_config/Android.bp b/tools/fs_config/Android.bp
index 6aa5289..a5b6fd0 100644
--- a/tools/fs_config/Android.bp
+++ b/tools/fs_config/Android.bp
@@ -277,6 +277,7 @@
out: ["out"],
}
+// system
genrule {
name: "fs_config_dirs_system_gen",
defaults: ["fs_config_defaults"],
@@ -307,6 +308,7 @@
src: ":fs_config_files_system_gen",
}
+// system_ext
genrule {
name: "fs_config_dirs_system_ext_gen",
defaults: ["fs_config_defaults"],
@@ -337,6 +339,7 @@
system_ext_specific: true,
}
+// product
genrule {
name: "fs_config_dirs_product_gen",
defaults: ["fs_config_defaults"],
@@ -367,6 +370,7 @@
product_specific: true,
}
+// vendor
genrule {
name: "fs_config_dirs_vendor_gen",
defaults: ["fs_config_defaults"],
@@ -397,6 +401,7 @@
vendor: true,
}
+// odm
genrule {
name: "fs_config_dirs_odm_gen",
defaults: ["fs_config_defaults"],
@@ -427,4 +432,214 @@
device_specific: true,
}
-// TODO(jiyong): add fs_config for oem, system_dlkm, vendor_dlkm, odm_dlkm partitions
+// system_dlkm
+genrule {
+ name: "fs_config_dirs_system_dlkm_gen",
+ defaults: ["fs_config_defaults"],
+ cmd: fs_config_cmd_dirs +
+ "--partition system_dlkm " +
+ "$(locations :target_fs_config_gen)",
+}
+
+prebuilt_etc {
+ name: "fs_config_dirs_system_dlkm",
+ filename: "fs_config_dirs",
+ src: ":fs_config_dirs_system_dlkm_gen",
+ system_dlkm_specific: true,
+}
+
+genrule {
+ name: "fs_config_files_system_dlkm_gen",
+ defaults: ["fs_config_defaults"],
+ cmd: fs_config_cmd_files +
+ "--partition system_dlkm " +
+ "$(locations :target_fs_config_gen)",
+}
+
+prebuilt_etc {
+ name: "fs_config_files_system_dlkm",
+ filename: "fs_config_files",
+ src: ":fs_config_files_system_dlkm_gen",
+ system_dlkm_specific: true,
+}
+
+// vendor_dlkm
+genrule {
+ name: "fs_config_dirs_vendor_dlkm_gen",
+ defaults: ["fs_config_defaults"],
+ cmd: fs_config_cmd_dirs +
+ "--partition vendor_dlkm " +
+ "$(locations :target_fs_config_gen)",
+}
+
+prebuilt_etc {
+ name: "fs_config_dirs_vendor_dlkm",
+ filename: "fs_config_dirs",
+ src: ":fs_config_dirs_vendor_dlkm_gen",
+ vendor_dlkm_specific: true,
+}
+
+genrule {
+ name: "fs_config_files_vendor_dlkm_gen",
+ defaults: ["fs_config_defaults"],
+ cmd: fs_config_cmd_files +
+ "--partition vendor_dlkm " +
+ "$(locations :target_fs_config_gen)",
+}
+
+prebuilt_etc {
+ name: "fs_config_files_vendor_dlkm",
+ filename: "fs_config_files",
+ src: ":fs_config_files_vendor_dlkm_gen",
+ vendor_dlkm_specific: true,
+}
+
+// odm_dlkm
+genrule {
+ name: "fs_config_dirs_odm_dlkm_gen",
+ defaults: ["fs_config_defaults"],
+ cmd: fs_config_cmd_dirs +
+ "--partition odm_dlkm " +
+ "$(locations :target_fs_config_gen)",
+}
+
+prebuilt_etc {
+ name: "fs_config_dirs_odm_dlkm",
+ filename: "fs_config_dirs",
+ src: ":fs_config_dirs_odm_dlkm_gen",
+ odm_dlkm_specific: true,
+}
+
+genrule {
+ name: "fs_config_files_odm_dlkm_gen",
+ defaults: ["fs_config_defaults"],
+ cmd: fs_config_cmd_files +
+ "--partition odm_dlkm " +
+ "$(locations :target_fs_config_gen)",
+}
+
+prebuilt_etc {
+ name: "fs_config_files_odm_dlkm",
+ filename: "fs_config_files",
+ src: ":fs_config_files_odm_dlkm_gen",
+ odm_dlkm_specific: true,
+}
+
+// oem
+genrule {
+ name: "fs_config_dirs_oem_gen",
+ defaults: ["fs_config_defaults"],
+ cmd: fs_config_cmd_dirs +
+ "--partition oem " +
+ "$(locations :target_fs_config_gen)",
+}
+
+prebuilt_etc {
+ name: "fs_config_dirs_oem",
+ filename: "fs_config_dirs",
+ src: ":fs_config_dirs_oem_gen",
+ oem_specific: true,
+}
+
+genrule {
+ name: "fs_config_files_oem_gen",
+ defaults: ["fs_config_defaults"],
+ cmd: fs_config_cmd_files +
+ "--partition oem " +
+ "$(locations :target_fs_config_gen)",
+}
+
+prebuilt_etc {
+ name: "fs_config_files_oem",
+ filename: "fs_config_files",
+ src: ":fs_config_files_oem_gen",
+ oem_specific: true,
+}
+
+// Generate the <p>/etc/fs_config_dirs binary files for each partition.
+// Add fs_config_dirs to PRODUCT_PACKAGES in the device make file to enable.
+phony {
+ name: "fs_config_dirs",
+ required: [
+ "fs_config_dirs_system",
+ "fs_config_dirs_system_ext",
+ "fs_config_dirs_product",
+ "fs_config_dirs_nonsystem",
+ ],
+}
+
+// Generate the <p>/etc/fs_config_files binary files for each partition.
+// Add fs_config_files to PRODUCT_PACKAGES in the device make file to enable.
+phony {
+ name: "fs_config_files",
+ required: [
+ "fs_config_files_system",
+ "fs_config_files_system_ext",
+ "fs_config_files_product",
+ "fs_config_files_nonsystem",
+ ],
+}
+
+// Generate the <p>/etc/fs_config_dirs binary files for all enabled partitions
+// excluding /system, /system_ext and /product. Add fs_config_dirs_nonsystem to
+// PRODUCT_PACKAGES in the device make file to enable.
+phony {
+ name: "fs_config_dirs_nonsystem",
+ required: [] +
+ select(soong_config_variable("fs_config", "vendor"), {
+ true: ["fs_config_dirs_vendor"],
+ default: [],
+ }) +
+ select(soong_config_variable("fs_config", "oem"), {
+ true: ["fs_config_dirs_oem"],
+ default: [],
+ }) +
+ select(soong_config_variable("fs_config", "odm"), {
+ true: ["fs_config_dirs_odm"],
+ default: [],
+ }) +
+ select(soong_config_variable("fs_config", "vendor_dlkm"), {
+ true: ["fs_config_dirs_vendor_dlkm"],
+ default: [],
+ }) +
+ select(soong_config_variable("fs_config", "odm_dlkm"), {
+ true: ["fs_config_dirs_odm_dlkm"],
+ default: [],
+ }) +
+ select(soong_config_variable("fs_config", "system_dlkm"), {
+ true: ["fs_config_dirs_system_dlkm"],
+ default: [],
+ }),
+}
+
+// Generate the <p>/etc/fs_config_files binary files for all enabled partitions
+// excluding /system, /system_ext and /product. Add fs_config_files_nonsystem to
+// PRODUCT_PACKAGES in the device make file to enable.
+phony {
+ name: "fs_config_files_nonsystem",
+ required: [] +
+ select(soong_config_variable("fs_config", "vendor"), {
+ true: ["fs_config_files_vendor"],
+ default: [],
+ }) +
+ select(soong_config_variable("fs_config", "oem"), {
+ true: ["fs_config_files_oem"],
+ default: [],
+ }) +
+ select(soong_config_variable("fs_config", "odm"), {
+ true: ["fs_config_files_odm"],
+ default: [],
+ }) +
+ select(soong_config_variable("fs_config", "vendor_dlkm"), {
+ true: ["fs_config_files_vendor_dlkm"],
+ default: [],
+ }) +
+ select(soong_config_variable("fs_config", "odm_dlkm"), {
+ true: ["fs_config_files_odm_dlkm"],
+ default: [],
+ }) +
+ select(soong_config_variable("fs_config", "system_dlkm"), {
+ true: ["fs_config_files_system_dlkm"],
+ default: [],
+ }),
+}
diff --git a/tools/fs_config/Android.mk b/tools/fs_config/Android.mk
deleted file mode 100644
index e4c3626..0000000
--- a/tools/fs_config/Android.mk
+++ /dev/null
@@ -1,328 +0,0 @@
-# Copyright (C) 2008 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH := $(call my-dir)
-
-# One can override the default android_filesystem_config.h file by using TARGET_FS_CONFIG_GEN.
-# Set TARGET_FS_CONFIG_GEN to contain a list of intermediate format files
-# for generating the android_filesystem_config.h file.
-#
-# More information can be found in the README
-
-ifneq ($(wildcard $(TARGET_DEVICE_DIR)/android_filesystem_config.h),)
-$(error Using $(TARGET_DEVICE_DIR)/android_filesystem_config.h is deprecated, please use TARGET_FS_CONFIG_GEN instead)
-endif
-
-android_filesystem_config := system/core/libcutils/include/private/android_filesystem_config.h
-capability_header := bionic/libc/kernel/uapi/linux/capability.h
-
-# List of supported vendor, oem, odm, vendor_dlkm, odm_dlkm, and system_dlkm Partitions
-fs_config_generate_extra_partition_list := $(strip \
- $(if $(BOARD_USES_VENDORIMAGE)$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),vendor) \
- $(if $(BOARD_USES_OEMIMAGE)$(BOARD_OEMIMAGE_FILE_SYSTEM_TYPE),oem) \
- $(if $(BOARD_USES_ODMIMAGE)$(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE),odm) \
- $(if $(BOARD_USES_VENDOR_DLKMIMAGE)$(BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE),vendor_dlkm) \
- $(if $(BOARD_USES_ODM_DLKMIMAGE)$(BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE),odm_dlkm) \
- $(if $(BOARD_USES_SYSTEM_DLKMIMAGE)$(BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE),system_dlkm) \
-)
-
-##################################
-# Generate the <p>/etc/fs_config_dirs binary files for each partition.
-# Add fs_config_dirs to PRODUCT_PACKAGES in the device make file to enable.
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := fs_config_dirs
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := build/soong/licenses/LICENSE
-LOCAL_REQUIRED_MODULES := \
- fs_config_dirs_system \
- fs_config_dirs_system_ext \
- fs_config_dirs_product \
- fs_config_dirs_nonsystem
-include $(BUILD_PHONY_PACKAGE)
-
-##################################
-# Generate the <p>/etc/fs_config_files binary files for each partition.
-# Add fs_config_files to PRODUCT_PACKAGES in the device make file to enable.
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := fs_config_files
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := build/soong/licenses/LICENSE
-LOCAL_REQUIRED_MODULES := \
- fs_config_files_system \
- fs_config_files_system_ext \
- fs_config_files_product \
- fs_config_files_nonsystem
-include $(BUILD_PHONY_PACKAGE)
-
-##################################
-# Generate the <p>/etc/fs_config_dirs binary files for all enabled partitions
-# excluding /system, /system_ext and /product. Add fs_config_dirs_nonsystem to
-# PRODUCT_PACKAGES in the device make file to enable.
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := fs_config_dirs_nonsystem
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := build/soong/licenses/LICENSE
-LOCAL_REQUIRED_MODULES := $(foreach t,$(fs_config_generate_extra_partition_list),fs_config_dirs_$(t))
-include $(BUILD_PHONY_PACKAGE)
-
-##################################
-# Generate the <p>/etc/fs_config_files binary files for all enabled partitions
-# excluding /system, /system_ext and /product. Add fs_config_files_nonsystem to
-# PRODUCT_PACKAGES in the device make file to enable.
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := fs_config_files_nonsystem
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := build/soong/licenses/LICENSE
-LOCAL_REQUIRED_MODULES := $(foreach t,$(fs_config_generate_extra_partition_list),fs_config_files_$(t))
-include $(BUILD_PHONY_PACKAGE)
-
-ifneq ($(filter oem,$(fs_config_generate_extra_partition_list)),)
-##################################
-# Generate the oem/etc/fs_config_dirs binary file for the target
-# Add fs_config_dirs or fs_config_dirs_nonsystem to PRODUCT_PACKAGES
-# in the device make file to enable
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := fs_config_dirs_oem
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := build/soong/licenses/LICENSE
-LOCAL_MODULE_CLASS := ETC
-LOCAL_INSTALLED_MODULE_STEM := fs_config_dirs
-LOCAL_MODULE_PATH := $(TARGET_OUT_OEM)/etc
-include $(BUILD_SYSTEM)/base_rules.mk
-$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(android_filesystem_config)
-$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_CAP_HDR := $(capability_header)
-$(LOCAL_BUILT_MODULE): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN)
-$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_GEN) $(android_filesystem_config) $(capability_header)
- @mkdir -p $(dir $@)
- $< fsconfig \
- --aid-header $(PRIVATE_ANDROID_FS_HDR) \
- --capability-header $(PRIVATE_ANDROID_CAP_HDR) \
- --partition oem \
- --dirs \
- --out_file $@ \
- $(or $(PRIVATE_TARGET_FS_CONFIG_GEN),/dev/null)
-
-##################################
-# Generate the oem/etc/fs_config_files binary file for the target
-# Add fs_config_files or fs_config_files_nonsystem to PRODUCT_PACKAGES
-# in the device make file to enable
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := fs_config_files_oem
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := build/soong/licenses/LICENSE
-LOCAL_MODULE_CLASS := ETC
-LOCAL_INSTALLED_MODULE_STEM := fs_config_files
-LOCAL_MODULE_PATH := $(TARGET_OUT_OEM)/etc
-include $(BUILD_SYSTEM)/base_rules.mk
-$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(android_filesystem_config)
-$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_CAP_HDR := $(capability_header)
-$(LOCAL_BUILT_MODULE): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN)
-$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_GEN) $(android_filesystem_config) $(capability_header)
- @mkdir -p $(dir $@)
- $< fsconfig \
- --aid-header $(PRIVATE_ANDROID_FS_HDR) \
- --capability-header $(PRIVATE_ANDROID_CAP_HDR) \
- --partition oem \
- --files \
- --out_file $@ \
- $(or $(PRIVATE_TARGET_FS_CONFIG_GEN),/dev/null)
-
-endif
-
-ifneq ($(filter vendor_dlkm,$(fs_config_generate_extra_partition_list)),)
-##################################
-# Generate the vendor_dlkm/etc/fs_config_dirs binary file for the target
-# Add fs_config_dirs or fs_config_dirs_nonsystem to PRODUCT_PACKAGES in
-# the device make file to enable
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := fs_config_dirs_vendor_dlkm
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := build/soong/licenses/LICENSE
-LOCAL_MODULE_CLASS := ETC
-LOCAL_INSTALLED_MODULE_STEM := fs_config_dirs
-LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_DLKM)/etc
-include $(BUILD_SYSTEM)/base_rules.mk
-$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(android_filesystem_config)
-$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_CAP_HDR := $(capability_header)
-$(LOCAL_BUILT_MODULE): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN)
-$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_GEN) $(android_filesystem_config) $(capability_header)
- @mkdir -p $(dir $@)
- $< fsconfig \
- --aid-header $(PRIVATE_ANDROID_FS_HDR) \
- --capability-header $(PRIVATE_ANDROID_CAP_HDR) \
- --partition vendor_dlkm \
- --dirs \
- --out_file $@ \
- $(or $(PRIVATE_TARGET_FS_CONFIG_GEN),/dev/null)
-
-##################################
-# Generate the vendor_dlkm/etc/fs_config_files binary file for the target
-# Add fs_config_files or fs_config_files_nonsystem to PRODUCT_PACKAGES in
-# the device make file to enable
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := fs_config_files_vendor_dlkm
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := build/soong/licenses/LICENSE
-LOCAL_MODULE_CLASS := ETC
-LOCAL_INSTALLED_MODULE_STEM := fs_config_files
-LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_DLKM)/etc
-include $(BUILD_SYSTEM)/base_rules.mk
-$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(android_filesystem_config)
-$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_CAP_HDR := $(capability_header)
-$(LOCAL_BUILT_MODULE): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN)
-$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_GEN) $(android_filesystem_config) $(capability_header)
- @mkdir -p $(dir $@)
- $< fsconfig \
- --aid-header $(PRIVATE_ANDROID_FS_HDR) \
- --capability-header $(PRIVATE_ANDROID_CAP_HDR) \
- --partition vendor_dlkm \
- --files \
- --out_file $@ \
- $(or $(PRIVATE_TARGET_FS_CONFIG_GEN),/dev/null)
-
-endif
-
-ifneq ($(filter odm_dlkm,$(fs_config_generate_extra_partition_list)),)
-##################################
-# Generate the odm_dlkm/etc/fs_config_dirs binary file for the target
-# Add fs_config_dirs or fs_config_dirs_nonsystem to PRODUCT_PACKAGES
-# in the device make file to enable
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := fs_config_dirs_odm_dlkm
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := build/soong/licenses/LICENSE
-LOCAL_MODULE_CLASS := ETC
-LOCAL_INSTALLED_MODULE_STEM := fs_config_dirs
-LOCAL_MODULE_PATH := $(TARGET_OUT_ODM_DLKM)/etc
-include $(BUILD_SYSTEM)/base_rules.mk
-$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(android_filesystem_config)
-$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_CAP_HDR := $(capability_header)
-$(LOCAL_BUILT_MODULE): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN)
-$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_GEN) $(android_filesystem_config) $(capability_header)
- @mkdir -p $(dir $@)
- $< fsconfig \
- --aid-header $(PRIVATE_ANDROID_FS_HDR) \
- --capability-header $(PRIVATE_ANDROID_CAP_HDR) \
- --partition odm_dlkm \
- --dirs \
- --out_file $@ \
- $(or $(PRIVATE_TARGET_FS_CONFIG_GEN),/dev/null)
-
-##################################
-# Generate the odm_dlkm/etc/fs_config_files binary file for the target
-# Add fs_config_files or fs_config_files_nonsystem to PRODUCT_PACKAGES
-# in the device make file to enable
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := fs_config_files_odm_dlkm
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := build/soong/licenses/LICENSE
-LOCAL_MODULE_CLASS := ETC
-LOCAL_INSTALLED_MODULE_STEM := fs_config_files
-LOCAL_MODULE_PATH := $(TARGET_OUT_ODM_DLKM)/etc
-include $(BUILD_SYSTEM)/base_rules.mk
-$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(android_filesystem_config)
-$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_CAP_HDR := $(capability_header)
-$(LOCAL_BUILT_MODULE): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN)
-$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_GEN) $(android_filesystem_config) $(capability_header)
- @mkdir -p $(dir $@)
- $< fsconfig \
- --aid-header $(PRIVATE_ANDROID_FS_HDR) \
- --capability-header $(PRIVATE_ANDROID_CAP_HDR) \
- --partition odm_dlkm \
- --files \
- --out_file $@ \
- $(or $(PRIVATE_TARGET_FS_CONFIG_GEN),/dev/null)
-
-endif
-
-ifneq ($(filter system_dlkm,$(fs_config_generate_extra_partition_list)),)
-##################################
-# Generate the system_dlkm/etc/fs_config_dirs binary file for the target
-# Add fs_config_dirs or fs_config_dirs_nonsystem to PRODUCT_PACKAGES
-# in the device make file to enable
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := fs_config_dirs_system_dlkm
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := build/soong/licenses/LICENSE
-LOCAL_MODULE_CLASS := ETC
-LOCAL_INSTALLED_MODULE_STEM := fs_config_dirs
-LOCAL_MODULE_PATH := $(TARGET_OUT_SYSTEM_DLKM)/etc
-include $(BUILD_SYSTEM)/base_rules.mk
-$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(android_filesystem_config)
-$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_CAP_HDR := $(capability_header)
-$(LOCAL_BUILT_MODULE): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN)
-$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_GEN) $(android_filesystem_config) $(capability_header)
- @mkdir -p $(dir $@)
- $< fsconfig \
- --aid-header $(PRIVATE_ANDROID_FS_HDR) \
- --capability-header $(PRIVATE_ANDROID_CAP_HDR) \
- --partition system_dlkm \
- --dirs \
- --out_file $@ \
- $(or $(PRIVATE_TARGET_FS_CONFIG_GEN),/dev/null)
-
-##################################
-# Generate the system_dlkm/etc/fs_config_files binary file for the target
-# Add fs_config_files or fs_config_files_nonsystem to PRODUCT_PACKAGES
-# in the device make file to enable
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := fs_config_files_system_dlkm
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := build/soong/licenses/LICENSE
-LOCAL_MODULE_CLASS := ETC
-LOCAL_INSTALLED_MODULE_STEM := fs_config_files
-LOCAL_MODULE_PATH := $(TARGET_OUT_SYSTEM_DLKM)/etc
-include $(BUILD_SYSTEM)/base_rules.mk
-$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(android_filesystem_config)
-$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_CAP_HDR := $(capability_header)
-$(LOCAL_BUILT_MODULE): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN)
-$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_GEN) $(android_filesystem_config) $(capability_header)
- @mkdir -p $(dir $@)
- $< fsconfig \
- --aid-header $(PRIVATE_ANDROID_FS_HDR) \
- --capability-header $(PRIVATE_ANDROID_CAP_HDR) \
- --partition system_dlkm \
- --files \
- --out_file $@ \
- $(or $(PRIVATE_TARGET_FS_CONFIG_GEN),/dev/null)
-
-endif
-
-android_filesystem_config :=
-capability_header :=
-fs_config_generate_extra_partition_list :=
diff --git a/tools/ide_query/prober_scripts/ide_query.out b/tools/ide_query/prober_scripts/ide_query.out
index cd7ce6d..be48da1 100644
--- a/tools/ide_query/prober_scripts/ide_query.out
+++ b/tools/ide_query/prober_scripts/ide_query.out
@@ -1,7 +1,9 @@
-outa
-8build/make/tools/ide_query/prober_scripts/cpp/general.cc8prebuilts/clang/host/linux-x86/clang-r522817/bin/clang++-mthumb-Os-fomit-frame-pointer-mllvm-enable-shrink-wrap=false-O2-Wall-Wextra-Winit-self-Wpointer-arith-Wunguarded-availability-Werror=date-time-Werror=int-conversion-Werror=pragma-pack&-Werror=pragma-pack-suspicious-include-Werror=sizeof-array-div-Werror=string-plus-int'-Werror=unreachable-code-loop-increment"-Wno-error=deprecated-declarations-Wno-c99-designator-Wno-gnu-folding-constant"-Wno-inconsistent-missing-override-Wno-error=reorder-init-list-Wno-reorder-init-list-Wno-sign-compare-Wno-unused -DANDROID-DNDEBUG-UDEBUG(-D__compiler_offsetof=__builtin_offsetof*-D__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__ -faddrsig-fdebug-default-version=5-fcolor-diagnostics-ffp-contract=off-fno-exceptions-fno-strict-aliasing-fmessage-length=0#-fno-relaxed-template-template-args-gsimple-template-names-gz=zstd-no-canonical-prefixes-Wno-error=format"-fdebug-prefix-map=/proc/self/cwd=-ftrivial-auto-var-init=zero-g-ffunction-sections-fdata-sections-fno-short-enums-funwind-tables-fstack-protector-strong-Wa,--noexecstack-D_FORTIFY_SOURCE=2-Wstrict-aliasing=2-Werror=return-type-Werror=non-virtual-dtor-Werror=address-Werror=sequence-point-Werror=format-security-nostdlibinc-fdebug-info-for-profiling-msoft-float-march=armv7-a-mfloat-abi=softfp
--mfpu=neon/-Ibuild/make/tools/ide_query/prober_scripts/cpp³-Iout/soong/.intermediates/build/make/tools/ide_query/prober_scripts/cpp/ide_query_proberscript_cc/android_arm_armv7-a-neon/gen/proto/build/make/tools/ide_query/prober_scripts/cpp
-Iout/soong/.intermediates/build/make/tools/ide_query/prober_scripts/cpp/ide_query_proberscript_cc/android_arm_armv7-a-neon/gen/proto-D__LIBC_API__=10000-D__LIBM_API__=10000-D__LIBDL_API__=10000-Iexternal/protobuf/srcY-Iprebuilts/clang/host/linux-x86/clang-r522817/android_libc++/platform/arm/include/c++/v1=-Iprebuilts/clang/host/linux-x86/clang-r522817/include/c++/v1 -Ibionic/libc/async_safe/include-Isystem/logging/liblog/include'-Ibionic/libc/system_properties/include<-Isystem/core/property_service/libpropertyinfoparser/include-isystembionic/libc/include-isystembionic/libc/kernel/uapi/asm-arm-isystembionic/libc/kernel/uapi-isystembionic/libc/kernel/android/scsi-isystembionic/libc/kernel/android/uapi-targetarmv7a-linux-androideabi10000-DANDROID_STRICT-fPIE-Werror-Wno-unused-parameter-DGOOGLE_PROTOBUF_NO_RTTI-Wimplicit-fallthrough*-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS-Wno-gnu-include-next-fvisibility-inlines-hidden-mllvm-enable-shrink-wrap=false-std=gnu++20 -fno-rtti-Isystem/core/include-Isystem/logging/liblog/include-Isystem/media/audio/include-Ihardware/libhardware/include%-Ihardware/libhardware_legacy/include-Ihardware/ril/include-Iframeworks/native/include"-Iframeworks/native/opengl/include-Iframeworks/av/include-Werror=bool-operation -Werror=format-insufficient-args%-Werror=implicit-int-float-conversion-Werror=int-in-bool-context-Werror=int-to-pointer-cast-Werror=pointer-to-int-cast-Werror=xor-used-as-pow-Wno-void-pointer-to-enum-cast-Wno-void-pointer-to-int-cast-Wno-pointer-to-int-cast-Werror=fortify-source-Wno-unused-variable-Wno-missing-field-initializers-Wno-packed-non-pod-Werror=address-of-temporary+-Werror=incompatible-function-pointer-types-Werror=null-dereference-Werror=return-type"-Wno-tautological-constant-compare$-Wno-tautological-type-limit-compare"-Wno-implicit-int-float-conversion!-Wno-tautological-overlap-compare-Wno-deprecated-copy-Wno-range-loop-construct"-Wno-zero-as-null-pointer-constant)-Wno-deprecated-anon-enum-enum-conversion$-Wno-deprecated-enum-enum-conversion-Wno-pessimizing-move-Wno-non-c-typedef-for-linkage-Wno-align-mismatch"-Wno-error=unused-but-set-variable#-Wno-error=unused-but-set-parameter-Wno-error=deprecated-builtins-Wno-error=deprecated2-Wno-error=single-bit-bitfield-constant-conversion$-Wno-error=enum-constexpr-conversion-Wno-error=invalid-offsetof&-Wno-deprecated-dynamic-exception-spec8build/make/tools/ide_query/prober_scripts/cpp/general.cc"Õ?
+out2x
+8build/make/tools/ide_query/prober_scripts/cpp/general.cc8build/make/tools/ide_query/prober_scripts/cpp/general.cc:"
+8build/make/tools/ide_query/prober_scripts/cpp/general.cc8build/make/tools/ide_query/prober_scripts/cpp/general.cc"8prebuilts/clang/host/linux-x86/clang-r530567/bin/clang++"-nostdlibinc"-mthumb"-Os"-fomit-frame-pointer"-mllvm"-enable-shrink-wrap=false"-O2"-Wall"-Wextra"-Winit-self"-Wpointer-arith"-Wunguarded-availability"-Werror=date-time"-Werror=int-conversion"-Werror=pragma-pack"&-Werror=pragma-pack-suspicious-include"-Werror=sizeof-array-div"-Werror=string-plus-int"'-Werror=unreachable-code-loop-increment""-Wno-error=deprecated-declarations"-Wno-c23-extensions"-Wno-c99-designator"-Wno-gnu-folding-constant""-Wno-inconsistent-missing-override"-Wno-error=reorder-init-list"-Wno-reorder-init-list"-Wno-sign-compare"-Wno-unused" -DANDROID"-DNDEBUG"-UDEBUG"(-D__compiler_offsetof=__builtin_offsetof"*-D__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__" -faddrsig"-fdebug-default-version=5"-fcolor-diagnostics"-ffp-contract=off"-fno-exceptions"-fno-strict-aliasing"-fmessage-length=0"-gsimple-template-names"-gz=zstd"-no-canonical-prefixes""-fdebug-prefix-map=/proc/self/cwd="-ftrivial-auto-var-init=zero"-g"-ffunction-sections"-fdata-sections"-fno-short-enums"-funwind-tables"-fstack-protector-strong"-Wa,--noexecstack"-D_FORTIFY_SOURCE=2"-Wstrict-aliasing=2"-Werror=return-type"-Werror=non-virtual-dtor"-Werror=address"-Werror=sequence-point"-Werror=format-security"-msoft-float"-march=armv7-a"-mfloat-abi=softfp"
+-mfpu=neon"/-Ibuild/make/tools/ide_query/prober_scripts/cpp"³-Iout/soong/.intermediates/build/make/tools/ide_query/prober_scripts/cpp/ide_query_proberscript_cc/android_arm_armv7-a-neon/gen/proto/build/make/tools/ide_query/prober_scripts/cpp"
-Iout/soong/.intermediates/build/make/tools/ide_query/prober_scripts/cpp/ide_query_proberscript_cc/android_arm_armv7-a-neon/gen/proto"-D__LIBC_API__=10000"-D__LIBM_API__=10000"-D__LIBDL_API__=10000"-Iexternal/protobuf/src"Y-Iprebuilts/clang/host/linux-x86/clang-r530567/android_libc++/platform/arm/include/c++/v1"=-Iprebuilts/clang/host/linux-x86/clang-r530567/include/c++/v1" -Ibionic/libc/async_safe/include"-Isystem/logging/liblog/include"'-Ibionic/libc/system_properties/include"<-Isystem/core/property_service/libpropertyinfoparser/include"-isystem"bionic/libc/include"-isystem"bionic/libc/kernel/uapi/asm-arm"-isystem"bionic/libc/kernel/uapi"-isystem"bionic/libc/kernel/android/scsi"-isystem"bionic/libc/kernel/android/uapi"-target"armv7a-linux-androideabi10000"-DANDROID_STRICT"-fPIE"-Werror"-Wno-unused-parameter"-DGOOGLE_PROTOBUF_NO_RTTI"-Wimplicit-fallthrough"*-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS"-Wno-gnu-include-next"-fvisibility-inlines-hidden"-mllvm"-enable-shrink-wrap=false"-std=gnu++20" -fno-rtti"-Isystem/core/include"-Isystem/logging/liblog/include"-Isystem/media/audio/include"-Ihardware/libhardware/include"%-Ihardware/libhardware_legacy/include"-Ihardware/ril/include"-Iframeworks/native/include""-Iframeworks/native/opengl/include"-Iframeworks/av/include"-Werror=bool-operation" -Werror=format-insufficient-args"%-Werror=implicit-int-float-conversion"-Werror=int-in-bool-context"-Werror=int-to-pointer-cast"-Werror=pointer-to-int-cast"-Werror=xor-used-as-pow"-Wno-void-pointer-to-enum-cast"-Wno-void-pointer-to-int-cast"-Wno-pointer-to-int-cast"-Werror=fortify-source"-Wno-unused-variable"-Wno-missing-field-initializers"-Wno-packed-non-pod"-Werror=address-of-temporary"+-Werror=incompatible-function-pointer-types"-Werror=null-dereference"-Werror=return-type""-Wno-tautological-constant-compare"$-Wno-tautological-type-limit-compare""-Wno-implicit-int-float-conversion"!-Wno-tautological-overlap-compare"-Wno-deprecated-copy"-Wno-range-loop-construct""-Wno-zero-as-null-pointer-constant")-Wno-deprecated-anon-enum-enum-conversion"$-Wno-deprecated-enum-enum-conversion"-Wno-error=pessimizing-move"-Wno-non-c-typedef-for-linkage"-Wno-align-mismatch""-Wno-error=unused-but-set-variable"#-Wno-error=unused-but-set-parameter"-Wno-error=deprecated-builtins"-Wno-error=deprecated"&-Wno-deprecated-dynamic-exception-spec"$-Wno-error=enum-constexpr-conversion"-Wno-error=invalid-offsetof")-Wno-error=thread-safety-reference-return"-Wno-vla-cxx-extension"8build/make/tools/ide_query/prober_scripts/cpp/general.cc2Egenfiles_for_build/make/tools/ide_query/prober_scripts/cpp/general.cc:@
+Egenfiles_for_build/make/tools/ide_query/prober_scripts/cpp/general.cc*Õ?
¶soong/.intermediates/build/make/tools/ide_query/prober_scripts/cpp/ide_query_proberscript_cc/android_arm_armv7-a-neon/gen/proto/build/make/tools/ide_query/prober_scripts/cpp/foo.pb.h>// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: build/make/tools/ide_query/prober_scripts/cpp/foo.proto
diff --git a/tools/ide_query/prober_scripts/regen.sh b/tools/ide_query/prober_scripts/regen.sh
index 2edfe53..04a0264 100755
--- a/tools/ide_query/prober_scripts/regen.sh
+++ b/tools/ide_query/prober_scripts/regen.sh
@@ -21,13 +21,8 @@
# ide_query.sh. The prober doesn't check-out the full source code, so it
# can't run ide_query.sh itself.
-cd $(dirname $BASH_SOURCE)
-source $(pwd)/../../../shell_utils.sh
-require_top
-
files_to_build=(
build/make/tools/ide_query/prober_scripts/cpp/general.cc
)
-cd ${TOP}
build/make/tools/ide_query/ide_query.sh --lunch_target=aosp_arm-trunk_staging-eng ${files_to_build[@]} > build/make/tools/ide_query/prober_scripts/ide_query.out