Skip listing containers that can't be listed
aosp/3390407 checked for existence of boot files before trying to list a container. We also need to check if the default value files are present. Catch any error when listing a container and log its failure reason.
Bug: 383287071
Change-Id: I2de6a5cd247a246f8b10ec683123c80ff3c1f9e0
Test: m
diff --git a/aconfigd/src/storage_files.rs b/aconfigd/src/storage_files.rs
index 844ad44..773cc69 100644
--- a/aconfigd/src/storage_files.rs
+++ b/aconfigd/src/storage_files.rs
@@ -180,10 +180,6 @@
Ok(files)
}
- pub(crate) fn has_boot_copy(&self) -> bool {
- self.storage_record.boot_flag_val.exists() && self.storage_record.boot_flag_info.exists()
- }
-
/// Constructor from a pb record
pub(crate) fn from_pb(
pb: &ProtoPersistStorageRecord,
diff --git a/aconfigd/src/storage_files_manager.rs b/aconfigd/src/storage_files_manager.rs
index d5aff16..46f2c8c 100644
--- a/aconfigd/src/storage_files_manager.rs
+++ b/aconfigd/src/storage_files_manager.rs
@@ -420,10 +420,17 @@
pub(crate) fn list_all_flags(&mut self) -> Result<Vec<FlagSnapshot>, AconfigdError> {
let mut flags = Vec::new();
for storage_files in self.all_storage_files.values_mut() {
- if !storage_files.has_boot_copy() {
- continue;
+ match storage_files.list_all_flags() {
+ Ok(f) => {
+ flags.extend(f);
+ }
+ Err(errmsg) => {
+ debug!(
+ "failed to list all flags for {}: {:?}",
+ storage_files.storage_record.container, errmsg
+ );
+ }
}
- flags.extend(storage_files.list_all_flags()?);
}
Ok(flags)
}