Merge "Add new SBOM generation tool." into main am: 31964df630 am: 61f3fbd2c2

Original change: https://android-review.googlesource.com/c/platform/build/+/2956675

Change-Id: I2e865552bc781943f50eefb979e5be3207572fcb
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..02e916a 100644
--- a/core/tasks/mcts.mk
+++ b/core/tasks/mcts.mk
@@ -15,7 +15,8 @@
 ifneq ($(wildcard test/mts/README.md),)
 
 mcts_test_suites :=
-mcts_test_suites += mcts
+mcts_all_test_suites :=
+mcts_all_test_suites += mcts
 
 $(foreach module, $(mts_modules), $(eval mcts_test_suites += mcts-$(module)))
 
@@ -29,4 +30,14 @@
 	$(eval $(call dist-for-goals, $(suite), $(compatibility_zip))) \
 )
 
+$(foreach suite, $(mcts_all_test_suites), \
+	$(eval test_suite_name := $(suite)) \
+	$(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)) \
+	$(eval $(suite): $(compatibility_zip)) \
+	$(eval $(call dist-for-goals, $(suite), $(compatibility_zip))) \
+)
+
 endif
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 9a6746f..6e90f4b 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/aconfig/aflags/Android.bp b/tools/aconfig/aflags/Android.bp
index 2a02379..c48585a 100644
--- a/tools/aconfig/aflags/Android.bp
+++ b/tools/aconfig/aflags/Android.bp
@@ -11,6 +11,7 @@
     rustlibs: [
         "libaconfig_device_paths",
         "libaconfig_protos",
+        "libaconfigd_protos",
         "libaconfig_storage_read_api",
         "libaconfig_storage_file",
         "libanyhow",
diff --git a/tools/aconfig/aflags/Cargo.toml b/tools/aconfig/aflags/Cargo.toml
index eeae295..7dc3436 100644
--- a/tools/aconfig/aflags/Cargo.toml
+++ b/tools/aconfig/aflags/Cargo.toml
@@ -9,6 +9,7 @@
 protobuf = "3.2.0"
 regex = "1.10.3"
 aconfig_protos = { path = "../aconfig_protos" }
+aconfigd_protos = { version = "0.1.0", path = "../../../../../system/server_configurable_flags/aconfigd"}
 nix = { version = "0.28.0", features = ["user"] }
 aconfig_storage_file = { version = "0.1.0", path = "../aconfig_storage_file" }
 aconfig_storage_read_api = { version = "0.1.0", path = "../aconfig_storage_read_api" }
diff --git a/tools/aconfig/aflags/src/aconfig_storage_source.rs b/tools/aconfig/aflags/src/aconfig_storage_source.rs
index 0dfb956..1f52d73 100644
--- a/tools/aconfig/aflags/src/aconfig_storage_source.rs
+++ b/tools/aconfig/aflags/src/aconfig_storage_source.rs
@@ -1,136 +1,118 @@
-use crate::{Flag, FlagPermission, FlagSource, FlagValue, ValuePickedFrom};
-use anyhow::{anyhow, Result};
-
-use std::collections::HashMap;
-use std::fs::File;
-use std::io::Read;
+use crate::{Flag, FlagSource};
+use crate::{FlagPermission, FlagValue, ValuePickedFrom};
+use aconfigd_protos::{
+    ProtoFlagQueryReturnMessage, ProtoListStorageMessage, ProtoListStorageMessageMsg,
+    ProtoStorageRequestMessage, ProtoStorageRequestMessageMsg, ProtoStorageRequestMessages,
+    ProtoStorageReturnMessage, ProtoStorageReturnMessageMsg, ProtoStorageReturnMessages,
+};
+use anyhow::anyhow;
+use anyhow::Result;
+use protobuf::Message;
+use protobuf::SpecialFields;
+use std::io::{Read, Write};
+use std::net::Shutdown;
+use std::os::unix::net::UnixStream;
 
 pub struct AconfigStorageSource {}
 
-use aconfig_storage_file::protos::ProtoStorageFileInfo;
-use aconfig_storage_file::protos::ProtoStorageFiles;
-use aconfig_storage_file::FlagValueAndInfoSummary;
+fn convert(msg: ProtoFlagQueryReturnMessage) -> Result<Flag> {
+    let (value, value_picked_from) = match (
+        msg.local_flag_value,
+        msg.has_local_override,
+        msg.server_flag_value,
+        msg.has_server_override,
+        msg.default_flag_value,
+    ) {
+        (Some(local), Some(has_local), _, _, _) if has_local => {
+            (FlagValue::try_from(local.as_str())?, ValuePickedFrom::Local)
+        }
+        (_, _, Some(server), Some(has_server), _) if has_server => {
+            (FlagValue::try_from(server.as_str())?, ValuePickedFrom::Server)
+        }
+        (_, _, _, _, Some(default)) => {
+            (FlagValue::try_from(default.as_str())?, ValuePickedFrom::Default)
+        }
+        _ => return Err(anyhow!("missing")),
+    };
 
-static STORAGE_INFO_FILE_PATH: &str = "/metadata/aconfig/storage_records.pb";
+    let permission = match msg.is_readwrite {
+        Some(is_readwrite) => {
+            if is_readwrite {
+                FlagPermission::ReadWrite
+            } else {
+                FlagPermission::ReadOnly
+            }
+        }
+        None => return Err(anyhow!("missing permission")),
+    };
 
-fn read_default_values(file_info: ProtoStorageFileInfo) -> Result<HashMap<String, FlagValue>> {
-    let package_map =
-        file_info.package_map.ok_or(anyhow!("storage file is missing package map"))?;
-    let flag_map = file_info.flag_map.ok_or(anyhow!("storage file is missing flag map"))?;
-    let flag_val = file_info.flag_val.ok_or(anyhow!("storage file is missing flag val"))?;
+    Ok(Flag {
+        name: msg.flag_name.unwrap(),
+        package: msg.package_name.unwrap(),
+        value,
+        permission,
+        value_picked_from,
 
-    let mut result = HashMap::new();
-    for listed_flag in aconfig_storage_file::list_flags(&package_map, &flag_map, &flag_val)? {
-        let value = FlagValue::try_from(listed_flag.flag_value.as_str())?;
-        result.insert(listed_flag.package_name + &listed_flag.flag_name, value);
-    }
-    Ok(result)
+        // TODO: remove once DeviceConfig is not in the CLI.
+        namespace: "-".to_string(),
+
+        // TODO: populate these fields once they are available in the list API.
+        container: "-".to_string(),
+        staged_value: None,
+    })
 }
 
-fn read_next_boot_values(
-    listed_flags: &[FlagValueAndInfoSummary],
-) -> Result<HashMap<String, FlagValue>> {
-    let mut result = HashMap::new();
-    for flag in listed_flags {
-        result.insert(
-            flag.package_name.clone() + &flag.flag_name,
-            FlagValue::try_from(flag.flag_value.as_str())?,
-        );
+fn read_from_socket() -> Result<Vec<ProtoFlagQueryReturnMessage>> {
+    let messages = ProtoStorageRequestMessages {
+        msgs: vec![ProtoStorageRequestMessage {
+            msg: Some(ProtoStorageRequestMessageMsg::ListStorageMessage(ProtoListStorageMessage {
+                msg: Some(ProtoListStorageMessageMsg::All(true)),
+                special_fields: SpecialFields::new(),
+            })),
+            special_fields: SpecialFields::new(),
+        }],
+        special_fields: SpecialFields::new(),
+    };
+
+    let mut socket = UnixStream::connect("/dev/socket/aconfigd")?;
+
+    let message_buffer = messages.write_to_bytes()?;
+    let mut message_length_buffer: [u8; 4] = [0; 4];
+    let message_size = &message_buffer.len();
+    message_length_buffer[0] = (message_size >> 24) as u8;
+    message_length_buffer[1] = (message_size >> 16) as u8;
+    message_length_buffer[2] = (message_size >> 8) as u8;
+    message_length_buffer[3] = *message_size as u8;
+    socket.write_all(&message_length_buffer)?;
+    socket.write_all(&message_buffer)?;
+    socket.shutdown(Shutdown::Write)?;
+
+    let mut response_length_buffer: [u8; 4] = [0; 4];
+    socket.read_exact(&mut response_length_buffer)?;
+    let response_length = u32::from_be_bytes(response_length_buffer) as usize;
+    let mut response_buffer = vec![0; response_length];
+    socket.read_exact(&mut response_buffer)?;
+
+    let response: ProtoStorageReturnMessages =
+        protobuf::Message::parse_from_bytes(&response_buffer)?;
+
+    match response.msgs.as_slice() {
+        [ProtoStorageReturnMessage {
+            msg: Some(ProtoStorageReturnMessageMsg::ListStorageMessage(list_storage_message)),
+            ..
+        }] => Ok(list_storage_message.flags.clone()),
+        _ => Err(anyhow!("unexpected response from aconfigd")),
     }
-    Ok(result)
-}
-
-fn reconcile(
-    default_values: HashMap<String, FlagValue>,
-    next_boot_values: HashMap<String, FlagValue>,
-    flags_current_boot: &[FlagValueAndInfoSummary],
-    container: &str,
-) -> Result<Vec<Flag>> {
-    let mut result = Vec::new();
-    for listed_flag in flags_current_boot {
-        let default_value = default_values
-            .get(&(listed_flag.package_name.clone() + &listed_flag.flag_name))
-            .copied();
-
-        let name = listed_flag.flag_name.clone();
-        let package = listed_flag.package_name.clone();
-        let value = FlagValue::try_from(listed_flag.flag_value.as_str())?;
-        let container = container.to_string();
-        let staged_value = next_boot_values
-            .get(&(listed_flag.package_name.clone() + &listed_flag.flag_name))
-            .filter(|&v| value != *v)
-            .copied();
-        let permission = if listed_flag.is_readwrite {
-            FlagPermission::ReadWrite
-        } else {
-            FlagPermission::ReadOnly
-        };
-        let value_picked_from = if listed_flag.has_local_override {
-            ValuePickedFrom::Local
-        } else if Some(value) == default_value {
-            ValuePickedFrom::Default
-        } else {
-            ValuePickedFrom::Server
-        };
-
-        result.push(Flag {
-            name,
-            package,
-            value,
-            container,
-            staged_value,
-            permission,
-            value_picked_from,
-
-            // TODO(b/324436145): delete namespace field once DeviceConfig isn't in CLI.
-            namespace: "-".to_string(),
-        });
-    }
-    Ok(result)
 }
 
 impl FlagSource for AconfigStorageSource {
     fn list_flags() -> Result<Vec<Flag>> {
-        let mut result = Vec::new();
-
-        let mut file = File::open(STORAGE_INFO_FILE_PATH)?;
-        let mut bytes = Vec::new();
-        file.read_to_end(&mut bytes)?;
-        let storage_file_info: ProtoStorageFiles = protobuf::Message::parse_from_bytes(&bytes)?;
-
-        for file_info in storage_file_info.files {
-            let default_values = read_default_values(file_info.clone())?;
-
-            let container =
-                file_info.container.ok_or(anyhow!("storage file is missing container"))?;
-            let package_map = format!("/metadata/aconfig/maps/{container}.package.map");
-            let flag_map = format!("/metadata/aconfig/maps/{container}.flag.map");
-            let flag_info = format!("/metadata/aconfig/boot/{container}.info");
-
-            let flag_val_current_boot = format!("/metadata/aconfig/boot/{container}.val");
-            let flag_val_next_boot = format!("/metadata/aconfig/flags/{container}.val");
-
-            let flags_next_boot = aconfig_storage_file::list_flags_with_info(
-                &package_map,
-                &flag_map,
-                &flag_val_next_boot,
-                &flag_info,
-            )?;
-            let flags_current_boot = aconfig_storage_file::list_flags_with_info(
-                &package_map,
-                &flag_map,
-                &flag_val_current_boot,
-                &flag_info,
-            )?;
-
-            let next_boot_values = read_next_boot_values(&flags_next_boot)?;
-            let processed_flags =
-                reconcile(default_values, next_boot_values, &flags_current_boot, &container)?;
-
-            result.extend(processed_flags);
-        }
-
-        Ok(result)
+        read_from_socket()
+            .map(|query_messages| {
+                query_messages.iter().map(|message| convert(message.clone())).collect::<Vec<_>>()
+            })?
+            .into_iter()
+            .collect()
     }
 
     fn override_flag(_namespace: &str, _qualified_name: &str, _value: &str) -> Result<()> {
diff --git a/tools/aconfig/aflags/src/device_config_source.rs b/tools/aconfig/aflags/src/device_config_source.rs
index cf6ab28..37c9d45 100644
--- a/tools/aconfig/aflags/src/device_config_source.rs
+++ b/tools/aconfig/aflags/src/device_config_source.rs
@@ -128,7 +128,7 @@
     }
 
     fn override_flag(namespace: &str, qualified_name: &str, value: &str) -> Result<()> {
-        read_device_config_output(&["put", namespace, qualified_name, value]).map(|_| ())
+        read_device_config_output(&["override", namespace, qualified_name, value]).map(|_| ())
     }
 }
 
diff --git a/tools/aconfig/aflags/src/main.rs b/tools/aconfig/aflags/src/main.rs
index 0a5c989..d8912a9 100644
--- a/tools/aconfig/aflags/src/main.rs
+++ b/tools/aconfig/aflags/src/main.rs
@@ -289,7 +289,7 @@
     let output = match cli.command {
         Command::List { use_new_storage: true, container } => {
             list(FlagSourceType::AconfigStorage, container)
-                .map_err(|_| anyhow!("storage may not be enabled"))
+                .map_err(|err| anyhow!("storage may not be enabled: {err}"))
                 .map(Some)
         }
         Command::List { use_new_storage: false, container } => {
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