aconfig: include namespace in create-device-config-defaults

Update the output format of create-device-config-defaults to include the
flag's namespace. Also change the delimiters. The new format is

  <namespace>:<package>.<flag-name>=[enabled|disabled|

Bug: 285468565
Test: atest aconfig.test
Change-Id: I9b4ca1611cca8528dc341fc12812b614c86f6c08
This commit is contained in:
Mårten Kongstad
2023-06-08 11:22:44 +02:00
parent b025507857
commit 202102f7be

View File

@@ -106,7 +106,8 @@ pub fn create_device_config_defaults(caches: Vec<Cache>) -> Result<Vec<u8>> {
for item in sort_and_iter_items(caches).filter(|item| item.permission == Permission::ReadWrite)
{
let line = format!(
"{}/{}:{}\n",
"{}:{}.{}={}\n",
item.namespace,
item.package,
item.name,
match item.state {
@@ -248,7 +249,7 @@ mod tests {
let caches = vec![crate::test::create_cache()];
let bytes = create_device_config_defaults(caches).unwrap();
let text = std::str::from_utf8(&bytes).unwrap();
assert_eq!("com.android.aconfig.test/disabled_rw:disabled\ncom.android.aconfig.test/enabled_rw:enabled\n", text);
assert_eq!("aconfig_test:com.android.aconfig.test.disabled_rw=disabled\naconfig_test:com.android.aconfig.test.enabled_rw=enabled\n", text);
}
#[test]