aconfig: add dump protobuf format

Introduce a new protobuf format to represent the all flags parsed by
aconfig. This data in this new format is similar to that of the internal
cache object, but the protobuf is a public API for other tools to
consume and any changes to the proto spec must be backwards compatible.

When aconfig has matured more, Cache can potentially be rewritten to
work with proto structs directly, removing some of the hand-written
wrapper structs and the logic to convert to and from the proto structs.
At this point, the intermediate json format can be replaced by the
protobuf dump.

Also, teach `aconfig dump` to accept an --out <file> argument (default:
stdout).

Also, teach `aconfig dump` to read more than once cache file.

Note: the new protobuf fields refer to existing fields. It would make
sense to split the .proto file in one for input and one for output
formats, and import the common messages, but the Android build system
and cargo will need different import paths. Keep the definitions in the
same file to circumvent this problem.

Bug: 279485059
Test: atest aconfig.test
Change-Id: I55ee4a52c0fb3369d91d61406867ae03a15805c3
diff --git a/tools/aconfig/src/protos.rs b/tools/aconfig/src/protos.rs
index 604eca4..f18a91d 100644
--- a/tools/aconfig/src/protos.rs
+++ b/tools/aconfig/src/protos.rs
@@ -48,6 +48,15 @@
 #[cfg(not(feature = "cargo"))]
 pub use aconfig_protos::aconfig::Flag_state as ProtoFlagState;
 
+#[cfg(not(feature = "cargo"))]
+pub use aconfig_protos::aconfig::Dump as ProtoDump;
+
+#[cfg(not(feature = "cargo"))]
+pub use aconfig_protos::aconfig::Dump_item as ProtoDumpItem;
+
+#[cfg(not(feature = "cargo"))]
+pub use aconfig_protos::aconfig::Dump_trace as ProtoDumpTracePoint;
+
 // ---- When building with cargo ----
 #[cfg(feature = "cargo")]
 include!(concat!(env!("OUT_DIR"), "/aconfig_proto/mod.rs"));
@@ -73,6 +82,15 @@
 #[cfg(feature = "cargo")]
 pub use aconfig::Flag_state as ProtoFlagState;
 
+#[cfg(feature = "cargo")]
+pub use aconfig::Dump as ProtoDump;
+
+#[cfg(feature = "cargo")]
+pub use aconfig::Dump_item as ProtoDumpItem;
+
+#[cfg(feature = "cargo")]
+pub use aconfig::Dump_trace as ProtoDumpTracePoint;
+
 // ---- Common for both the Android tool-chain and cargo ----
 use anyhow::Result;