The AIBinder object associated with this can be retrieved if it is still alive so that it can be
re-used. The intention of this is to enable the same AIBinder object to always represent the same
object.
This object represents a package of data that can be sent between processes. When transacting, an
instance of it is automatically created to be used for the transaction. When two processes use
binder to communicate, they must agree on a format of this parcel to be used in order to transfer
data. This is usually done in an IDL (see AIDL, specificially).
Check if the threadpool has already been started.
This tells whether someone in the process has called ABinderProcess_startThreadPool. Usually,
you should use this in a library to abort if the threadpool is not started.
Programs should configure binder threadpools once at the beginning.
This adds the current thread to the threadpool. This thread will be in addition to the thread
configured with ABinderProcess_setThreadPoolMaxThreadCount and started with
ABinderProcess_startThreadPool.
This sets the maximum number of threads that can be started in the threadpool. By default, after
startThreadPool is called, this is 15. If it is called additional times, it will only prevent
the kernel from starting new threads and will not delete already existing threads. This should
be called once before startThreadPool. The number of threads can never decrease.
This gives you an fd to wait on. Whenever data is available on the fd,
ABinderProcess_handlePolledCommands can be called to handle binder queries.
This is expected to be used in a single threaded process which waits on
events from multiple different fds.
This creates a threadpool for incoming binder transactions if it has not already been created,
spawning one thread, and allowing the kernel to lazily start threads according to the count
that is specified in ABinderProcess_setThreadPoolMaxThreadCount.
Return the AIBinder associated with an ABinderRpc_Accessor. This can be used to
send the Accessor to another process or even register it with servicemanager.
Return the ABinderRpc_Accessor associated with an AIBinder. The instance must match
the ABinderRpc_Accessor implementation.
This can be used when receiving an AIBinder from another process that the
other process obtained from ABinderRpc_Accessor_asBinder.
Create a new ABinderRpc_Accessor. This creates an IAccessor object in libbinder
that can use the info from the ABinderRpc_ConnectionInfoProvider to connect to a
socket that the service with instance name is listening to.
Create a new ABinderRpc_ConnectionInfo with sockaddr. This can be supported socket
types like sockaddr_vm (vsock) and sockaddr_un (Unix Domain Sockets).
Inject an ABinderRpc_AccessorProvider_getAccessorCallback into the process for
the Service Manager APIs to use to retrieve ABinderRpc_Accessor objects associated
with different RPC Binder services.
Remove an ABinderRpc_AccessorProvider from libbinder. This will remove references
from the ABinderRpc_AccessorProvider and will no longer call the
ABinderRpc_AccessorProvider_getAccessorCallback.
This creates a new instance of a class of binders which can be instantiated. This is called one
time during library initialization and cleaned up when the process exits or execs.
This tells users of this class not to use a transaction header. By default, libbinder_ndk users
read/write transaction headers implicitly (in the SDK, this must be manually written by
android.os.Parcel#writeInterfaceToken, and it is read/checked with
android.os.Parcel#enforceInterface). This method is provided in order to talk to legacy code
which does not write an interface token. When this is disabled, type safety is reduced, so you
must have a separate way of determining the binder you are talking to is the right type. Must
be called before any instance of the class is created.
Clone an AIBinder_Weak. Useful because even if a weak binder promotes to a
null value, after further binder transactions, it may no longer promote to a
null value.
This does not take any ownership of the input binder, but it can be used to retrieve it if
something else in some process still holds a reference to it.
This sets the class of an AIBinder object. This checks to make sure the remote object is of
the expected class. A class must be set in order to use transactions on an AIBinder object.
However, if an object is just intended to be passed through to another process or used as a
handle this need not be called.
Given a binder interface at a certain stability, there may be some
requirements associated with that higher stability level. For instance, a
VINTF stability binder is required to be in the VINTF manifest. This API
can be called to use that same interface within the system partition.
This returns the calling PID assuming that this thread is called from a thread that is processing
a binder transaction (for instance, in the implementation of AIBinder_Class_onTransact).
This returns the calling UID assuming that this thread is called from a thread that is processing
a binder transaction (for instance, in the implementation of AIBinder_Class_onTransact).
Value returned by onCreate for a local binder. For stateless classes (if onCreate returns
null), this also returns null. For a remote binder, this will always return null.
If this binder is known to be alive. This will not send a transaction to a remote process and
returns a result based on the last known information. That is, whenever a transaction is made,
this is automatically updated to reflect the current alive status of this binder. This will be
updated as the result of a transaction made using AIBinder_transact, but it will also be updated
based on the results of bookkeeping or other transactions made internally.
Registers for notifications that the associated binder is dead. The same death recipient may be
associated with multiple different binders. If the binder is local, then no death recipient will
be given (since if the local process dies, then no recipient will exist to receive a
transaction). The cookie is passed to recipient in the case that this binder dies and can be
null. The exact cookie must also be used to unlink this transaction (see AIBinder_unlinkToDeath).
This function may return a binder transaction failure. The cookie can be used both for
identification and holding user data.
Built-in transaction for all binder objects. This sends a transaction that will immediately
return. Usually this is used to make sure that a binder is alive, as a placeholder call, or as a
consistency check.
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.
Gets the extension of a binder interface. This allows a downstream developer to add
an extension to an interface without modifying its interface file. This should be
called immediately when the object is created before it is passed to another thread.
No thread safety is required.
Makes calls to AIBinder_getCallingSid work if the kernel supports it. This
must be called on a local binder server before it is sent out to any othe
process. If this is a remote binder, it will abort. If the kernel doesn’t
support this feature, you’ll always get null from AIBinder_getCallingSid.
Transact using a parcel created from AIBinder_prepareTransaction. This actually communicates with
the object representing this binder object. This also passes out a parcel to be used for the
return transaction. This takes ownership of the in parcel and automatically deletes it after it
is sent to the remote process. The output parcel is the result of the transaction. If the
transaction has FLAG_ONEWAY, the out parcel will be empty. Otherwise, this will block until the
remote process has processed the transaction, and the out parcel will contain the output data
from transaction.
Stops registration for the associated binder dying. Does not delete the recipient. This function
may return a binder transaction failure and in case the death recipient cannot be found, it
returns STATUS_NAME_NOT_FOUND.
Writes an AIBinder to the next location in a non-null parcel. Can be null. This does not take any
refcounts of ownership of the binder from the client.
Gets a binder object with this specific instance name. Will return nullptr immediately if the
service is not available This also implicitly calls AIBinder_incStrong (so the caller of this
function is responsible for calling AIBinder_decStrong).
Gets a binder object with this specific instance name. Blocks for a couple of seconds waiting on
it. This also implicitly calls AIBinder_incStrong (so the caller of this function is responsible
for calling AIBinder_decStrong). This does polling. A more efficient way to make sure you
unblock as soon as the service is available is to use AIBinder_waitForService.
Re-register services that were unregistered by ‘tryUnregister’.
This method should be called in the case ‘tryUnregister’ fails
(and should be called on the same thread).
Registers a lazy service with the default service manager under the ‘instance’ name.
Does not take ownership of binder.
The service must be configured statically with init so it can be restarted with
ctl.interface.* messages from servicemanager.
AServiceManager_registerLazyService cannot safely be used with AServiceManager_addService
in the same process. If one service is registered with AServiceManager_registerLazyService,
the entire process will have its lifetime controlled by servicemanager.
Instead, all services in the process should be registered using
AServiceManager_registerLazyService.
Set a callback that is invoked when the active service count (i.e. services with clients)
registered with this process drops to zero (or becomes nonzero).
The callback takes a boolean argument, which is ‘true’ if there is
at least one service with clients.
Gets a binder object with this specific instance name. Efficiently waits for the service.
If the service is not ever registered, it will wait indefinitely. Requires the threadpool
to be started in the service.
This also implicitly calls AIBinder_incStrong (so the caller of this function is responsible
for calling AIBinder_decStrong).
New status with binder_status_t. This is typically for low level failures when a binder_status_t
is returned by an API on AIBinder or AParcel, and that is to be returned from a method returning
an AStatus instance. This is the least preferable way to return errors.
Prefer exceptions (particularly service-specific errors) when possible.
The service specific error if this object represents one. This function will only ever return a
non-zero result if AStatus_getExceptionCode returns EX_SERVICE_SPECIFIC. If this function returns
0, the status object may still represent a different exception or status. To find out if this
transaction as a whole is okay, use AStatus_isOk instead.
The status if this object represents one. This function will only ever return a non-zero result
if AStatus_getExceptionCode returns EX_TRANSACTION_FAILED. If this function return 0, the status
object may represent a different exception or a service specific error. To find out if this
transaction as a whole is okay, use AStatus_isOk instead.
This callback is responsible deleting the void* data object that is passed
in to ABinderRpc_registerAccessorProvider for the ABinderRpc_AccessorProvider_getAccessorCallback
to use. That object is owned by the ABinderRpc_AccessorProvider and must remain valid for the
lifetime of the callback because it may be called and use the object.
This _delete callback is called after the ABinderRpc_AccessorProvider is remove and
is guaranteed never to be called again.
This callback is responsible for returning ABinderRpc_Accessor objects for a given
service instance. These ABinderRpc_Accessor objects are implemented by
libbinder_ndk and backed by implementations of android::os::IAccessor in
libbinder.
Callback which returns the RPC connection information for libbinder to use to
connect to a socket that a given service is listening on. This is needed to
create an ABinderRpc_Accessor so it can connect to these services.
This callback is responsible deleting the void* data object that is passed
in to ABinderRpc_Accessor_new for the ABinderRpc_ConnectionInfoProvider to use. That
object is owned by the ABinderRpc_Accessor and must remain valid for the
lifetime the Accessor because it may be used by the connection info provider
callback.
This _delete callback is called after the ABinderRpc_Accessor is removed and
is guaranteed never to be called again.
This function is intended for cleaning up the data in the provided cookie, and it is executed
when the DeathRecipient is unlinked. When the DeathRecipient is unlinked due to a death receipt,
this method is called after the call to onBinderDied.
This allocates an array of size ‘length’ inside of arrayData and returns whether or not there was
a success. If length is -1, then this should allocate some representation of a null array.
This is called to allocate a buffer for a C-style string (null-terminated). The returned buffer
should be at least length bytes. This includes space for a null terminator. For a string, length
will always be strictly less than or equal to the maximum size that can be held in a size_t and
will always be greater than 0. However, if a ‘null’ string is being read, length will be -1.