SdkSandboxControllerCompat


public final class SdkSandboxControllerCompat


Compat version of android.app.sdksandbox.sdkprovider.SdkSandboxController.

Controller that is used by SDK loaded in the sandbox or locally to access information provided by the sandbox environment.

It enables the SDK to communicate with other SDKS and know about the state of the sdks that are currently loaded.

An instance can be obtained using SdkSandboxControllerCompat.from. The Context can be obtained using SandboxedSdkProviderCompat.context.

Summary

Public methods

static final @NonNull SdkSandboxControllerCompat
from(@NonNull Context context)

Creates SdkSandboxControllerCompat.

final @NonNull List<@NonNull AppOwnedSdkSandboxInterfaceCompat>

Fetches all AppOwnedSdkSandboxInterfaceCompat that are registered by the app.

final @NonNull String

Returns the package name of the client app.

final @NonNull List<@NonNull SandboxedSdkCompat>

Fetches information about Sdks that are loaded in the sandbox or locally.

final @NonNull SandboxedSdkCompat
loadSdk(@NonNull String sdkName, @NonNull Bundle params)

Load SDK in a SDK sandbox java process or locally.

final @NonNull IBinder

Returns an identifier for a SdkSandboxActivityHandlerCompat after registering it.

final void

Registers a listener to be notified of changes in the client's android.app.ActivityManager.RunningAppProcessInfo.importance.

final void

Unregister an already registered SdkSandboxActivityHandlerCompat.

final void

Unregisters a listener previously registered using registerSdkSandboxClientImportanceListener

Public methods

from

Added in 1.0.0-alpha16
public static final @NonNull SdkSandboxControllerCompat from(@NonNull Context context)

Creates SdkSandboxControllerCompat.

Parameters
@NonNull Context context

SDK context

Returns
@NonNull SdkSandboxControllerCompat

SdkSandboxControllerCompat object.

getAppOwnedSdkSandboxInterfaces

Added in 1.0.0-alpha16
public final @NonNull List<@NonNull AppOwnedSdkSandboxInterfaceCompatgetAppOwnedSdkSandboxInterfaces()

Fetches all AppOwnedSdkSandboxInterfaceCompat that are registered by the app.

getClientPackageName

Added in 1.0.0-alpha16
public final @NonNull String getClientPackageName()

Returns the package name of the client app.

Returns
@NonNull String

Package name of the client app.

getSandboxedSdks

Added in 1.0.0-alpha16
public final @NonNull List<@NonNull SandboxedSdkCompatgetSandboxedSdks()

Fetches information about Sdks that are loaded in the sandbox or locally.

Returns
@NonNull List<@NonNull SandboxedSdkCompat>

List of SandboxedSdkCompat containing all currently loaded sdks

See also
getSandboxedSdks

loadSdk

public final @NonNull SandboxedSdkCompat loadSdk(@NonNull String sdkName, @NonNull Bundle params)

Load SDK in a SDK sandbox java process or locally.

The caller may only load SDKs the client app depends on into the SDK sandbox.

Parameters
@NonNull String sdkName

name of the SDK to be loaded.

@NonNull Bundle params

additional parameters to be passed to the SDK in the form of a Bundle as agreed between the client and the SDK.

Returns
@NonNull SandboxedSdkCompat

SandboxedSdkCompat from SDK on a successful run.

registerSdkSandboxActivityHandler

Added in 1.0.0-alpha16
public final @NonNull IBinder registerSdkSandboxActivityHandler(
    @NonNull SdkSandboxActivityHandlerCompat handlerCompat
)

Returns an identifier for a SdkSandboxActivityHandlerCompat after registering it.

This function registers an implementation of SdkSandboxActivityHandlerCompat created by an SDK and returns an IBinder which uniquely identifies the passed SdkSandboxActivityHandlerCompat object.

Parameters
@NonNull SdkSandboxActivityHandlerCompat handlerCompat

is the SdkSandboxActivityHandlerCompat to register

Returns
@NonNull IBinder

IBinder uniquely identify the passed SdkSandboxActivityHandlerCompat

registerSdkSandboxClientImportanceListener

Added in 1.0.0-alpha16
public final void registerSdkSandboxClientImportanceListener(
    @NonNull Executor executor,
    @NonNull SdkSandboxClientImportanceListenerCompat listenerCompat
)

Registers a listener to be notified of changes in the client's android.app.ActivityManager.RunningAppProcessInfo.importance.

Parameters
@NonNull Executor executor

Executor for running listenerCompat

@NonNull SdkSandboxClientImportanceListenerCompat listenerCompat

an implementation of SdkSandboxClientImportanceListenerCompat to register.

unregisterSdkSandboxActivityHandler

Added in 1.0.0-alpha16
public final void unregisterSdkSandboxActivityHandler(
    @NonNull SdkSandboxActivityHandlerCompat handlerCompat
)

Unregister an already registered SdkSandboxActivityHandlerCompat.

If the passed SdkSandboxActivityHandlerCompat is registered, it will be unregistered. Otherwise, it will do nothing.

If the IBinder token of the unregistered handler used to start a android.app.Activity, the android.app.Activity will fail to start.

Parameters
@NonNull SdkSandboxActivityHandlerCompat handlerCompat

is the SdkSandboxActivityHandlerCompat to unregister.

unregisterSdkSandboxClientImportanceListener

Added in 1.0.0-alpha16
public final void unregisterSdkSandboxClientImportanceListener(
    @NonNull SdkSandboxClientImportanceListenerCompat listenerCompat
)

Unregisters a listener previously registered using registerSdkSandboxClientImportanceListener

Parameters
@NonNull SdkSandboxClientImportanceListenerCompat listenerCompat

an implementation of SdkSandboxClientImportanceListenerCompat to unregister.