Expand description
Generated Rust bindings to libbinder_ndk
Structs§
- Represents a local or remote object which can be used for IPC or which can itself be sent.
- Represents a type of AIBinder object which can be sent out.
- Represents a handle on a death notification. See AIBinder_linkToDeath/AIBinder_unlinkToDeath.
- 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).
- Represents a registration to servicemanager which can be cleared anytime.
- This is a helper class that encapsulates a standard way to keep track of and chain binder errors along with service specific errors.
Enums§
Constants§
Functions§
- This will handle all queued binder commands in this process and then return. It is expected to be called whenever there is data on the fd.
- 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.
- 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.
- Retrieve the class descriptor for the class.
- This sets the implementation of handleShellCommand for a class.
- This sets the implementation of the dump method for a class.
- Deletes a binder death recipient. It is not necessary to call AIBinder_unlinkToDeath before calling this as these will all be automatically unlinked.
- Creates a new binder death recipient. This can be attached to multiple different binder objects.
- Set the callback to be called when this DeathRecipient is unlinked from a binder. The callback is called in the following situations:
- 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.
- Deletes the weak reference. This will have no impact on the lifetime of the binder.
- Whether AIBinder_Weak is less than another.
- 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.
- If promotion succeeds, result will have one strong refcount added to it. Otherwise, this returns null.
- 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.
- For debugging only!
- This will delete the object and call onDestroy once the refcount reaches zero.
- Built-in transaction for all binder objects. This dumps information about a given binder.
- 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).
- Returns the selinux context of the callee.
- 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).
- Returns the class that this binder was constructed with or associated with.
- Gets the extension registered with AIBinder_setExtension.
- 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.
- This can only be called if a strong reference to this object already exists in process.
- 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.
- Determine whether the current thread is currently executing an incoming transaction.
- If this is hosted in a process other than the current one.
- 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.
- Whether AIBinder is less than another.
- This interface has the stability of the system image.
- Creates a new binder object of the appropriate class.
- 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.
- Allow the binder to inherit realtime scheduling policies from its caller.
- Sets a minimum scheduler policy for all transactions coming into this AIBinder.
- 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.
- Copy the data of a parcel to other parcel.
- Creates a parcel.
- Cleans up a parcel.
- Gets the current position within the parcel.
- Gets the size of the parcel.
- Data written to the parcel will be zero’d before being deleted or realloced.
- Marshals the raw bytes of the Parcel to a buffer.
- Reads into bool value from the next location in a non-null parcel.
- Reads an array of bool from the next location in a non-null parcel.
- Reads into int8_t value from the next location in a non-null parcel.
- Reads an array of int8_t from the next location in a non-null parcel.
- Reads into char16_t value from the next location in a non-null parcel.
- Reads an array of char16_t from the next location in a non-null parcel.
- Reads into double value from the next location in a non-null parcel.
- Reads an array of double from the next location in a non-null parcel.
- Reads into float value from the next location in a non-null parcel.
- Reads an array of float from the next location in a non-null parcel.
- Reads into int32_t value from the next location in a non-null parcel.
- Reads into int64_t value from the next location in a non-null parcel.
- Reads an array of int32_t from the next location in a non-null parcel.
- Reads an array of int64_t from the next location in a non-null parcel.
- Reads an int from the next location in a non-null parcel.
- Reads an array of parcelables (user-defined types) from the next location in a non-null parcel.
- Reads an AStatus from the next location in a non-null parcel. Ownership is passed to the caller of this function.
- Reads and allocates utf-8 string value from the next location in a non-null parcel.
- Reads and allocates utf-8 string array value from the next location in a non-null parcel.
- Reads an AIBinder from the next location in a non-null parcel. One strong ref-count of ownership is passed to the caller of this function.
- Reads into uint32_t value from the next location in a non-null parcel.
- Reads into uint64_t value from the next location in a non-null parcel.
- Reads an array of uint32_t from the next location in a non-null parcel.
- Reads an array of uint64_t from the next location in a non-null parcel.
- Reset the parcel to the initial status.
- Sets the position within the parcel.
- Set the data in the parcel to the raw bytes from the buffer.
- Writes bool value to the next location in a non-null parcel.
- Writes an array of bool to the next location in a non-null parcel.
- Writes int8_t value to the next location in a non-null parcel.
- Writes an array of int8_t to the next location in a non-null parcel.
- Writes char16_t value to the next location in a non-null parcel.
- Writes an array of char16_t to the next location in a non-null parcel.
- Writes double value to the next location in a non-null parcel.
- Writes an array of double to the next location in a non-null parcel.
- Writes float value to the next location in a non-null parcel.
- Writes an array of float to the next location in a non-null parcel.
- Writes int32_t value to the next location in a non-null parcel.
- Writes int64_t value to the next location in a non-null parcel.
- Writes an array of int32_t to the next location in a non-null parcel.
- Writes an array of int64_t to the next location in a non-null parcel.
- Writes a file descriptor to the next location in a non-null parcel. This does not take ownership of fd.
- Writes an array of parcelables (user-defined types) to the next location in a non-null parcel.
- Writes an AStatus object to the next location in a non-null parcel.
- Writes utf-8 string value to the next location in a non-null parcel.
- Writes utf-8 string array data to the next location in a non-null parcel.
- 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.
- Writes uint32_t value to the next location in a non-null parcel.
- Writes uint64_t value to the next location in a non-null parcel.
- Writes an array of uint32_t to the next location in a non-null parcel.
- Writes an array of uint64_t to the next location in a non-null parcel.
- Unregister for notifications and delete the object.
- This registers the service with the default service manager under this instance name. This does not take ownership of binder.
- This registers the service with the default service manager under this instance name. This does not take ownership of binder.
- 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).
- Returns all declared instances for a particular interface.
- Prevent lazy services without client from shutting down their process
- 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.
- Returns the APEX name if a service is declared as updatable via an APEX module.
- Check if a service is declared (e.g. VINTF manifest).
- Check if a service is updatable via an APEX module.
- Opens a declared passthrough HAL.
- 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).
- Get notifications when a service is registered. If the service is already registered, you will immediately get a notification.
- 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.
- Try to unregister all services previously registered with ‘registerService’.
- 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).
- Deletes memory associated with the status instance.
- Delete description.
- New status with exception code.
- New status with exception code and message.
- New status with a service speciic error.
- New status with a service specific error and message.
- 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.
- Get human-readable description for debugging.
- The exception that this status object represents.
- If there is a message associated with this status, this will return that message. If there is no message, this will return an empty string.
- 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.
- Whether this object represents a successful transaction. If this function returns true, then AStatus_getExceptionCode will return EX_NONE.
- New status which is considered a success.
Type Aliases§
- This is called whenever a new AIBinder object is needed of a specific class.
- This is called whenever an AIBinder object is no longer referenced and needs destroyed.
- This is called whenever a transaction needs to be processed by a local implementation.
- This function is executed on death receipt. See AIBinder_linkToDeath/AIBinder_unlinkToDeath.
- 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.
- Function to execute a shell command.
- Dump information about an AIBinder (usually for debugging).
- 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 get the underlying data from an arrayData object at index.
- This is called to set an underlying value in an arrayData object at index.
- This is called to get the underlying data from an arrayData object.
- This is called to get the underlying data from an arrayData object.
- This is called to get the underlying data from an arrayData object.
- This is called to get the underlying data from an arrayData object.
- This is called to get the underlying data from an arrayData object.
- This is called to get the underlying data from an arrayData object.
- This is called to allocate an array of size ‘length’. If length is -1, then a ‘null’ array (or equivalent) should be created.
- This is called to set an underlying value in an arrayData object at index.
- 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.
- This is called to allocate an array of size ‘length’. If length is -1, then a ‘null’ array (or equivalent) should be created.
- This is called to allocate a string inside of an array that was allocated by an AParcel_stringArrayAllocator.
- This returns the length and buffer of an array at a specific index in an arrayData object.
- This is called to get the underlying data from an arrayData object.
- This is called to get the underlying data from an arrayData object.
- This is called to parcel the underlying data from an arrayData object at index.
- Function to call when a service is registered. The instance is passed as well as ownership of the binder named ‘registered’.
- One of the EX_* enumerators.
- Flags for AIBinder_transact.
- One of the STATUS_* values.
- Codes for AIBinder_transact. This defines the range of codes available for usage. Other codes are used or reserved by the Android system.