DelegatingSandboxedUiAdapter


@ExperimentalFeatures.DelegatingAdapterApi
public final class DelegatingSandboxedUiAdapter implements 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 methods

final void
final @NonNull Bundle

Fetches the current delegate which is a SandboxedUiAdapter Bundle.

void
openSession(
    @NonNull Context context,
    @NonNull SessionConstants sessionConstants,
    int initialWidth,
    int initialHeight,
    boolean isZOrderOnTop,
    @NonNull Executor clientExecutor,
    @NonNull SandboxedUiAdapter.SessionClient client
)

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

final void
final void

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

Public constructors

DelegatingSandboxedUiAdapter

Added in 1.0.0-alpha13
public DelegatingSandboxedUiAdapter(@NonNull Bundle delegate)

Public methods

addDelegateChangeListener

Added in 1.0.0-alpha13
public final void addDelegateChangeListener(
    @NonNull DelegatingSandboxedUiAdapter.DelegateChangeListener listener
)

getDelegate

Added in 1.0.0-alpha13
public final @NonNull Bundle getDelegate()

Fetches the current delegate which is a SandboxedUiAdapter Bundle.

openSession

public void openSession(
    @NonNull Context context,
    @NonNull SessionConstants sessionConstants,
    int initialWidth,
    int initialHeight,
    boolean isZOrderOnTop,
    @NonNull Executor clientExecutor,
    @NonNull SandboxedUiAdapter.SessionClient client
)

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-alpha13
public final void removeDelegateChangeListener(
    @NonNull DelegatingSandboxedUiAdapter.DelegateChangeListener listener
)

updateDelegate

Added in 1.0.0-alpha13
public final void updateDelegate(@NonNull Bundle delegate)

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.