binder

Trait IBinder

Source
pub trait IBinder {
    // Required methods
    fn link_to_death(
        &mut self,
        recipient: &mut DeathRecipient,
    ) -> Result<(), StatusCode>;
    fn unlink_to_death(
        &mut self,
        recipient: &mut DeathRecipient,
    ) -> Result<(), StatusCode>;
    fn ping_binder(&mut self) -> Result<(), StatusCode>;
}
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 only holds a weak reference to its recipient. If the DeathRecipient is dropped then it will be unlinked.

Note that the notifications won’t work if you don’t first start at least one Binder thread by calling ProcessState::start_thread_pool or ProcessState::join_thread_pool.

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

Source

fn ping_binder(&mut self) -> Result<(), StatusCode>

Send a ping transaction to this object

Implementors§

Source§

impl<T: AsNative<AIBinder>> IBinder for T