Function binder_ndk_sys::AIBinder_DeathRecipient_setOnUnlinked

source ยท
pub unsafe extern "C" fn AIBinder_DeathRecipient_setOnUnlinked(
    recipient: *mut AIBinder_DeathRecipient,
    onUnlinked: AIBinder_DeathRecipient_onBinderUnlinked,
)
Expand description

Set the callback to be called when this DeathRecipient is unlinked from a binder. The callback is called in the following situations:

  1. If the binder died, shortly after the call to onBinderDied.
  2. If the binder is explicitly unlinked with AIBinder_unlinkToDeath or AIBinder_DeathRecipient_delete, after any pending onBinderDied calls finish.
  3. During or shortly after the AIBinder_linkToDeath call if it returns an error.

It is guaranteed that the callback is called exactly once for each call to linkToDeath unless the process is aborted before the binder is unlinked.

Be aware that when the binder is explicitly unlinked, it is not guaranteed that onUnlinked has been called before the call to AIBinder_unlinkToDeath or AIBinder_DeathRecipient_delete returns. For example, if the binder dies concurrently with a call to AIBinder_unlinkToDeath, the binder is not unlinked until after the death notification is delivered, even if AIBinder_unlinkToDeath returns before that happens.

This method should be called before linking the DeathRecipient to a binder because the function pointer is cached. If you change it after linking to a binder, it is unspecified whether the old binder will call the old or new onUnlinked callback.

The onUnlinked argument may be null. In this case, no notification is given when the binder is unlinked.

Available since API level 33.

\param recipient the DeathRecipient to set the onUnlinked callback for. \param onUnlinked the callback to call when a binder is unlinked from recipient.