aconfig: improve the 'text' dump format
Standardize the flag values as '<permission> + <state>', e.g.
'READ_ONLY + ENABLED'.
Bug: 283910447
Test: atest aconfig.test
Test: printflags # manually inspect output
Change-Id: I60f74196816327613bd8165a688f8b36da5bdac7
diff --git a/tools/aconfig/src/commands.rs b/tools/aconfig/src/commands.rs
index 2e2aa0f..5ca53a7 100644
--- a/tools/aconfig/src/commands.rs
+++ b/tools/aconfig/src/commands.rs
@@ -228,11 +228,11 @@
DumpFormat::Text => {
for parsed_flag in parsed_flags.parsed_flag.into_iter() {
let line = format!(
- "{}/{}: {:?} {:?}\n",
+ "{}/{}: {:?} + {:?}\n",
parsed_flag.package(),
parsed_flag.name(),
- parsed_flag.state(),
- parsed_flag.permission()
+ parsed_flag.permission(),
+ parsed_flag.state()
);
output.extend_from_slice(line.as_bytes());
}
@@ -319,7 +319,7 @@
let input = parse_test_flags_as_input();
let bytes = dump_parsed_flags(vec![input], DumpFormat::Text).unwrap();
let text = std::str::from_utf8(&bytes).unwrap();
- assert!(text.contains("com.android.aconfig.test/disabled_ro: DISABLED READ_ONLY"));
+ assert!(text.contains("com.android.aconfig.test/disabled_ro: READ_ONLY + DISABLED"));
}
#[test]