aconfig: add flag type in flag table and remove info byte from value
array
1, add flag type to the flag table. Before flag table only stores the
mapping from (package id, flag name) to (flag id u32). The original
intent is to do bitmasking on the top byte of flag id to indicate flag
type. Now split the flag id u32 to two u16, the first represent flag
type, the second represent flag id. So after the change, the flag table
now shows the following mapping:
(package id, flag name) -> (flag type as u16, flag id as u16)
2, originally we plan to store a info byte together with each flag
value. The info byte is used by storage service damemon to mark up the
flag status, such as if it is accepting server side flag push. After
internal discussion, it is better to just create the info bytes as
another file by storage service damemon. So that the value file is
purely a flag value array.
Bug: b/312243587
test: atest aconfig.test
Change-Id: I7f953076b4269cf786bc23723078290e5ebe10bc
diff --git a/tools/aconfig/src/storage/package_table.rs b/tools/aconfig/src/storage/package_table.rs
index 1a3bbc3..0ce1349 100644
--- a/tools/aconfig/src/storage/package_table.rs
+++ b/tools/aconfig/src/storage/package_table.rs
@@ -57,6 +57,8 @@
pub struct PackageTableNode {
pub package_name: String,
pub package_id: u32,
+ // offset of the first boolean flag in this flag package with respect to the start of
+ // boolean flag value array in the flag value file
pub boolean_offset: u32,
pub next_offset: Option<u32>,
pub bucket_index: u32,
@@ -249,7 +251,7 @@
let first_node_expected = PackageTableNode {
package_name: String::from("com.android.aconfig.storage.test_2"),
package_id: 1,
- boolean_offset: 6,
+ boolean_offset: 3,
next_offset: None,
bucket_index: 0,
};
@@ -265,7 +267,7 @@
let third_node_expected = PackageTableNode {
package_name: String::from("com.android.aconfig.storage.test_4"),
package_id: 2,
- boolean_offset: 12,
+ boolean_offset: 6,
next_offset: None,
bucket_index: 3,
};