Function binder_ndk_sys::AIBinder_prepareTransaction

source ·
pub unsafe extern "C" fn AIBinder_prepareTransaction(
    binder: *mut AIBinder,
    in_: *mut *mut AParcel,
) -> binder_status_t
Expand description

Creates a parcel to start filling out for a transaction. This will add a header to the transaction that corresponds to android.os.Parcel#writeInterfaceToken. This may add debugging or other information to the transaction for platform use or to enable other features to work. The contents of this header is a platform implementation detail, and it is required to use libbinder_ndk. This parcel is to be sent via AIBinder_transact and it represents the input data to the transaction. It is recommended to check if the object is local and call directly into its user data before calling this as the parceling and unparceling cost can be avoided. This AIBinder must be either built with a class or associated with a class before using this API.

This does not affect the ownership of binder. When this function succeeds, the in parcel’s ownership is passed to the caller. At this point, the parcel can be filled out and passed to AIBinder_transact. Alternatively, if there is an error while filling out the parcel, it can be deleted with AParcel_delete.

Available since API level 29.

\param binder the binder object to start a transaction on. \param in out parameter for input data to the transaction.

\return STATUS_OK on success. This will return STATUS_INVALID_OPERATION if the binder has not yet been associated with a class (see AIBinder_new and AIBinder_associateClass).