Include various database PRAGMA values in dump
Sample output on Cuttlefish:
Database configuration:
auto_vacuum = 1
journal_mode = delete
journal_size_limit = 1048576
synchronous = 2
schema_version = 15
user_version = 0
Test: dumpsys android.security.maintenance
Change-Id: Iad4698d754728c5f30955ad503f446958cbdeec4
diff --git a/keystore2/src/database.rs b/keystore2/src/database.rs
index 9f27b5a..66b123e 100644
--- a/keystore2/src/database.rs
+++ b/keystore2/src/database.rs
@@ -3049,4 +3049,11 @@
let app_uids_vec: Vec<i64> = app_uids_affected_by_sid.into_iter().collect();
Ok(app_uids_vec)
}
+
+ /// Retrieve a database PRAGMA config value.
+ pub fn pragma<T: FromSql>(&mut self, name: &str) -> Result<T> {
+ self.conn
+ .query_row(&format!("PRAGMA persistent.{name}"), (), |row| row.get(0))
+ .context(format!("failed to read pragma {name}"))
+ }
}