Commit Graph

5 Commits

Author SHA1 Message Date
Marybeth Fair
13b64308e8 Revert "Add fingerprint to packages.map."
This reverts commit 769d8eed37.

Reason for revert: Caused crashed in places where old version files were present.
(cherry picked from https://android-review.googlesource.com/q/commit:a80e298d34a3cfcaf1f89bc9c808c8b175095c4f)
Merged-In: I7d529773226cd834979400aa018c47bbf6891b72
Change-Id: I7d529773226cd834979400aa018c47bbf6891b72
2024-09-24 00:38:49 +00:00
Marybeth Fair
769d8eed37 Add fingerprint to packages.map.
No guards to this change because we will guard actually writing the
fingerprint, and right now new storage is not in trunkfood yet. This
change modifies the package map file structure. Note that if the new
storage was in trunkfood, this could (theoretically) cause issues if
there were cross-container READ_WRITE flags (not permitted per
documentation) and if the containers were built at separate aconfig
versions (ie before and after this change). Adding the fingerprint will
help prevent such issues in the future. Incremented the storage version
number as I've changed the format.

Again, fingerprint is not actually written in this CL, it always has a
value of 0.

Updated the test files as well to have the new version and the
fingerprint. Since this changed the package node size, some of the
information in the buckets there (offset) has changed as well.

Also added a test util for flags from another package to test future
changes.

Bug: 316357686
Test: atest aconfig.test
Change-Id: I09e10808492f241fe78028d2757f7d63328623c3
2024-09-19 10:17:23 -04:00
Dennis Shen
45c94c6421 aconfig: add a new aconfig storage file flag listing api
added a new function called list_flag_with_info to list all the flags
given all four storage files (package.map, flag.map, flag.val, flag.info).
also exported this api thru cxx interface so aconfigd can use it.

Bug: b/312444587
Test: atest -c
Change-Id: Ibbfe657b980d40e25e5e28962b930338192e2d98
2024-04-30 17:52:44 +00:00
Dennis Shen
61d8c5a799 aconfig: split aconfig_storage_file crate
Current aconfig_storage_file crate contains two things: 1,
aconfig storage file definition (which is used by aconfig crate for
storage file creation) and 2, flag storage file read api. With this
change, we are splitting 2 into its own crate aconfig_storage_read_api

In the long run, there will be 3 crates for aconfig_storage

1, aconfig_storage_file
It contains aconfig storage file definition, as well as a binary to help
print/dump aconfig storage binary files into some readable format.

2, aconfig_storage_read_api
This crate contains flag read apis. This crate depends on
aconfig_storge_file crate. This crate will be used by codegen.

3, aconfig_storage_write_api
This crate contains flag write apis. This crate depends on
aconfig_storage_file crate. This crate will only be used by aconfig
daemon to update flag values.

Bug: b/321077378
Test: atest aconfig_storage_read_api.test; atest
aconfig_storage_file.test; atest aconfig_storage_read_api.test.rust;
atest aconfig_storage_read_api.test.cpp

Change-Id: Ia6afdc40a45c7c59652fbfd123c2b77bf6666dd9
2024-03-04 21:12:43 +00:00
Dennis Shen
19370a0a31 aconfig: create memory map file module
This module is repsonsible for finding the storage file location based on a
pb file and then map these storage files into memory using memmap2
crate. The mapped files are cached in a static hashmap in this module.

Note that memmap2 crate has not been introduced to AOSP yet as a 3p
crate. It is in the process of importing to AOSP ATM. So in src/lib.rs,
we only include this module if we are building the target using cargo.

Also, the test storage files: package.map, flag.map and flag.val are
generated based on the storage test aconfig files in
aconfig/aconfig/tests dir. With aconfig create-cache command first to
produce cache files, and then aconfig create-storage command to create
each storage file.

aconfig create-cache --package com.android.aconfig.storage.test_1 --container system --declarations ./storage_test_1.aconfig --cache com.android.aconfig.storage.test_1.cache

aconfig create-cache --package com.android.aconfig.storage.test_2 --container system --declarations ./storage_test_2.aconfig --cache com.android.aconfig.storage.test_2.cache

aconfig create-cache --package com.android.aconfig.storage.test_4 --container system --declarations ./storage_test_4.aconfig --cache com.android.aconfig.storage.test_4.cache

aconfig create-storage --container system  --cache ./com.android.aconfig.storage.test_1.cache --cache ./com.android.aconfig.storage.test_2.cache --cache ./com.android.aconfig.storage.test_4.cache --file flag_val --out ./flag.value

aconfig create-storage --container system  --cache ./com.android.aconfig.storage.test_1.cache --cache ./com.android.aconfig.storage.test_2.cache --cache ./com.android.aconfig.storage.test_4.cache --file package_map --out ./package.map

aconfig create-storage --container system  --cache ./com.android.aconfig.storage.test_1.cache --cache ./com.android.aconfig.storage.test_2.cache --cache ./com.android.aconfig.storage.test_4.cache --file flag_map --out ./flag.map

Bug: 321077378
Test: atest aconfig_storage_file.test
Change-Id: Id4bd26ce1a2513cdda201b479cec2b8c04faabfe
2024-01-31 13:54:16 +00:00