Merge "Add a Java lib to read on-device proto paths" into main
diff --git a/CleanSpec.mk b/CleanSpec.mk
index dfc0cd0..f8c96ff 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -779,6 +779,14 @@
# Clear out rustc compiler intermediates after reverting rust compiler/linker split.
$(call add-clean-step, find $(OUT_DIR) -name "*.rsp.whole.a" -print0 | xargs -0 /bin/bash -c 'rm -f $$$${@}; rm -f $$$${@/.rsp.whole.a/.rsp.a}; rm -f $$$${@/.rsp.whole.a/.rsp}')
+# Remove obsolete java compilation artifacts
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/)
+$(call add-clean-step, find $(OUT_DIR) -type f -name "*.jar" -print0 | xargs -0 rm -f)
+
+# Remove obsolete java compilation artifacts
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/)
+$(call add-clean-step, find $(OUT_DIR) -type f -name "*.jar" -print0 | xargs -0 rm -f)
+
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
diff --git a/core/android_soong_config_vars.mk b/core/android_soong_config_vars.mk
index 18d245c..ed72fc3 100644
--- a/core/android_soong_config_vars.mk
+++ b/core/android_soong_config_vars.mk
@@ -38,27 +38,6 @@
# PRODUCT_PRECOMPILED_SEPOLICY defaults to true. Explicitly check if it's "false" or not.
$(call add_soong_config_var_value,ANDROID,PRODUCT_PRECOMPILED_SEPOLICY,$(if $(filter false,$(PRODUCT_PRECOMPILED_SEPOLICY)),false,true))
-# Default behavior for the tree wrt building modules or using prebuilts. This
-# can always be overridden by setting the environment variable
-# MODULE_BUILD_FROM_SOURCE.
-BRANCH_DEFAULT_MODULE_BUILD_FROM_SOURCE := $(RELEASE_DEFAULT_MODULE_BUILD_FROM_SOURCE)
-# TODO(b/301454934): The value from build flag is set to empty when use `False`
-# The condition below can be removed after the issue get sorted.
-ifeq (,$(BRANCH_DEFAULT_MODULE_BUILD_FROM_SOURCE))
- BRANCH_DEFAULT_MODULE_BUILD_FROM_SOURCE := false
-endif
-
-ifneq (,$(MODULE_BUILD_FROM_SOURCE))
- # Keep an explicit setting.
-else ifeq (,$(filter docs sdk win_sdk sdk_addon,$(MAKECMDGOALS)))
- MODULE_BUILD_FROM_SOURCE := true
-else ifneq (,$(PRODUCT_MODULE_BUILD_FROM_SOURCE))
- # Let products override the branch default.
- MODULE_BUILD_FROM_SOURCE := $(PRODUCT_MODULE_BUILD_FROM_SOURCE)
-else
- MODULE_BUILD_FROM_SOURCE := $(BRANCH_DEFAULT_MODULE_BUILD_FROM_SOURCE)
-endif
-
ifdef ART_DEBUG_OPT_FLAG
$(call soong_config_set,art_module,art_debug_opt_flag,$(ART_DEBUG_OPT_FLAG))
endif
@@ -76,9 +55,10 @@
endif
endif
-ifeq (true,$(MODULE_BUILD_FROM_SOURCE))
+# TODO(b/308187800): some internal modules set `prefer` to true on the prebuilt apex module,
+# and set that to false when `ANDROID.module_build_from_source` is true.
+# Set this soong config variable to true for now, and cleanup `prefer` as part of b/308187800
$(call add_soong_config_var_value,ANDROID,module_build_from_source,true)
-endif
# Messaging app vars
ifeq (eng,$(TARGET_BUILD_VARIANT))
diff --git a/core/product.mk b/core/product.mk
index f8634ef..0a761fb 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -418,8 +418,9 @@
# /system/etc/security/fsverity/BuildManifest.apk
_product_single_value_vars += PRODUCT_FSVERITY_GENERATE_METADATA
-# If true, sets the default for MODULE_BUILD_FROM_SOURCE. This overrides
-# BRANCH_DEFAULT_MODULE_BUILD_FROM_SOURCE but not an explicitly set value.
+# If true, this builds the mainline modules from source. This overrides any
+# prebuilts selected via RELEASE_APEX_CONTRIBUTIONS_* build flags for the
+# current release config.
_product_single_value_vars += PRODUCT_MODULE_BUILD_FROM_SOURCE
# If true, installs a full version of com.android.virt APEX.
diff --git a/core/tasks/meta-lic.mk b/core/tasks/meta-lic.mk
index 33c8c11..2126bd0 100644
--- a/core/tasks/meta-lic.mk
+++ b/core/tasks/meta-lic.mk
@@ -101,6 +101,23 @@
$(eval $(call declare-1p-copy-files,device/google/raviole,audio_policy_configuration.xml))
+# Moved here from device/google/redfin/Android.mk
+$(eval $(call declare-copy-files-license-metadata,device/google/redfin,default-permissions.xml,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/redfin,libnfc-nci.conf,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/redfin,fstab.postinstall,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/redfin,ueventd.rc,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/redfin,wpa_supplicant.conf,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/redfin,hals.conf,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/redfin,media_profiles_V1_0.xml,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/redfin,media_codecs_performance.xml,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/redfin,device_state_configuration.xml,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/redfin,task_profiles.json,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/redfin,p2p_supplicant.conf,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/redfin,wpa_supplicant.conf,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+$(eval $(call declare-copy-files-license-metadata,device/google/redfin,wpa_supplicant_overlay.conf,SPDX-license-identifier-Apache-2.0,notice,build/soong/licenses/LICENSE,))
+
+$(eval $(call declare-1p-copy-files,device/google/redfin,audio_policy_configuration.xml))
+
# Moved here from device/sample/Android.mk
$(eval $(call declare-1p-copy-files,device/sample,))
diff --git a/envsetup.sh b/envsetup.sh
index 1ef9a54..50fec51 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -1112,8 +1112,8 @@
local tool_binary="$1"
shift
- # If logging is not enabled or the logger is not configured, run the original command and return.
- if [[ "${ANDROID_ENABLE_TOOL_LOGGING}" != "true" ]] || [[ -z "${ANDROID_TOOL_LOGGER}" ]]; then
+ # If the logger is not configured, run the original command and return.
+ if [[ -z "${ANDROID_TOOL_LOGGER}" ]]; then
"${tool_binary}" "${@}"
return $?
fi
diff --git a/target/product/module_arm64.mk b/target/product/module_arm64.mk
index 634a03d..d6487ca 100644
--- a/target/product/module_arm64.mk
+++ b/target/product/module_arm64.mk
@@ -21,3 +21,4 @@
PRODUCT_DEVICE := module_arm64
PRODUCT_NO_BIONIC_PAGE_SIZE_MACRO := true
+PRODUCT_MAX_PAGE_SIZE_SUPPORTED := 16384
diff --git a/target/product/module_arm64only.mk b/target/product/module_arm64only.mk
index 822ac24..137701a 100644
--- a/target/product/module_arm64only.mk
+++ b/target/product/module_arm64only.mk
@@ -21,3 +21,4 @@
PRODUCT_DEVICE := module_arm64only
PRODUCT_NO_BIONIC_PAGE_SIZE_MACRO := true
+PRODUCT_MAX_PAGE_SIZE_SUPPORTED := 16384
diff --git a/target/product/module_common.mk b/target/product/module_common.mk
index bf146a0..da4ea23 100644
--- a/target/product/module_common.mk
+++ b/target/product/module_common.mk
@@ -24,8 +24,9 @@
# uses -DENFORCE_VINTF_MANIFEST. See b/185759877
PRODUCT_SHIPPING_API_LEVEL := 29
-# Builds using a module product should build modules from source, even if
-# BRANCH_DEFAULT_MODULE_BUILD_FROM_SOURCE says otherwise.
+# If true, this builds the mainline modules from source. This overrides any
+# prebuilts selected via RELEASE_APEX_CONTRIBUTIONS_* build flags for the
+# current release config.
PRODUCT_MODULE_BUILD_FROM_SOURCE := true
# Build sdk from source if the branch is not using slim manifests.
diff --git a/target/product/module_x86_64.mk b/target/product/module_x86_64.mk
index 9bd0264..e182bf6 100644
--- a/target/product/module_x86_64.mk
+++ b/target/product/module_x86_64.mk
@@ -21,3 +21,4 @@
PRODUCT_DEVICE := module_x86_64
PRODUCT_NO_BIONIC_PAGE_SIZE_MACRO := true
+PRODUCT_MAX_PAGE_SIZE_SUPPORTED := 16384
diff --git a/target/product/module_x86_64only.mk b/target/product/module_x86_64only.mk
index 056fb90..fa4a04d 100644
--- a/target/product/module_x86_64only.mk
+++ b/target/product/module_x86_64only.mk
@@ -21,3 +21,4 @@
PRODUCT_DEVICE := module_x86_64only
PRODUCT_NO_BIONIC_PAGE_SIZE_MACRO := true
+PRODUCT_MAX_PAGE_SIZE_SUPPORTED := 16384
diff --git a/tests/run_tool_with_logging_test.py b/tests/run_tool_with_logging_test.py
index 215d992..18abd8e 100644
--- a/tests/run_tool_with_logging_test.py
+++ b/tests/run_tool_with_logging_test.py
@@ -59,37 +59,10 @@
self.working_dir.cleanup()
super().tearDown()
- def test_does_not_log_when_logging_disabled(self):
- test_tool = TestScript.create(self.working_dir)
- test_logger = TestScript.create(self.working_dir)
-
- self._run_script_and_wait(f"""
- ANDROID_ENABLE_TOOL_LOGGING=false
- ANDROID_TOOL_LOGGER="{test_logger.executable}"
- run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2
- """)
-
- test_tool.assert_called_once_with_args("arg1 arg2")
- test_logger.assert_not_called()
-
- def test_does_not_log_when_logger_var_unset(self):
- test_tool = TestScript.create(self.working_dir)
- test_logger = TestScript.create(self.working_dir)
-
- self._run_script_and_wait(f"""
- unset ANDROID_ENABLE_TOOL_LOGGING
- ANDROID_TOOL_LOGGER="{test_logger.executable}"
- run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2
- """)
-
- test_tool.assert_called_once_with_args("arg1 arg2")
- test_logger.assert_not_called()
-
def test_does_not_log_when_logger_var_empty(self):
test_tool = TestScript.create(self.working_dir)
self._run_script_and_wait(f"""
- ANDROID_ENABLE_TOOL_LOGGING=true
ANDROID_TOOL_LOGGER=""
run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2
""")
@@ -100,7 +73,6 @@
test_tool = TestScript.create(self.working_dir)
self._run_script_and_wait(f"""
- ANDROID_ENABLE_TOOL_LOGGING=true
unset ANDROID_TOOL_LOGGER
run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2
""")
@@ -112,7 +84,6 @@
test_logger = TestScript.create(self.working_dir)
self._run_script_and_wait(f"""
- ANDROID_ENABLE_TOOL_LOGGING=true
ANDROID_TOOL_LOGGER="{test_logger.executable}"
run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2
""")
@@ -130,7 +101,6 @@
run_tool_with_logging_stdout, run_tool_with_logging_stderr = (
self._run_script_and_wait(f"""
- ANDROID_ENABLE_TOOL_LOGGING=true
ANDROID_TOOL_LOGGER="{test_logger.executable}"
run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2
""")
@@ -138,7 +108,6 @@
run_tool_without_logging_stdout, run_tool_without_logging_stderr = (
self._run_script_and_wait(f"""
- ANDROID_ENABLE_TOOL_LOGGING=true
ANDROID_TOOL_LOGGER="{test_logger.executable}"
{test_tool.executable} arg1 arg2
""")
@@ -156,7 +125,6 @@
test_logger = TestScript.create(self.working_dir, "echo 'logger called'")
run_tool_with_logging_output, _ = self._run_script_and_wait(f"""
- ANDROID_ENABLE_TOOL_LOGGING=true
ANDROID_TOOL_LOGGER="{test_logger.executable}"
run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2
""")
@@ -170,7 +138,6 @@
)
_, err = self._run_script_and_wait(f"""
- ANDROID_ENABLE_TOOL_LOGGING=true
ANDROID_TOOL_LOGGER="{test_logger.executable}"
run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2
""")
@@ -182,7 +149,6 @@
test_logger = TestScript.create(self.working_dir)
process = self._run_script_in_build_env(f"""
- ANDROID_ENABLE_TOOL_LOGGING=true
ANDROID_TOOL_LOGGER="{test_logger.executable}"
run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2
""")
@@ -207,9 +173,8 @@
test_logger = TestScript.create(self.working_dir)
self._run_script_and_wait(f"""
- ANDROID_ENABLE_TOOL_LOGGING=false
+ ANDROID_TOOL_LOGGER=""
ANDROID_TOOL_LOGGER="{test_logger.executable}"
- ANDROID_ENABLE_TOOL_LOGGING=true
run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2
""")
@@ -220,9 +185,8 @@
test_logger = TestScript.create(self.working_dir)
self._run_script_and_wait(f"""
- ANDROID_ENABLE_TOOL_LOGGING=true
ANDROID_TOOL_LOGGER="{test_logger.executable}"
- ANDROID_ENABLE_TOOL_LOGGING=false
+ ANDROID_TOOL_LOGGER=""
run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2
""")
@@ -234,7 +198,6 @@
self._run_script_and_wait(f"""
TMPDIR="{self.working_dir.name}"
- ANDROID_ENABLE_TOOL_LOGGING=true
ANDROID_TOOL_LOGGER="{logger_path}"
ANDROID_TOOL_LOGGER_EXTRA_ARGS="--dry_run"
run_tool_with_logging "FAKE_TOOL" {test_tool.executable} arg1 arg2
diff --git a/tools/aconfig/aconfig_storage_file/protos/aconfig_storage_metadata.proto b/tools/aconfig/aconfig_storage_file/protos/aconfig_storage_metadata.proto
index 7de43ca..f6bf1a4 100644
--- a/tools/aconfig/aconfig_storage_file/protos/aconfig_storage_metadata.proto
+++ b/tools/aconfig/aconfig_storage_file/protos/aconfig_storage_metadata.proto
@@ -28,7 +28,8 @@
optional string flag_val = 5;
optional string flag_info = 6;
optional string local_overrides = 7;
- optional int64 timestamp = 8;
+ optional string default_flag_val = 8;
+ optional int64 timestamp = 9;
}
message storage_files {
diff --git a/tools/aconfig/aconfig_storage_read_api/include/aconfig_storage/aconfig_storage_read_api.hpp b/tools/aconfig/aconfig_storage_read_api/include/aconfig_storage/aconfig_storage_read_api.hpp
index b8ee06a..e6d7537 100644
--- a/tools/aconfig/aconfig_storage_read_api/include/aconfig_storage/aconfig_storage_read_api.hpp
+++ b/tools/aconfig/aconfig_storage_read_api/include/aconfig_storage/aconfig_storage_read_api.hpp
@@ -41,7 +41,7 @@
struct MappedStorageFile {
void* file_ptr;
size_t file_size;
- ~MappedStorageFile();
+ virtual ~MappedStorageFile();
};
/// Package read context query result
diff --git a/tools/aconfig/aconfig_storage_write_api/aconfig_storage_write_api.cpp b/tools/aconfig/aconfig_storage_write_api/aconfig_storage_write_api.cpp
index 197486d..f529f79 100644
--- a/tools/aconfig/aconfig_storage_write_api/aconfig_storage_write_api.cpp
+++ b/tools/aconfig/aconfig_storage_write_api/aconfig_storage_write_api.cpp
@@ -17,11 +17,6 @@
namespace aconfig_storage {
-/// destructor
-MutableMappedStorageFile::~MutableMappedStorageFile() {
- munmap(file_ptr, file_size);
-}
-
/// Map a storage file
Result<MutableMappedStorageFile*> map_mutable_storage_file(std::string const& file) {
struct stat file_stat;
diff --git a/tools/aconfig/aconfig_storage_write_api/include/aconfig_storage/aconfig_storage_write_api.hpp b/tools/aconfig/aconfig_storage_write_api/include/aconfig_storage/aconfig_storage_write_api.hpp
index 1eca1e0..ff06cbc 100644
--- a/tools/aconfig/aconfig_storage_write_api/include/aconfig_storage/aconfig_storage_write_api.hpp
+++ b/tools/aconfig/aconfig_storage_write_api/include/aconfig_storage/aconfig_storage_write_api.hpp
@@ -11,11 +11,7 @@
namespace aconfig_storage {
/// Mapped flag value file
-struct MutableMappedStorageFile{
- void* file_ptr;
- size_t file_size;
- ~MutableMappedStorageFile();
-};
+struct MutableMappedStorageFile : MappedStorageFile {};
/// Map a storage file
Result<MutableMappedStorageFile*> map_mutable_storage_file(
diff --git a/tools/aconfig/aconfig_storage_write_api/tests/storage_write_api_test.cpp b/tools/aconfig/aconfig_storage_write_api/tests/storage_write_api_test.cpp
index aeede49..5437379 100644
--- a/tools/aconfig/aconfig_storage_write_api/tests/storage_write_api_test.cpp
+++ b/tools/aconfig/aconfig_storage_write_api/tests/storage_write_api_test.cpp
@@ -80,13 +80,10 @@
ASSERT_TRUE(mapped_file_result.ok());
auto mapped_file = std::unique_ptr<api::MutableMappedStorageFile>(*mapped_file_result);
- auto ro_mapped_file = api::MappedStorageFile();
- ro_mapped_file.file_ptr = mapped_file->file_ptr;
- ro_mapped_file.file_size = mapped_file->file_size;
for (int offset = 0; offset < 8; ++offset) {
auto update_result = api::set_boolean_flag_value(*mapped_file, offset, true);
ASSERT_TRUE(update_result.ok());
- auto value = api::get_boolean_flag_value(ro_mapped_file, offset);
+ auto value = api::get_boolean_flag_value(*mapped_file, offset);
ASSERT_TRUE(value.ok());
ASSERT_TRUE(*value);
}
@@ -97,7 +94,6 @@
auto mapped_file_result = api::map_mutable_storage_file(flag_val);
ASSERT_TRUE(mapped_file_result.ok());
auto mapped_file = std::unique_ptr<api::MutableMappedStorageFile>(*mapped_file_result);
-
auto update_result = api::set_boolean_flag_value(*mapped_file, 8, true);
ASSERT_FALSE(update_result.ok());
ASSERT_EQ(update_result.error().message(),
@@ -110,16 +106,12 @@
ASSERT_TRUE(mapped_file_result.ok());
auto mapped_file = std::unique_ptr<api::MutableMappedStorageFile>(*mapped_file_result);
- auto ro_mapped_file = api::MappedStorageFile();
- ro_mapped_file.file_ptr = mapped_file->file_ptr;
- ro_mapped_file.file_size = mapped_file->file_size;
-
for (int offset = 0; offset < 8; ++offset) {
auto update_result = api::set_flag_has_server_override(
*mapped_file, api::FlagValueType::Boolean, offset, true);
ASSERT_TRUE(update_result.ok()) << update_result.error();
auto attribute = api::get_flag_attribute(
- ro_mapped_file, api::FlagValueType::Boolean, offset);
+ *mapped_file, api::FlagValueType::Boolean, offset);
ASSERT_TRUE(attribute.ok());
ASSERT_TRUE(*attribute & api::FlagInfoBit::HasServerOverride);
@@ -127,7 +119,7 @@
*mapped_file, api::FlagValueType::Boolean, offset, false);
ASSERT_TRUE(update_result.ok());
attribute = api::get_flag_attribute(
- ro_mapped_file, api::FlagValueType::Boolean, offset);
+ *mapped_file, api::FlagValueType::Boolean, offset);
ASSERT_TRUE(attribute.ok());
ASSERT_FALSE(*attribute & api::FlagInfoBit::HasServerOverride);
}
@@ -139,16 +131,12 @@
ASSERT_TRUE(mapped_file_result.ok());
auto mapped_file = std::unique_ptr<api::MutableMappedStorageFile>(*mapped_file_result);
- auto ro_mapped_file = api::MappedStorageFile();
- ro_mapped_file.file_ptr = mapped_file->file_ptr;
- ro_mapped_file.file_size = mapped_file->file_size;
-
for (int offset = 0; offset < 8; ++offset) {
auto update_result = api::set_flag_has_local_override(
*mapped_file, api::FlagValueType::Boolean, offset, true);
ASSERT_TRUE(update_result.ok());
auto attribute = api::get_flag_attribute(
- ro_mapped_file, api::FlagValueType::Boolean, offset);
+ *mapped_file, api::FlagValueType::Boolean, offset);
ASSERT_TRUE(attribute.ok());
ASSERT_TRUE(*attribute & api::FlagInfoBit::HasLocalOverride);
@@ -156,7 +144,7 @@
*mapped_file, api::FlagValueType::Boolean, offset, false);
ASSERT_TRUE(update_result.ok());
attribute = api::get_flag_attribute(
- ro_mapped_file, api::FlagValueType::Boolean, offset);
+ *mapped_file, api::FlagValueType::Boolean, offset);
ASSERT_TRUE(attribute.ok());
ASSERT_FALSE(*attribute & api::FlagInfoBit::HasLocalOverride);
}