DelegatingSandboxedUiAdapter


@ExperimentalFeatures.DelegatingAdapterApi
class DelegatingSandboxedUiAdapter : SandboxedUiAdapter


A SandboxedUiAdapter that helps delegate calls to other uiAdapters.

When this adapter is set to the client's container, the adapter can switch the delegate uiAdapter, that serves the Session, without involving the client. For each new delegate, a session would be requested with all clients of this adapter.

One example use-case of these kind of UIAdapters is to support updating the provider of the UI without the client's involvement.

Summary

Nested types

Listener that consumes events to process the delegate change for a client

Public constructors

Public functions

Unit
open Unit
addObserverFactory(sessionObserverFactory: SessionObserverFactory)

Adds a SessionObserverFactory with a SandboxedUiAdapter for tracking UI presentation state across UI sessions.

Bundle

Fetches the current delegate which is a SandboxedUiAdapter Bundle.

open Unit
openSession(
    context: Context,
    windowInputToken: IBinder,
    initialWidth: Int,
    initialHeight: Int,
    isZOrderOnTop: Boolean,
    clientExecutor: Executor,
    client: SandboxedUiAdapter.SessionClient
)

Open a new session for displaying content with an initial size of initialWidthxinitialHeight pixels.

Unit
open Unit

Removes a SessionObserverFactory from a SandboxedUiAdapter, if it has been previously added with addObserverFactory.

suspend Unit

Updates the delegate and notifies all listeners to process the update.

Public constructors

DelegatingSandboxedUiAdapter

Added in 1.0.0-alpha12
DelegatingSandboxedUiAdapter(delegate: Bundle)

Public functions

addDelegateChangeListener

Added in 1.0.0-alpha12
fun addDelegateChangeListener(
    listener: DelegatingSandboxedUiAdapter.DelegateChangeListener
): Unit

addObserverFactory

Added in 1.0.0-alpha12
open fun addObserverFactory(sessionObserverFactory: SessionObserverFactory): Unit

Adds a SessionObserverFactory with a SandboxedUiAdapter for tracking UI presentation state across UI sessions. This has no effect on already open sessions.

For each SandboxedUiAdapter.Session that is created for the adapter after registration is complete, SessionObserverFactory.create will be invoked to allow a new SessionObserver instance to be attached to the UI session. This SessionObserver will receive UI updates for the lifetime of the session. There may be one or more UI sessions created for a SandboxedUiAdapter, and a separate SessionObserverFactory.create call will be made for each one.

getDelegate

Added in 1.0.0-alpha12
fun getDelegate(): Bundle

Fetches the current delegate which is a SandboxedUiAdapter Bundle.

openSession

Added in 1.0.0-alpha12
open fun openSession(
    context: Context,
    windowInputToken: IBinder,
    initialWidth: Int,
    initialHeight: Int,
    isZOrderOnTop: Boolean,
    clientExecutor: Executor,
    client: SandboxedUiAdapter.SessionClient
): Unit

Open a new session for displaying content with an initial size of initialWidthxinitialHeight pixels. client will receive all incoming communication from the provider of content. All incoming calls to client will be made through the provided clientExecutor. isZOrderOnTop tracks if the content surface will be placed on top of its window

removeDelegateChangeListener

Added in 1.0.0-alpha12
fun removeDelegateChangeListener(
    listener: DelegatingSandboxedUiAdapter.DelegateChangeListener
): Unit

removeObserverFactory

Added in 1.0.0-alpha12
open fun removeObserverFactory(sessionObserverFactory: SessionObserverFactory): Unit

Removes a SessionObserverFactory from a SandboxedUiAdapter, if it has been previously added with addObserverFactory.

If the SessionObserverFactory was not previously added, no action is performed. Any existing SessionObserver instances that have been created by the SessionObserverFactory will continue to receive updates until their corresponding SandboxedUiAdapter.Session has been closed. For any subsequent sessions created for the SandboxedUiAdapter, no call to SessionObserverFactory.create will be made.

updateDelegate

Added in 1.0.0-alpha12
suspend fun updateDelegate(delegate: Bundle): Unit

Updates the delegate and notifies all listeners to process the update. If any listener fails process refresh we throw IllegalStateException. Cancellation of this API does not propagate to the client side.