AbstractSandboxedUiAdapter


abstract class AbstractSandboxedUiAdapter : SandboxedUiAdapter


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

UI providers should use this class rather than implementing SandboxedUiAdapter directly.

Summary

Nested types

An abstract class that implements SandboxedUiAdapter.Session so that a UI provider does not need to implement the entire interface.

Public constructors

Public functions

final Unit
addObserverFactory(sessionObserverFactory: SessionObserverFactory)

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

final Unit

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

Public properties

List<SessionObserverFactory>

The list of SessionObserverFactory instances that have been added to this adapter.

Inherited functions

From androidx.privacysandbox.ui.core.SandboxedUiAdapter
abstract 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.

Public constructors

AbstractSandboxedUiAdapter

Added in 1.0.0-alpha09
AbstractSandboxedUiAdapter()

Public functions

addObserverFactory

Added in 1.0.0-alpha09
final 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.

removeObserverFactory

Added in 1.0.0-alpha09
final 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.

Public properties

sessionObserverFactories

Added in 1.0.0-alpha09
val sessionObserverFactoriesList<SessionObserverFactory>

The list of SessionObserverFactory instances that have been added to this adapter.