Implement and integrate the verification token handler.
This CL implements a background task handler which for now, runs
a thread to retrieve verification tokens. This CL also integrates
this handler with the enforcement module, in order to allow operations
to receive verification tokens.
Bug: 171503362, 171503128
Test: TBD
Change-Id: I2ed0742043095dafb3b5cb7581ca3a2a70929ecc
diff --git a/keystore2/src/globals.rs b/keystore2/src/globals.rs
index 075a801..035dac1 100644
--- a/keystore2/src/globals.rs
+++ b/keystore2/src/globals.rs
@@ -17,6 +17,7 @@
//! to talk to.
use crate::async_task::AsyncTask;
+use crate::background_task_handler::BackgroundTaskHandler;
use crate::enforcements::Enforcements;
use crate::gc::Gc;
use crate::super_key::SuperKeyManager;
@@ -86,6 +87,10 @@
/// It is safe for this enforcements object to be called by multiple threads because the two
/// data structures which maintain its state are protected by mutexes.
pub static ref ENFORCEMENTS: Enforcements = Enforcements::new();
+ /// Background task handler is initialized and exists globally.
+ /// The other modules (e.g. enforcements) communicate with it via a channel initialized during
+ /// keystore startup.
+ pub static ref BACKGROUND_TASK_HANDLER: BackgroundTaskHandler = BackgroundTaskHandler::new();
}
static KEYMINT_SERVICE_NAME: &str = "android.hardware.security.keymint.IKeyMintDevice";