Keystore 2.0: Revise database.
* Make grants persistent.
* Moved some utility functions to db_utils.rs.
* KeystoreDB::new() now takes a path argument that indicates where the
the database files are to be expected.
* A new test module test::utils.rs introduces TempDir which creates a
new temporary directory that is cleaned up with all of its content
when the TempDir opject is dropped.
Test: keystore2_test
Change-Id: I056c404fd9d592ddc8b531394b1c6cc17a0fd736
diff --git a/keystore2/src/keystore2_main.rs b/keystore2/src/keystore2_main.rs
index ab00794..2916549 100644
--- a/keystore2/src/keystore2_main.rs
+++ b/keystore2/src/keystore2_main.rs
@@ -37,6 +37,9 @@
let mut args = std::env::args();
args.next().expect("That's odd. How is there not even a first argument?");
+
+ // Keystore changes to the database directory on startup (typically /data/misc/keystore).
+ // For the ground truth check the service startup rule for init (typically in keystore2.rc).
if let Some(dir) = args.next() {
if std::env::set_current_dir(dir.clone()).is_err() {
panic!("Failed to set working directory {}.", dir)