Add RPC binder as unstable API with Rust bindgen
The build targets have limited visibility to the current (and hopefully
no more) clients.
Bug: 190547489
Bug: 189947807
Test: use in the client
Change-Id: I8701066e0b44c21d2b2a77bbf872efd4e28c3662
diff --git a/libs/binder/rust/src/proxy.rs b/libs/binder/rust/src/proxy.rs
index 4a6d118..e299963 100644
--- a/libs/binder/rust/src/proxy.rs
+++ b/libs/binder/rust/src/proxy.rs
@@ -125,6 +125,21 @@
}
}
+pub mod unstable_api {
+ use super::{sys, SpIBinder};
+
+ /// A temporary API to allow the client to create a `SpIBinder` from a `sys::AIBinder`. This is
+ /// needed to bridge RPC binder, which doesn't have Rust API yet.
+ /// TODO(b/184872979): remove once the Rust API is created.
+ ///
+ /// # Safety
+ ///
+ /// See `SpIBinder::from_raw`.
+ pub unsafe fn new_spibinder(ptr: *mut sys::AIBinder) -> Option<SpIBinder> {
+ SpIBinder::from_raw(ptr)
+ }
+}
+
/// An object that can be associate with an [`InterfaceClass`].
pub trait AssociateClass {
/// Check if this object is a valid object for the given interface class