AsyncReplyReceiver

interface AsyncReplyReceiver : OneWayBinderInterface

Receives replies asynchronously over an IBinder interface.

Normally, IBinder interfaces are synchronous. The calling thread is blocked until a reply is received. To allow suspendable functions in IVI services, the replies of suspendable functions should not block the calling thread. As such, the generated code uses this class to send the replies back asynchronously.

On the client side, the coroutine is suspended until the async reply is retrieved. On the server side, a coroutine is launched and the calling binder call is returned directly. The launched coroutine can send a reply back to the client.

Only the Stub.Proxy (on the server side) implements this interface. The Stub (on the client side) provides a Stub.sendAndWaitForReply instead as a utility function to send a message and wait for the reply asynchronously.

The aidl tool is not used as it doesn't support Kotlin coroutines. The inner classes follow as much as possible the structure of the code generated by the aidl tool.

Types

Link copied to clipboard
class Stub(binderContext: BinderContext) : OneWayBinderInterface.Stub

Used by the clients to send messages over the binder interface and to receive an asynchronous reply back.

Functions

Link copied to clipboard
abstract fun launchAndReply(    requestId: AsyncRequestId,     interfaceDescriptor: String,     transactionName: String,     asyncReplyProvider: AsyncReplyProvider)

Invokes a suspendable asyncReplyProvider and sends the reply asynchronously.

Inherited functions

Link copied to clipboard
abstract fun asBinder(): IBinder

Inheritors

Link copied to clipboard