2121
2222__BEGIN_DECLS
2323
24+ /**
25+ * @defgroup ABinderRpc Binder RPC
26+ *
27+ * This set of APIs makes it possible for a process to use the AServiceManager
28+ * APIs to get binder objects for services that are available over sockets
29+ * instead of the traditional kernel binder with the extra ServiceManager
30+ * process.
31+ *
32+ * These APIs are used to supply libbinder with enough information to create
33+ * and manage the socket connections underneath the ServiceManager APIs so the
34+ * clients do not need to know the service implementation details or what
35+ * transport they use for communication.
36+ *
37+ * @{
38+ */
39+
2440/**
2541 * This represents an IAccessor implementation from libbinder that is
2642 * responsible for providing a pre-connected socket file descriptor for a
@@ -66,7 +82,8 @@ typedef struct ABinderRpc_ConnectionInfo ABinderRpc_ConnectionInfo;
6682 * libbinder.
6783 *
6884 * \param instance name of the service like
69- * `android.hardware.vibrator.IVibrator/default`
85+ * `android.hardware.vibrator.IVibrator/default`. This string must remain
86+ * valid and unchanged for the duration of this function call.
7087 * \param data the data that was associated with this instance when the callback
7188 * was registered.
7289 * \return The ABinderRpc_Accessor associated with the service `instance`. This
@@ -103,13 +120,15 @@ typedef void (*ABinderRpc_AccessorProviderUserData_deleteCallback)(void* _Nullab
103120 * instance is being registered that was previously registered, this call
104121 * will fail and the ABinderRpc_AccessorProviderUserData_deleteCallback
105122 * will be called to clean up the data.
123+ * This array of strings must remain valid and unchanged for the duration
124+ * of this function call.
106125 * \param number of instances in the instances array.
107126 * \param data pointer that is passed to the ABinderRpc_AccessorProvider callback.
108127 * IMPORTANT: The ABinderRpc_AccessorProvider now OWNS that object that data
109128 * points to. It can be used as necessary in the callback. The data MUST
110129 * remain valid for the lifetime of the provider callback.
111130 * Do not attempt to give ownership of the same object to different
112- * providers throguh multiple calls to this function because the first
131+ * providers through multiple calls to this function because the first
113132 * one to be deleted will call the onDelete callback.
114133 * \param onDelete callback used to delete the objects that `data` points to.
115134 * This is called after ABinderRpc_AccessorProvider is guaranteed to never be
@@ -151,8 +170,9 @@ void ABinderRpc_unregisterAccessorProvider(ABinderRpc_AccessorProvider* _Nonnull
151170 * connect to a socket that a given service is listening on. This is needed to
152171 * create an ABinderRpc_Accessor so it can connect to these services.
153172 *
154- * \param instance name of the service to connect to
155- * \param data userdata for this callback. The pointer is provided in
173+ * \param instance name of the service to connect to. This string must remain
174+ * valid and unchanged for the duration of this function call.
175+ * \param data user data for this callback. The pointer is provided in
156176 * ABinderRpc_Accessor_new.
157177 * \return ABinderRpc_ConnectionInfo with socket connection information for `instance`
158178 */
@@ -177,7 +197,9 @@ typedef void (*ABinderRpc_ConnectionInfoProviderUserData_delete)(void* _Nullable
177197 * that can use the info from the ABinderRpc_ConnectionInfoProvider to connect to a
178198 * socket that the service with `instance` name is listening to.
179199 *
180- * \param instance name of the service that is listening on the socket
200+ * \param instance name of the service that is listening on the socket. This
201+ * string must remain valid and unchanged for the duration of this
202+ * function call.
181203 * \param provider callback that can get the socket connection information for the
182204 * instance. This connection information may be dynamic, so the
183205 * provider will be called any time a new connection is required.
@@ -219,18 +241,24 @@ AIBinder* _Nullable ABinderRpc_Accessor_asBinder(ABinderRpc_Accessor* _Nonnull a
219241
220242/**
221243 * Return the ABinderRpc_Accessor associated with an AIBinder. The instance must match
222- * the ABinderRpc_Accessor implementation, and the AIBinder must a proxy binder for a
223- * remote service (ABpBinder).
224- * This can be used when receivng an AIBinder from another process that the
244+ * the ABinderRpc_Accessor implementation.
245+ * This can be used when receiving an AIBinder from another process that the
225246 * other process obtained from ABinderRpc_Accessor_asBinder.
226247 *
227248 * \param instance name of the service that the Accessor is responsible for.
228- * \param accessorBinder proxy binder from another processes ABinderRpc_Accessor.
249+ * This string must remain valid and unchanged for the duration of this
250+ * function call.
251+ * \param accessorBinder proxy binder from another process's ABinderRpc_Accessor.
252+ * This function preserves the refcount of this binder object and the
253+ * caller still owns it.
229254 * \return ABinderRpc_Accessor representing the other processes ABinderRpc_Accessor
230- * implementation. This function does not take ownership of the
231- * ABinderRpc_Accessor (so the caller needs to delete with
232- * ABinderRpc_Accessor_delete), and it preserves the recount of the bidner
233- * object.
255+ * implementation. The caller owns this ABinderRpc_Accessor instance and
256+ * is responsible for deleting it with ABinderRpc_Accessor_delete or
257+ * passing ownership of it elsewhere, like returning it through
258+ * ABinderRpc_AccessorProvider_getAccessorCallback.
259+ * nullptr on error when the accessorBinder is not a valid binder from
260+ * an IAccessor implementation or the IAccessor implementation is not
261+ * associated with the provided instance.
234262 */
235263ABinderRpc_Accessor * _Nullable ABinderRpc_Accessor_fromBinder (const char * _Nonnull instance ,
236264 AIBinder * _Nonnull accessorBinder )
@@ -258,4 +286,6 @@ ABinderRpc_ConnectionInfo* _Nullable ABinderRpc_ConnectionInfo_new(const sockadd
258286 */
259287void ABinderRpc_ConnectionInfo_delete (ABinderRpc_ConnectionInfo * _Nonnull info ) __INTRODUCED_IN (36 );
260288
289+ /** @} */
290+
261291__END_DECLS
0 commit comments