This change modifes the dependencies of fake_device_config by setting
the sdk_version to none instead of core_current, and setting the
appropriate system_modules in order to resolve circular dependencies.
Test: m fake_device_config && BUILD_FROM_SOURCE_STUB m fake_device_config
Change-Id: I497e2db9ea3456057a1e3f5c624cbd2042da6837
Contenxt: b/324826914, libcxx is the culprit of the linking failure.
Remove libcxx dependency for now.
Bug: b/324826914
Test: atest aconfig_storage_file.test
Change-Id: I55b1a41efbf4486715f465a8d56a4e2e6ab0254a
A more systematic fix. Now for each test point, we create temp file
copies at temp dir and explicitly set the file permission of these temp
files. This should bypass the issue that test build artifact file
permission are not guaranteed. Because we will generate these test
storage files on the fly at run time.
Bug: b/324459233
Test: atest aconfig_storage_file.test
Change-Id: Iaa7083be6cc49421090ab4c74e54c4bcf8e35801
Using cxx to generate c++ code for the apis that are marked to exported
in the ffi mod in src/lib.rs. For generated code simplicity, it returns
a new flag struct for each rust api.
Create a cc_library to wrap around generated c++ code. See the created
aconfig_storage.hpp for the exported header. Note there is a nested
aconfig_storage::test_only_api namespace, where we place test only apis.
The production apis are placed under aconfig_storage namespace.
Bug: 321077378
Test: m libaconfig_storage_cc
Change-Id: I73a85a26d3749908abc461362f5e0bfc3f85bf4d
1, update android build soong targets as now libmemmap2 has been
introduced to android code base.
2, add three public apis for package offset query, flag offset query,
and flag value query. These apis assume the stoarge location pb file is
at /metadata/aconfig/aconfig_storage.pb. This file will be created by
storage daemon. For testing purposes, we also expose impl version of
these apis that accept a custom storage location pb file.
Bug: 321077378
Test: atest aconfig_storage_file.test
Change-Id: I91b284e2dfcdb8ff3674d463ed1c13696d9ae020
The tests added to TEST_MAPPING in aosp/2870454 have now soaked in
postsubmit long enough to be allowed to advance to presubmit.
Bug: N/A
Test: atest --test-mapping $(gettop)/build/tools/aconfig
Test: Treehugger
Change-Id: Ia75c76ae114c16a57c26aafa159560639baea707
This change adds docs in aconfig.proto file and adds more detail in the
error message for bad package, name and namespace.
Bug: 318759389
Test: atest aconfig.test
Change-Id: I0d45495cd864506b2fcc06ad47e3ffbd6caca9fb
Minor change to mapped_file module, create utility function to verify
file is readonly and map. Also, update the unit test to create temp pb
file instead of writing to the test dir.
Bug: 321077378
Test: atest aconfig_storage_file.test
Change-Id: Id903ed458613e4aac8d2cbb1664fd8293de1a494
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
bucket index currently is a field in PackageTableNode/FlagTableNode, but this is
purely aux info that is never searilized or deserialized. Therefore we
should remove it from the struct definition. Instead aconfig should
define a wrapper struct that wraps around an instance PackageTableNode/FlagTableNode
as well as aux info like bucket_index.
Bug: 321077378
Test: atest aconfig.test && atest aconfig_storage_file.test
Change-Id: I20f2565d20b7feb5d39754e91cd6a9affb1f0e70
Fix the following warning:
warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2021 which implies `resolver = "2"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions
Further info: https://doc.rust-lang.org/edition-guide/rust-2021/default-cargo-resolver.html
Bug: N/A
Test: cargo c # no warnings related to the resolver
Change-Id: I5ee546e4f2ba9e854026bf4baee380e89cf4a01b
Introduce a new proto to capture storage file location for each
container. This proto file will appeara as
/metadata/aconfig/storage_file_location.pb. Storage service daemon is
responsible for writing entires to it when a new storage file set is
available. The flag read lib will use this file to find the
corresponding storage file and mmap them.
Bug: b/321077378
Test: atest aconfig_storage_file.test
Change-Id: I226e76be895805dce52a075050dcd5b42d337be8
This change adds isOptimizationEnabled method in FakeFeatureFlagsImpl.
This method can help test to decide whether the code using flag is
optimized.
Bug: 309406391
Test: atest aconfig.test aconfig.test.java
Change-Id: I7e7109ac06ab44f9b8dee56c76be9479f60a9148
Move aconfig storage file definition into its own crate, as flag read
lib will need it as well. The new crate is placed under
aconfig_storage_file dir.
Bug: b/321077378
Test: atest aconfig.test, Cargo test at repo root level
Change-Id: I91e8ada2c9bab479ed81cf03824042f3fa460be5
Previously, aconfig repo is the root directory of aconfig binary crate,
but it also hosts printflags crate inside, and there is no cargo support
for printflags binary crate. In addition, with more aconfig development,
more crates are being added to this repo. Thus this repo should be
configured as a Cargo workspace with multiple crates rather than a
single crate.
Note the top level Cargo.toml file specifies the crates this workspace
carries:
(1) aconfig_protos: the proto library crate that will be used by many other
crates such as aconfig binary crate and printflags binary crate
(2) aconfig: the aconfig binary crate
(3) printflags: the printflags binary crate
(1) aconfig_protos crate setup:
Inside aconfig_protos dir we set up the aconfig_protos crate, the
previously src/proto.rs is now aconfig_protos/src/lib.rs, the build.rs
is carried over to this crate.
(2) aconfig binary crate setup:
Notice its Cargo.toml file claims package dependency on aconfig_protos
crate. It no longer carries proto related module and build.rs file.
(3) printflags binary crate setup:
Similary, notice that in its Cargo.toml file, it claims package
dependency on aconfig_protos crate.
With this setup, we can Cargo build/test each crate individually when
inside a specific crate dir. But we can also run Cargo build/test at
repo root level, which will build/test all the crates in this workplace.
This is the structuring cl. The next cl is to move storage modules into
its own library crate. This storage file library crate will be used by
both aconfig binary crate as well as flag read library crate (to be
created as another new crate here).
Bug: b/321984352
Test: top and individual crate dir level Cargo build/test, m each
individual targets
Change-Id: I75833f4997f7ee554ff6c1557df9ac87f62b2732
Merged-In: I75833f4997f7ee554ff6c1557df9ac87f62b2732
Based on the build system feedback, it is better to create storage file
individually per each aconfig command invocation in a makefile. Thus
updating the create-storage command to create one file at a time based
on passed in file selection.
Bug: b/321243743
Test: atest aconfig.test and manually invoke create-storage command
Change-Id: I53625c08e44d3ece4476835827c6b7d28ddd5a1b
Create flag_value module to create flag value file. Flag value file
contains a header section at the start of the file, followed by a
boolean array.
Bug: b/312243587
Test: atest aconfig.test
Change-Id: If76660189d63073fbd477e1e447240e0cd029604
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
str::split always returns at least one item (the entire string) if the
delimiter is not found. Simplify the implementation of
is_valid_container accordingly.
Bug: N/A
Test: atest aconfig.test
Change-Id: I3e92035309a7b019912710e42e69f9bdfa538795