Keystore 2.0: Use Strong<> for Rust AIDL interfaces
This updates the APC code to use &Strong<dyn IConfirmationCallback>
instead of &dyn IConfirmationCallback for AIDL interfaces.
Bug: 182890877
Test: m
Change-Id: Ia841cf22daa1ef2f497fcc9bd0bbfa649100f86e
diff --git a/keystore2/src/apc.rs b/keystore2/src/apc.rs
index f8259ea..46b71dd 100644
--- a/keystore2/src/apc.rs
+++ b/keystore2/src/apc.rs
@@ -268,7 +268,7 @@
fn present_prompt(
&self,
- listener: &dyn IConfirmationCallback,
+ listener: &binder::Strong<dyn IConfirmationCallback>,
prompt_text: &str,
extra_data: &[u8],
locale: &str,
@@ -327,7 +327,7 @@
Ok(())
}
- fn cancel_prompt(&self, listener: &dyn IConfirmationCallback) -> Result<()> {
+ fn cancel_prompt(&self, listener: &binder::Strong<dyn IConfirmationCallback>) -> Result<()> {
let mut state = self.state.lock().unwrap();
let hal = match &mut state.session {
None => {
@@ -358,7 +358,7 @@
impl IProtectedConfirmation for ApcManager {
fn presentPrompt(
&self,
- listener: &dyn IConfirmationCallback,
+ listener: &binder::Strong<dyn IConfirmationCallback>,
prompt_text: &str,
extra_data: &[u8],
locale: &str,
@@ -369,7 +369,10 @@
Ok,
)
}
- fn cancelPrompt(&self, listener: &dyn IConfirmationCallback) -> BinderResult<()> {
+ fn cancelPrompt(
+ &self,
+ listener: &binder::Strong<dyn IConfirmationCallback>,
+ ) -> BinderResult<()> {
map_or_log_err(self.cancel_prompt(listener), Ok)
}
fn isSupported(&self) -> BinderResult<bool> {