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
diff --git a/tools/aconfig/src/codegen_java.rs b/tools/aconfig/src/codegen_java.rs
index 9d52cce..08b762a 100644
--- a/tools/aconfig/src/codegen_java.rs
+++ b/tools/aconfig/src/codegen_java.rs
@@ -87,30 +87,39 @@
 #[cfg(test)]
 mod tests {
     use super::*;
-    use crate::aconfig::{Flag, Value};
+    use crate::aconfig::{FlagDeclaration, FlagValue};
     use crate::commands::Source;
 
     #[test]
     fn test_generate_java_code() {
         let namespace = "TeSTFlaG";
-        let mut cache = Cache::new(1, namespace.to_string());
+        let mut cache = Cache::new(namespace.to_string());
         cache
-            .add_flag(
+            .add_flag_declaration(
                 Source::File("test.txt".to_string()),
-                Flag {
+                FlagDeclaration {
                     name: "test".to_string(),
                     description: "buildtime enable".to_string(),
-                    values: vec![Value::default(FlagState::Enabled, Permission::ReadOnly)],
                 },
             )
             .unwrap();
         cache
-            .add_flag(
+            .add_flag_declaration(
                 Source::File("test2.txt".to_string()),
-                Flag {
+                FlagDeclaration {
                     name: "test2".to_string(),
                     description: "runtime disable".to_string(),
-                    values: vec![Value::default(FlagState::Disabled, Permission::ReadWrite)],
+                },
+            )
+            .unwrap();
+        cache
+            .add_flag_value(
+                Source::Memory,
+                FlagValue {
+                    namespace: namespace.to_string(),
+                    name: "test".to_string(),
+                    state: FlagState::Disabled,
+                    permission: Permission::ReadOnly,
                 },
             )
             .unwrap();
@@ -121,7 +130,7 @@
         public final class Testflag {
 
             public static boolean test() {
-                return true;
+                return false;
             }
 
             public static boolean test2() {