diff --git a/tools/aconfig/aconfig_storage_file/Android.bp b/tools/aconfig/aconfig_storage_file/Android.bp index b590312961..d60ba924e5 100644 --- a/tools/aconfig/aconfig_storage_file/Android.bp +++ b/tools/aconfig/aconfig_storage_file/Android.bp @@ -56,7 +56,7 @@ rust_protobuf { min_sdk_version: "29", } -cc_library_static { +cc_library { name: "libaconfig_storage_protos_cc", proto: { export_proto_headers: true, 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 e1c1c7ffca..7de43ca918 100644 --- a/tools/aconfig/aconfig_storage_file/protos/aconfig_storage_metadata.proto +++ b/tools/aconfig/aconfig_storage_file/protos/aconfig_storage_metadata.proto @@ -27,7 +27,8 @@ message storage_file_info { optional string flag_map = 4; optional string flag_val = 5; optional string flag_info = 6; - optional int64 timestamp = 7; + optional string local_overrides = 7; + optional int64 timestamp = 8; } message storage_files { 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 01785e12c3..d57ca64a37 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 @@ -66,8 +66,31 @@ static Result find_storage_file( return Error() << "Unable to find storage files for container " << container; } + +namespace private_internal_api { + +/// Get mutable mapped file implementation. +Result get_mutable_mapped_file_impl( + std::string const& pb_file, + std::string const& container, + StorageFileType file_type) { + if (file_type != StorageFileType::flag_val && + file_type != StorageFileType::flag_info) { + return Error() << "Cannot create mutable mapped file for this file type"; + } + + auto file_result = find_storage_file(pb_file, container, file_type); + if (!file_result.ok()) { + return Error() << file_result.error(); + } + + return map_mutable_storage_file(*file_result); +} + +} // namespace private internal api + /// Map a storage file -static Result map_storage_file(std::string const& file) { +Result map_mutable_storage_file(std::string const& file) { struct stat file_stat; if (stat(file.c_str(), &file_stat) < 0) { return ErrnoError() << "stat failed"; @@ -97,28 +120,6 @@ static Result map_storage_file(std::string const& file return mapped_file; } -namespace private_internal_api { - -/// Get mutable mapped file implementation. -Result get_mutable_mapped_file_impl( - std::string const& pb_file, - std::string const& container, - StorageFileType file_type) { - if (file_type != StorageFileType::flag_val && - file_type != StorageFileType::flag_info) { - return Error() << "Cannot create mutable mapped file for this file type"; - } - - auto file_result = find_storage_file(pb_file, container, file_type); - if (!file_result.ok()) { - return Error() << file_result.error(); - } - - return map_storage_file(*file_result); -} - -} // namespace private internal api - /// Get mutable mapped file Result get_mutable_mapped_file( std::string const& container, 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 8699b88614..e9e4ebb3c2 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 @@ -26,6 +26,10 @@ Result get_mutable_mapped_file_impl( } // namespace private_internal_api +/// Map a storage file +Result map_mutable_storage_file( + std::string const& file); + /// Get mapped writeable storage file Result get_mutable_mapped_file( std::string const& container,