Merge "make java reader library availiable for mainline" into main am: 8a9a52d140 am: 9cb3450ee4
Original change: https://android-review.googlesource.com/c/platform/build/+/3185681
Change-Id: If427d3d6941dc7e9be7dde239c5496ac98047747
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/core/tasks/mcts.mk b/core/tasks/mcts.mk
index 09a4191..b858823 100644
--- a/core/tasks/mcts.mk
+++ b/core/tasks/mcts.mk
@@ -21,7 +21,7 @@
$(foreach suite, $(mcts_test_suites), \
$(eval test_suite_name := $(suite)) \
- $(eval test_suite_tradefed := mts-tradefed) \
+ $(eval test_suite_tradefed := mcts-tradefed) \
$(eval test_suite_readme := test/mts/README.md) \
$(eval include $(BUILD_SYSTEM)/tasks/tools/compatibility.mk) \
$(eval .PHONY: $(suite)) \
diff --git a/core/tasks/tools/compatibility.mk b/core/tasks/tools/compatibility.mk
index 9189c2d..f205cea 100644
--- a/core/tasks/tools/compatibility.mk
+++ b/core/tasks/tools/compatibility.mk
@@ -27,7 +27,6 @@
# compatibility_zip: the path to the output zip file.
special_mts_test_suites :=
-special_mts_test_suites += mcts
special_mts_test_suites += $(mts_modules)
ifneq ($(filter $(special_mts_test_suites),$(patsubst mcts-%,%,$(test_suite_name))),)
test_suite_subdir := android-mts
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index d8b34f1..18411f6 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -204,6 +204,7 @@
libstdc++ \
libsysutils \
libui \
+ libuprobestats_client \
libusbhost \
libutils \
libvintf_jni \
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/teams/Android.bp b/teams/Android.bp
index a9699d2..69f72d9 100644
--- a/teams/Android.bp
+++ b/teams/Android.bp
@@ -4419,3 +4419,10 @@
// go/trendy/manage/engineers/5403245077430272
trendy_team_id: "5403245077430272",
}
+
+team {
+ name: "trendy_team_pte_sysui",
+
+ // go/trendy/manage/engineers/5185897463382016
+ trendy_team_id: "5185897463382016",
+}
diff --git a/tools/aconfig/aconfig/src/codegen/cpp.rs b/tools/aconfig/aconfig/src/codegen/cpp.rs
index e743b2f..2c569da 100644
--- a/tools/aconfig/aconfig/src/codegen/cpp.rs
+++ b/tools/aconfig/aconfig/src/codegen/cpp.rs
@@ -45,6 +45,8 @@
let header = package.replace('.', "_");
let package_macro = header.to_uppercase();
let cpp_namespace = package.replace('.', "::");
+ ensure!(class_elements.len() > 0);
+ let container = class_elements[0].container.clone();
ensure!(codegen::is_valid_name_ident(&header));
let context = Context {
header: &header,
@@ -56,6 +58,7 @@
readwrite_count,
is_test_mode: codegen_mode == CodegenMode::Test,
class_elements,
+ container,
allow_instrumentation,
};
@@ -100,6 +103,7 @@
pub readwrite_count: i32,
pub is_test_mode: bool,
pub class_elements: Vec<ClassElement>,
+ pub container: String,
pub allow_instrumentation: bool,
}
diff --git a/tools/aconfig/aconfig/src/codegen/rust.rs b/tools/aconfig/aconfig/src/codegen/rust.rs
index 45488b0..661faeb 100644
--- a/tools/aconfig/aconfig/src/codegen/rust.rs
+++ b/tools/aconfig/aconfig/src/codegen/rust.rs
@@ -315,9 +315,11 @@
match aconfig_storage_result {
Ok(storage_result) if storage_result == result => {
log!(Level::Info, "AconfigTestMission1: success! flag 'disabled_rw' contained correct value. Legacy storage was {result}, new storage was {storage_result}");
+ return storage_result;
},
Ok(storage_result) => {
log!(Level::Error, "AconfigTestMission1: error: mismatch for flag 'disabled_rw'. Legacy storage was {result}, new storage was {storage_result}");
+ return storage_result;
},
Err(err) => {
log!(Level::Error, "AconfigTestMission1: error: {err}")
@@ -364,9 +366,11 @@
match aconfig_storage_result {
Ok(storage_result) if storage_result == result => {
log!(Level::Info, "AconfigTestMission1: success! flag 'disabled_rw_exported' contained correct value. Legacy storage was {result}, new storage was {storage_result}");
+ return storage_result;
},
Ok(storage_result) => {
log!(Level::Error, "AconfigTestMission1: error: mismatch for flag 'disabled_rw_exported'. Legacy storage was {result}, new storage was {storage_result}");
+ return storage_result;
},
Err(err) => {
log!(Level::Error, "AconfigTestMission1: error: {err}")
@@ -413,9 +417,11 @@
match aconfig_storage_result {
Ok(storage_result) if storage_result == result => {
log!(Level::Info, "AconfigTestMission1: success! flag 'disabled_rw_in_other_namespace' contained correct value. Legacy storage was {result}, new storage was {storage_result}");
+ return storage_result;
},
Ok(storage_result) => {
log!(Level::Error, "AconfigTestMission1: error: mismatch for flag 'disabled_rw_in_other_namespace'. Legacy storage was {result}, new storage was {storage_result}");
+ return storage_result;
},
Err(err) => {
log!(Level::Error, "AconfigTestMission1: error: {err}")
@@ -462,9 +468,11 @@
match aconfig_storage_result {
Ok(storage_result) if storage_result == result => {
log!(Level::Info, "AconfigTestMission1: success! flag 'enabled_rw' contained correct value. Legacy storage was {result}, new storage was {storage_result}");
+ return storage_result;
},
Ok(storage_result) => {
log!(Level::Error, "AconfigTestMission1: error: mismatch for flag 'enabled_rw'. Legacy storage was {result}, new storage was {storage_result}");
+ return storage_result;
},
Err(err) => {
log!(Level::Error, "AconfigTestMission1: error: {err}")
diff --git a/tools/aconfig/aconfig/templates/cpp_source_file.template b/tools/aconfig/aconfig/templates/cpp_source_file.template
index 38dda7d..600e4da 100644
--- a/tools/aconfig/aconfig/templates/cpp_source_file.template
+++ b/tools/aconfig/aconfig/templates/cpp_source_file.template
@@ -1,13 +1,13 @@
#include "{header}.h"
{{ if allow_instrumentation }}
+{{ if readwrite- }}
#include <sys/stat.h>
#include "aconfig_storage/aconfig_storage_read_api.hpp"
#include <android/log.h>
-
-#define ALOGI(msg, ...) \
- __android_log_print(ANDROID_LOG_INFO, "AconfigTestMission1", (msg), __VA_ARGS__)
-
+#define LOG_TAG "aconfig_cpp_codegen"
+#define ALOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
+{{ -endif }}
{{ endif }}
{{ if readwrite- }}
@@ -66,8 +66,60 @@
class flag_provider : public flag_provider_interface \{
public:
- {{ -for item in class_elements }}
+ {{ if allow_instrumentation- }}
+ {{ if readwrite- }}
+ flag_provider()
+ {{ if readwrite- }}
+ : cache_({readwrite_count}, -1)
+ , boolean_start_index_()
+ {{ -else- }}
+ : boolean_start_index_()
+ {{ -endif }}
+ , flag_value_file_(nullptr)
+ , read_from_new_storage_(false) \{
+ struct stat buffer;
+ if (stat("/metadata/aconfig_test_missions/mission_1", &buffer) == 0) \{
+ read_from_new_storage_ = true;
+ }
+
+ auto package_map_file = aconfig_storage::get_mapped_file(
+ "{container}",
+ aconfig_storage::StorageFileType::package_map);
+ if (!package_map_file.ok()) \{
+ ALOGI("error: failed to get package map file: %s", package_map_file.error().c_str());
+ return;
+ }
+
+ auto context = aconfig_storage::get_package_read_context(
+ **package_map_file, "{package}");
+ if (!context.ok()) \{
+ ALOGI("error: failed to get package read context: %s", context.error().c_str());
+ return;
+ }
+
+ // cache package boolean flag start index
+ boolean_start_index_ = context->boolean_start_index;
+
+ // unmap package map file and free memory
+ delete *package_map_file;
+
+ auto flag_value_file = aconfig_storage::get_mapped_file(
+ "{container}",
+ aconfig_storage::StorageFileType::flag_val);
+ if (!flag_value_file.ok()) \{
+ ALOGI("error: failed to get flag value file: %s", flag_value_file.error().c_str());
+ return;
+ }
+
+ // cache flag value file
+ flag_value_file_ = std::unique_ptr<aconfig_storage::MappedStorageFile>(
+ *flag_value_file);
+ }
+ {{ -endif }}
+ {{ -endif }}
+
+ {{ -for item in class_elements }}
virtual bool {item.flag_name}() override \{
{{ -if item.readwrite }}
if (cache_[{item.readwrite_idx}] == -1) \{
@@ -76,6 +128,37 @@
"{item.device_config_flag}",
"{item.default_value}") == "true";
}
+
+
+ {{ if allow_instrumentation- }}
+ if (read_from_new_storage_) \{
+ if (!flag_value_file_) \{
+ ALOGI("error: failed to get flag {item.flag_name}: flag value file is null");
+ return cache_[{item.readwrite_idx}];
+ }
+
+ auto value = aconfig_storage::get_boolean_flag_value(
+ *flag_value_file_,
+ boolean_start_index_ + {item.flag_offset});
+
+ if (!value.ok()) \{
+ ALOGI("error: failed to read flag value: %s", value.error().c_str());
+ return cache_[{item.readwrite_idx}];
+ }
+
+ bool expected_value = cache_[{item.readwrite_idx}];
+ if (*value != expected_value) \{
+ ALOGI("error: {item.flag_name} value mismatch, new storage value is %s, old storage value is %s",
+ *value ? "true" : "false", expected_value ? "true" : "false");
+ } else \{
+ ALOGI("success: {item.flag_name} value matches");
+ }
+
+ return *value;
+ }
+ {{ -endif }}
+
+
return cache_[{item.readwrite_idx}];
{{ -else }}
{{ -if item.is_fixed_read_only }}
@@ -86,12 +169,20 @@
{{ -endif }}
}
{{ -endfor }}
+
{{ if readwrite- }}
private:
std::vector<int8_t> cache_ = std::vector<int8_t>({readwrite_count}, -1);
- {{ -endif }}
- };
+ {{ if allow_instrumentation- }}
+ uint32_t boolean_start_index_;
+ std::unique_ptr<aconfig_storage::MappedStorageFile> flag_value_file_;
+
+ bool read_from_new_storage_;
+ {{ -endif }}
+ {{ -endif }}
+
+ };
{{ -endif }}
@@ -107,62 +198,6 @@
{{ -if item.readwrite }}
return {cpp_namespace}::{item.flag_name}();
{{ -else }}
- {{ if allow_instrumentation }}
- auto result =
- {{ if item.is_fixed_read_only }}
- {package_macro}_{item.flag_macro}
- {{ else }}
- {item.default_value}
- {{ endif }};
-
- struct stat buffer;
- if (stat("/metadata/aconfig_test_missions/mission_1", &buffer) != 0) \{
- return result;
- }
-
- auto package_map_file = aconfig_storage::get_mapped_file(
- "{item.container}",
- aconfig_storage::StorageFileType::package_map);
- if (!package_map_file.ok()) \{
- ALOGI("error: failed to get package map file: %s", package_map_file.error().c_str());
- return result;
- }
-
- auto package_read_context = aconfig_storage::get_package_read_context(
- **package_map_file, "{package}");
- if (!package_read_context.ok()) \{
- ALOGI("error: failed to get package read context: %s", package_map_file.error().c_str());
- return result;
- }
-
- delete *package_map_file;
-
- auto flag_val_map = aconfig_storage::get_mapped_file(
- "{item.container}",
- aconfig_storage::StorageFileType::flag_val);
- if (!flag_val_map.ok()) \{
- ALOGI("error: failed to get flag val map: %s", package_map_file.error().c_str());
- return result;
- }
-
- auto value = aconfig_storage::get_boolean_flag_value(
- **flag_val_map,
- package_read_context->boolean_start_index + {item.flag_offset});
- if (!value.ok()) \{
- ALOGI("error: failed to get flag val: %s", package_map_file.error().c_str());
- return result;
- }
-
- delete *flag_val_map;
-
- if (*value != result) \{
- ALOGI("error: new storage value '%d' does not match current value '%d'", *value, result);
- } else \{
- ALOGI("success: new storage value was '%d, legacy storage was '%d'", *value, result);
- }
-
- return result;
- {{ else }}
{{ -if item.is_fixed_read_only }}
return {package_macro}_{item.flag_macro};
{{ -else }}
@@ -170,7 +205,6 @@
{{ -endif }}
{{ -endif }}
{{ -endif }}
- {{ -endif }}
}
{{ -if is_test_mode }}
@@ -185,5 +219,3 @@
{cpp_namespace}::reset_flags();
}
{{ -endif }}
-
-
diff --git a/tools/aconfig/aconfig/templates/rust.template b/tools/aconfig/aconfig/templates/rust.template
index cfd9d6a..85bab03 100644
--- a/tools/aconfig/aconfig/templates/rust.template
+++ b/tools/aconfig/aconfig/templates/rust.template
@@ -63,9 +63,11 @@
match aconfig_storage_result \{
Ok(storage_result) if storage_result == result => \{
log!(Level::Info, "AconfigTestMission1: success! flag '{flag.name}' contained correct value. Legacy storage was \{result}, new storage was \{storage_result}");
+ return storage_result;
},
Ok(storage_result) => \{
log!(Level::Error, "AconfigTestMission1: error: mismatch for flag '{flag.name}'. Legacy storage was \{result}, new storage was \{storage_result}");
+ return storage_result;
},
Err(err) => \{
log!(Level::Error, "AconfigTestMission1: error: \{err}")
diff --git a/tools/filelistdiff/allowlist b/tools/filelistdiff/allowlist
index 943f955..72c12a0 100644
--- a/tools/filelistdiff/allowlist
+++ b/tools/filelistdiff/allowlist
@@ -84,4 +84,16 @@
# Known diffs only in the Soong system image
lib/libhidcommand_jni.so
-lib/libuinputcommand_jni.so
\ No newline at end of file
+lib/libuinputcommand_jni.so
+
+# Known diffs in internal source
+bin/uprobestats
+etc/aconfig/flag.map
+etc/aconfig/flag.val
+etc/aconfig/package.map
+etc/bpf/uprobestats/BitmapAllocation.o
+etc/bpf/uprobestats/GenericInstrumentation.o
+etc/init/UprobeStats.rc
+lib/libuprobestats_client.so
+lib64/libuprobestats_client.so
+priv-app/DeviceDiagnostics/DeviceDiagnostics.apk
\ No newline at end of file