pub trait IBinder:
Any
+ Send
+ Sync {
// Required methods
fn link_to_death(&self, recipient: Weak<dyn DeathRecipient>) -> Result<()>;
fn unlink_to_death(&self, recipient: Weak<dyn DeathRecipient>) -> Result<()>;
fn ping_binder(&self) -> Result<()>;
fn as_any(&self) -> &dyn Any;
fn as_transactable(&self) -> Option<&dyn Transactable>;
fn descriptor(&self) -> &str;
fn is_remote(&self) -> bool;
fn inc_strong(&self, strong: &SIBinder) -> Result<()>;
fn attempt_inc_strong(&self) -> bool;
fn dec_strong(&self, strong: Option<ManuallyDrop<SIBinder>>) -> Result<()>;
fn inc_weak(&self, weak: &WIBinder) -> Result<()>;
fn dec_weak(&self) -> Result<()>;
}Expand description
Core interface for binder objects, both local and remote.
This trait corresponds to the public interface of the C++ IBinder class,
providing the fundamental operations available on all binder objects
regardless of whether they represent local services or remote proxies.
Required Methods§
Sourcefn link_to_death(&self, recipient: Weak<dyn DeathRecipient>) -> Result<()>
fn link_to_death(&self, recipient: Weak<dyn DeathRecipient>) -> Result<()>
Register the recipient for a notification if this binder
goes away. If this binder object unexpectedly goes away
(typically because its hosting process has been killed),
then the DeathRecipient’s callback will be called.
You will only receive death notifications for remote binders, as local binders by definition can’t die without you dying as well. Trying to use this function on a local binder will result in an INVALID_OPERATION code being returned and nothing happening.
This link always holds a weak reference to its recipient.
Sourcefn unlink_to_death(&self, recipient: Weak<dyn DeathRecipient>) -> Result<()>
fn unlink_to_death(&self, recipient: Weak<dyn DeathRecipient>) -> Result<()>
Remove a previously registered death notification. The recipient will no longer be called if this object dies.
Sourcefn ping_binder(&self) -> Result<()>
fn ping_binder(&self) -> Result<()>
Send a ping transaction to this object
Sourcefn as_transactable(&self) -> Option<&dyn Transactable>
fn as_transactable(&self) -> Option<&dyn Transactable>
To convert the interface to a transactable object
Sourcefn descriptor(&self) -> &str
fn descriptor(&self) -> &str
Retrieve the descriptor of this object.