SandboxedUiAdapter


public interface SandboxedUiAdapter

Known direct subclasses
AbstractSandboxedUiAdapter

An abstract class that implements SandboxedUiAdapter while abstracting away methods that do not need to be implemented by a UI provider.


An Adapter that provides content from a SandboxedSdk to be displayed as part of a host app's UI.

Summary

Nested types

public interface SandboxedUiAdapter.Session extends AutoCloseable

A single session with the provider of remote content.

The client of a single session that will receive callback events from an active session.

Public methods

abstract void
addObserverFactory(
    @NonNull SessionObserverFactory sessionObserverFactory
)

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

abstract void
openSession(
    @NonNull Context context,
    @NonNull IBinder windowInputToken,
    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.

abstract void
removeObserverFactory(
    @NonNull SessionObserverFactory sessionObserverFactory
)

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

Extension functions

default final @NonNull Bundle

Provides a Bundle containing a Binder which represents a SandboxedUiAdapter.

Public methods

addObserverFactory

Added in 1.0.0-alpha10
abstract void addObserverFactory(
    @NonNull SessionObserverFactory sessionObserverFactory
)

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.

openSession

Added in 1.0.0-alpha10
abstract void openSession(
    @NonNull Context context,
    @NonNull IBinder windowInputToken,
    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

removeObserverFactory

Added in 1.0.0-alpha10
abstract void removeObserverFactory(
    @NonNull SessionObserverFactory sessionObserverFactory
)

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.

Extension functions

SandboxedUiAdapterProxy.toCoreLibInfo

default final @NonNull Bundle SandboxedUiAdapterProxy.toCoreLibInfo(
    @NonNull SandboxedUiAdapter receiver,
    @NonNull Context context
)

Provides a Bundle containing a Binder which represents a SandboxedUiAdapter. The Bundle is shuttled to the host app in order for the SandboxedUiAdapter to be used to retrieve content.