aconfig: use proto struct directly

Remove the hand-crafted wrappers around the structures auto-generated
from protos/aconfig.proto, and use the auto-generated structs directly
intead. This gets rid of a lot of manual repetition, and its inherent
risk.

Also unify how individual fields read from text proto are verified (e.g.
is the flag.name field a valid identifier).

Also change the intermediate cache format from JSON to binary protobuf.

The concept of a 'cache' as an intermediate internal format to represent
parsed input stays. The command line interface still refers to caches.
At the moment a cache file is identical to a parsed_file protbuf, and
the code exploits this internally.

A couple of points regarding the auto-generated structs:

  - Vectors are named in the singular (e.g. parsed_flags.parsed_flag is
    a Vec<ProtoParsedFlag>) because this improves ergonomics for all
    devs working with aconfig input files

  - The auto-generated structs have fields that are of type Option<T>
    and convenience methods (named the same as the fields) to access T

Test: atest aconfig.test aconfig.test.java
Bug: 283910447
Change-Id: I512820cc4bc6c543dea9f6a4356f863120a10be3
diff --git a/tools/aconfig/src/test.rs b/tools/aconfig/src/test.rs
index 9d29083..abe9015 100644
--- a/tools/aconfig/src/test.rs
+++ b/tools/aconfig/src/test.rs
@@ -16,29 +16,32 @@
 
 #[cfg(test)]
 pub mod test_utils {
-    use crate::cache::Cache;
-    use crate::commands::{Input, Source};
+    use crate::commands::Input;
+    use crate::protos::ProtoParsedFlags;
     use itertools;
 
-    pub fn create_cache() -> Cache {
-        crate::commands::create_cache(
+    pub const TEST_PACKAGE: &str = "com.android.aconfig.test";
+
+    pub fn parse_test_flags() -> ProtoParsedFlags {
+        let bytes = crate::commands::parse_flags(
             "com.android.aconfig.test",
             vec![Input {
-                source: Source::File("tests/test.aconfig".to_string()),
+                source: "tests/test.aconfig".to_string(),
                 reader: Box::new(include_bytes!("../tests/test.aconfig").as_slice()),
             }],
             vec![
                 Input {
-                    source: Source::File("tests/first.values".to_string()),
+                    source: "tests/first.values".to_string(),
                     reader: Box::new(include_bytes!("../tests/first.values").as_slice()),
                 },
                 Input {
-                    source: Source::File("tests/second.values".to_string()),
+                    source: "tests/second.values".to_string(),
                     reader: Box::new(include_bytes!("../tests/second.values").as_slice()),
                 },
             ],
         )
-        .unwrap()
+        .unwrap();
+        crate::protos::parsed_flags::try_from_binary_proto(&bytes).unwrap()
     }
 
     pub fn first_significant_code_diff(a: &str, b: &str) -> Option<String> {