aconfig: update storage read api

Update storage read api to not find storage file location from a pb
file, instead directly read from /metadata copy. Previously for
package.map and flag.map, we are reading from the respective RO
partition. Now we are reading from /metadata/maps dir. This has a few
advantages:

1, early flag availability, since /metadata can be mounted much earlier
than mainline modules, so it would make mainline flags availabile even
before mainline modules are mounted.

2, we no longer need to read from a pb file to find where package.map
and flag.map are. Thus the read api can be further simplified and
downsized. With this change, we are able to shrink the cc flag read api
lib size from 171k to 120k.

Bug: b/321077378
Test atest -c

Change-Id: Ic9086fe4c49c139a4d1c66a8d472023a88c9dd17
This commit is contained in:
Dennis Shen
2024-05-22 13:57:43 +00:00
parent 22135a0b0c
commit 5590478580
13 changed files with 163 additions and 331 deletions

View File

@@ -77,7 +77,6 @@ cc_library_static {
export_include_dirs: ["include"],
static_libs: [
"libaconfig_storage_read_api_cc",
"libaconfig_storage_protos_cc",
"libprotobuf-cpp-lite",
"libbase",
],

View File

@@ -13,7 +13,6 @@ cxx = "1.0"
memmap2 = "0.8.0"
tempfile = "3.9.0"
thiserror = "1.0.56"
protobuf = "3.2.0"
aconfig_storage_file = { path = "../aconfig_storage_file" }
aconfig_storage_read_api = { path = "../aconfig_storage_read_api" }

View File

@@ -1,7 +1,6 @@
#include <android-base/file.h>
#include <android-base/logging.h>
#include <protos/aconfig_storage_metadata.pb.h>
#include <sys/mman.h>
#include <sys/stat.h>
@@ -11,8 +10,6 @@
#include "aconfig_storage/lib.rs.h"
#include "aconfig_storage/aconfig_storage_write_api.hpp"
using storage_records_pb = android::aconfig_storage_metadata::storage_files;
using storage_record_pb = android::aconfig_storage_metadata::storage_file_info;
using namespace android::base;
namespace aconfig_storage {

View File

@@ -25,8 +25,6 @@ cc_test {
],
static_libs: [
"libgmock",
"libaconfig_storage_protos_cc",
"libprotobuf-cpp-lite",
"libaconfig_storage_read_api_cc",
"libaconfig_storage_write_api_cc",
"libbase",

View File

@@ -22,11 +22,9 @@
#include "aconfig_storage/aconfig_storage_read_api.hpp"
#include "aconfig_storage/aconfig_storage_write_api.hpp"
#include <gtest/gtest.h>
#include <protos/aconfig_storage_metadata.pb.h>
#include <android-base/file.h>
#include <android-base/result.h>
using android::aconfig_storage_metadata::storage_files;
using namespace android::base;
namespace api = aconfig_storage;