Trait IBinder

Source
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

Interface of binder local or remote objects.

This trait corresponds to the parts of the interface of the C++ IBinder class which are public.

Required Methods§

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.

Remove a previously registered death notification. The recipient will no longer be called if this object dies.

Source

fn ping_binder(&self) -> Result<()>

Send a ping transaction to this object

Source

fn as_any(&self) -> &dyn Any

To support dynamic interface cast, we need to know the interface

Source

fn as_transactable(&self) -> Option<&dyn Transactable>

To convert the interface to a transactable object

Source

fn descriptor(&self) -> &str

Retrieve the descriptor of this object.

Source

fn is_remote(&self) -> bool

Retrieve if this object is remote.

Source

fn inc_strong(&self, strong: &SIBinder) -> Result<()>

Source

fn attempt_inc_strong(&self) -> bool

Source

fn dec_strong(&self, strong: Option<ManuallyDrop<SIBinder>>) -> Result<()>

Source

fn inc_weak(&self, weak: &WIBinder) -> Result<()>

Source

fn dec_weak(&self) -> Result<()>

Implementations§

Source§

impl dyn IBinder

Source

pub fn as_proxy(&self) -> Option<&ProxyHandle>

Convert this binder object into a proxy binder object.

Trait Implementations§

Source§

impl Debug for dyn IBinder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Implementors§