With this update, cold flag read (first flag in a namespace) is now 6x
faster compared to device config.
Bug: b/321077378
Test: atest -c
Change-Id: I52ffd897fdd487b2a44d07be50f2975f0ef5b9b3
1, See AconfigStorageReadAPI.java to see java APIs to map storage files
and read flag values. It is using fast native annotation, in theory it
should be faster than regular JNI without much of the overhead.
2, The java api calls into Rust wrapper in srcs/lib.rs, note that
MappedByteBuffer is not copied during JNI. In the rust side
implementation we get the underlying raw pointer and buffer size and
reconstruct a rust slice. However, at current implmentation, the string
input such as package name and flag name are most likely copied. They
are converted from JStirng to JavaStr first without copy, then the
into() call to convert it to Rust string. We could potentially optimize
it to without copy.
3, Add an android_test target to lock down the API behaviors.
Bug: b/321077378
Test: atest -c
Change-Id: I8915fe70e8eb341be563c70f85e19e644e8aa6be
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
Framework already has nano protos, and reusing them won't
introduce extra dependencies for the apps
This is setting up the resources flagging in the framework
Bug: 297373084
Test: Built with related changes
Change-Id: I518bd56f56c42e0adef0002e95f8948e0904fb43
aconfig_device_paths uses `include_str!` to include a text file
containing comma-separated strings with each partition aconfig file.
The lib does not handle the escaped newlines and quotation marks.
Adds proper handling.
Test: cargo t && m -j120 && acloud create --local-image && adb shell aflags list
Bug: 340514768
Change-Id: I75214bf02dd962d8291f1654ade8cbce1cda9fde
If the Display interface is implemented the compiler will automatically
derive an implementation of ToString.
Test: m aflags
Bug: 333887339
Change-Id: I861a3065edbef0da1684a6ea28cc374acd0d774a
Return a pointer of MappedStorageFile/MutableMappedStorageFile instead
of an object of MappedStorageFile/MutableMappedStorageFile. Now added
destructor for MappedStorageFile/MutableMappedStorageFile to unmap the
in memory file to free up memory.
Bug: b/321077378
Test: atest -c
Change-Id: Iaa02696feb07ff383f0c7e46b645d82e57c38254
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
Read from the new aconfig storage backing in C++ aconfig codegen, for
READ_ONLY flags. Log if there is a match with the legacy storage, or a
mismatch, or a failure.
Only enabled if instrumentation is enabled, which will be enabled by a
build flag in a follow-up CL.
Test: m && cargo t
Bug: 328444881
Change-Id: I691dfad8860d8f917e93c5d56dac19f8791de943
Restrict the set of exported symbols to those in the aconfig_storage
namespace by way of a version script. This shrinks the shared lib size
by ~75%, from ~800KB to <200KB.
Bug: 336657207
Test: m
Change-Id: I56044fe667a713cf1d94f96c992f379a5725850f
Simplify storage write api so that we don't need the storage records pb
file.
Bug: b/312444587
Test: atest -c
Change-Id: I7e336b1d7766983364715dae15786b91b0c0743f
No need for cache filtering based on container anymore. This is now
performed by build system automatically. The caches feed into storage
generation command are automatically filtered based on owning
container.
Bug: b/312444587
Test: atest aconfig.test
Change-Id: I44f3ac03d50b77a191a82ff7ed4d02766012492d
previously we store three bits per flag: is sticky, is read write, has
override. so when a local override arrives, is sticky bit as well has
override bit are set to true. this becomes problematic when the local
override is removed. we are not sure if we should remove has override
bit as well (server override could still be in place).
therefore restructuring the flag info for each flag into new three bits:
is read write, has server override and has local override. so now server
override and local override bits are independent from each other.
Bug: b/312444587
Test: atest -c
Change-Id: I03b2bb7312480773236c95f2b39f2589fee41924
Create one library for reading protos from all containers, instead of
having numerous libraries perform the same logic. For Java, we will
create a similar library reusing the same
partition_aconfig_flags_paths.txt.
Bug: 324436145
Test: adb shell aflags list # Confirm that various containers appear
Change-Id: I924e281a50f9a609e1c07c03267eebe3dce52752
1, add a new field in storage metadata proto, for each container, there
is a local override file.
2, update write api to expose the api to map a writable file given the
specific path. the cannonical api will require a storage metadata proto,
and then find the right file path and map it.
3, minor update to make the proto lib cc_library instead of
cc_library_static
Bug: b/312444587
Test: atest -c
Change-Id: Iaf0aff44c1ca3ad4bffc5e06bb99bb276b9069c5
Currently flag info query api is called get_boolean_flag_attribute, in
this change, we switched it over to a flag value type generic
implementation get_flag_attribute. So in the future we want to add more flag value types, this api can stay the same.
Bug: b/312444587
Test: atest -c
Change-Id: I2b272f3fa3cb1d0edc8b77a44bf37752ffe95925