Add/use watchdog with standard timeout
Almost all uses of the watchdog use the same 500ms timeout, so add a new
method that assumes that.
Test: CtsKeystoreTestCases
Change-Id: Idf7852400a58ba954e4a71e5e2282734a0960072
diff --git a/keystore2/src/operation.rs b/keystore2/src/operation.rs
index 11eaf17..290bc74 100644
--- a/keystore2/src/operation.rs
+++ b/keystore2/src/operation.rs
@@ -286,7 +286,7 @@
}
*locked_outcome = Outcome::Pruned;
- let _wp = wd::watch_millis("In Operation::prune: calling abort()", 500);
+ let _wp = wd::watch("In Operation::prune: calling abort()");
// We abort the operation. If there was an error we log it but ignore it.
if let Err(e) = map_km_error(self.km_op.abort()) {
@@ -362,7 +362,7 @@
.context(ks_err!("Trying to get auth tokens."))?;
self.update_outcome(&mut outcome, {
- let _wp = wd::watch_millis("Operation::update_aad: calling updateAad", 500);
+ let _wp = wd::watch("Operation::update_aad: calling updateAad");
map_km_error(self.km_op.updateAad(aad_input, hat.as_ref(), tst.as_ref()))
})
.context(ks_err!("Update failed."))?;
@@ -386,7 +386,7 @@
let output = self
.update_outcome(&mut outcome, {
- let _wp = wd::watch_millis("Operation::update: calling update", 500);
+ let _wp = wd::watch("Operation::update: calling update");
map_km_error(self.km_op.update(input, hat.as_ref(), tst.as_ref()))
})
.context(ks_err!("Update failed."))?;
@@ -416,7 +416,7 @@
let output = self
.update_outcome(&mut outcome, {
- let _wp = wd::watch_millis("Operation::finish: calling finish", 500);
+ let _wp = wd::watch("Operation::finish: calling finish");
map_km_error(self.km_op.finish(
input,
signature,
@@ -447,7 +447,7 @@
*locked_outcome = outcome;
{
- let _wp = wd::watch_millis("Operation::abort: calling abort", 500);
+ let _wp = wd::watch("Operation::abort: calling abort");
map_km_error(self.km_op.abort()).context(ks_err!("KeyMint::abort failed."))
}
}
@@ -821,7 +821,7 @@
impl IKeystoreOperation for KeystoreOperation {
fn updateAad(&self, aad_input: &[u8]) -> binder::Result<()> {
- let _wp = wd::watch_millis("IKeystoreOperation::updateAad", 500);
+ let _wp = wd::watch("IKeystoreOperation::updateAad");
map_or_log_err(
self.with_locked_operation(
|op| op.update_aad(aad_input).context(ks_err!("KeystoreOperation::updateAad")),
@@ -832,7 +832,7 @@
}
fn update(&self, input: &[u8]) -> binder::Result<Option<Vec<u8>>> {
- let _wp = wd::watch_millis("IKeystoreOperation::update", 500);
+ let _wp = wd::watch("IKeystoreOperation::update");
map_or_log_err(
self.with_locked_operation(
|op| op.update(input).context(ks_err!("KeystoreOperation::update")),
@@ -846,7 +846,7 @@
input: Option<&[u8]>,
signature: Option<&[u8]>,
) -> binder::Result<Option<Vec<u8>>> {
- let _wp = wd::watch_millis("IKeystoreOperation::finish", 500);
+ let _wp = wd::watch("IKeystoreOperation::finish");
map_or_log_err(
self.with_locked_operation(
|op| op.finish(input, signature).context(ks_err!("KeystoreOperation::finish")),
@@ -857,7 +857,7 @@
}
fn abort(&self) -> binder::Result<()> {
- let _wp = wd::watch_millis("IKeystoreOperation::abort", 500);
+ let _wp = wd::watch("IKeystoreOperation::abort");
map_err_with(
self.with_locked_operation(
|op| op.abort(Outcome::Abort).context(ks_err!("KeystoreOperation::abort")),