aconfig: improve flag value tracing

Improve how the flag values (state, permission) are tracked when parsing
config and override files: migrate from a raw string to a proper struct,
as this will make it easier when aconfig will output this data in some
structured format for other tools to consume.

Also, rename Cache.debug to Cache.trace.

Bug: 279485059
Test: atest aconfig.test
Change-Id: Idad57c969515f697e9065429d8a44c38d8a512d2
diff --git a/tools/aconfig/src/cache.rs b/tools/aconfig/src/cache.rs
index 20c5de5..94443d7 100644
--- a/tools/aconfig/src/cache.rs
+++ b/tools/aconfig/src/cache.rs
@@ -22,12 +22,19 @@
 use crate::commands::Source;
 
 #[derive(Serialize, Deserialize, Debug)]
+pub struct TracePoint {
+    pub source: Source,
+    pub state: FlagState,
+    pub permission: Permission,
+}
+
+#[derive(Serialize, Deserialize, Debug)]
 pub struct Item {
     pub id: String,
     pub description: String,
     pub state: FlagState,
     pub permission: Permission,
-    pub debug: Vec<String>,
+    pub trace: Vec<TracePoint>,
 }
 
 #[derive(Serialize, Deserialize, Debug)]
@@ -63,7 +70,7 @@
             description: flag.description,
             state,
             permission,
-            debug: vec![format!("{}:{:?} {:?}", source, state, permission)],
+            trace: vec![TracePoint { source, state, permission }],
         });
         Ok(())
     }
@@ -74,9 +81,11 @@
         };
         existing_item.state = override_.state;
         existing_item.permission = override_.permission;
-        existing_item
-            .debug
-            .push(format!("{}:{:?} {:?}", source, override_.state, override_.permission));
+        existing_item.trace.push(TracePoint {
+            source,
+            state: override_.state,
+            permission: override_.permission,
+        });
         Ok(())
     }