aconfig: separate flag declarations and flag values

Simplify how aconfig configurations work: remove the ability to set flag
values based on build-id.

The aconfig files now some in two flavours:

  - flag declaration files: introduce new flags; aconfig will assign the
    flags a hard-coded default value (disabled, read-write)

  - flag value files: assign flags new values

`aconfig create-cache` expects flags to be declared exactly once, and
for their values to be reassigned zero or more times.

The flag value files are identical what used to be called override
files.

Also, remove the now obsolete build-id parameter: this was used to
calculate default values before applying overrides, and is no longer
needed.

Also rename a few more structs and functions to be closer to the .proto
names. This will make it easier to use the generated proto structs
directly, and get rid of the hand-crafter wrappers.

Bug: 279485059
Test: atest aconfig.test
Change-Id: I7bf881338b0567f932099ce419cac457abbe8df8
This commit is contained in:
Mårten Kongstad
2023-05-11 14:47:02 +02:00
parent 7b6aacb055
commit fa23d2993b
7 changed files with 171 additions and 330 deletions

View File

@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License
// This is the schema definition for of Aconfig files. Modifications need to be
// either backwards compatible, or include updates to all Aconfig files in the
// This is the schema definition for aconfig files. Modifications need to be
// either backwards compatible, or include updates to all aconfig files in the
// Android tree.
syntax = "proto2";
@@ -32,40 +32,33 @@ enum flag_permission {
READ_WRITE = 2;
}
// aconfig input messages: configuration and override data
// aconfig input messages: flag declarations and values
message flag_value {
required flag_state state = 1;
required flag_permission permission = 2;
optional uint32 since = 3;
}
message flag_definition {
message flag_declaration {
required string name = 1;
required string description = 2;
repeated flag_value value = 3;
};
message namespace {
message flag_declarations {
required string namespace = 1;
repeated flag_definition flag = 2;
repeated flag_declaration flag = 2;
};
message flag_override {
message flag_value {
required string namespace = 1;
required string name = 2;
required flag_state state = 3;
required flag_permission permission = 4;
};
message flag_overrides {
repeated flag_override flag_override = 1;
message flag_values {
repeated flag_value flag_value = 1;
};
// aconfig output messages: parsed and verified configuration and override data
// aconfig output messages: parsed and verified flag declarations and values
message tracepoint {
// path to config or override file releative to $TOP
// path to declaration or value file relative to $TOP
required string source = 1;
required flag_state state = 2;
required flag_permission permission = 3;