Merge changes from topic "cf_system_root_files" into main am: 94d502200c am: 235076ff5e
Original change: https://android-review.googlesource.com/c/platform/build/+/3163175
Change-Id: I8d621d7341e778f8b4e74a7cb91b4336989f8276
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
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 5fe5333..0c45cde 100644
--- a/target/product/build_variables.mk
+++ b/target/product/build_variables.mk
@@ -19,3 +19,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/templates/cpp_source_file.template b/tools/aconfig/aconfig/templates/cpp_source_file.template
index 38dda7d..6859388 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,33 @@
"{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");
+ }
+
+ 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());
+ }
+
+ 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");
+ }
+ }
+ {{ -endif }}
+
+
return cache_[{item.readwrite_idx}];
{{ -else }}
{{ -if item.is_fixed_read_only }}
@@ -86,12 +165,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 +194,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 +201,6 @@
{{ -endif }}
{{ -endif }}
{{ -endif }}
- {{ -endif }}
}
{{ -if is_test_mode }}
@@ -185,5 +215,3 @@
{cpp_namespace}::reset_flags();
}
{{ -endif }}
-
-
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