SdkSandboxControllerCompat


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 companion functions

SdkSandboxControllerCompat
from(context: Context)

Creates SdkSandboxControllerCompat.

Public functions

List<AppOwnedSdkSandboxInterfaceCompat>

Fetches all AppOwnedSdkSandboxInterfaceCompat that are registered by the app.

String

Returns the package name of the client app.

List<SandboxedSdkCompat>

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

suspend SandboxedSdkCompat
loadSdk(sdkName: String, params: Bundle)

Load SDK in a SDK sandbox java process or locally.

IBinder

Returns an identifier for a SdkSandboxActivityHandlerCompat after registering it.

Unit

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

Unit

Unregister an already registered SdkSandboxActivityHandlerCompat.

Unit

Unregisters a listener previously registered using registerSdkSandboxClientImportanceListener

Public companion functions

from

Added in 1.0.0-alpha16
fun from(context: Context): SdkSandboxControllerCompat

Creates SdkSandboxControllerCompat.

Parameters
context: Context

SDK context

Returns
SdkSandboxControllerCompat

SdkSandboxControllerCompat object.

Public functions

getAppOwnedSdkSandboxInterfaces

Added in 1.0.0-alpha16
fun getAppOwnedSdkSandboxInterfaces(): List<AppOwnedSdkSandboxInterfaceCompat>

Fetches all AppOwnedSdkSandboxInterfaceCompat that are registered by the app.

getClientPackageName

Added in 1.0.0-alpha16
fun getClientPackageName(): String

Returns the package name of the client app.

Returns
String

Package name of the client app.

getSandboxedSdks

Added in 1.0.0-alpha16
fun getSandboxedSdks(): List<SandboxedSdkCompat>

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

Returns
List<SandboxedSdkCompat>

List of SandboxedSdkCompat containing all currently loaded sdks

See also
getSandboxedSdks

loadSdk

suspend fun loadSdk(sdkName: String, params: Bundle): SandboxedSdkCompat

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
sdkName: String

name of the SDK to be loaded.

params: Bundle

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

Returns
SandboxedSdkCompat

SandboxedSdkCompat from SDK on a successful run.

registerSdkSandboxActivityHandler

Added in 1.0.0-alpha16
fun registerSdkSandboxActivityHandler(
    handlerCompat: SdkSandboxActivityHandlerCompat
): IBinder

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
handlerCompat: SdkSandboxActivityHandlerCompat

is the SdkSandboxActivityHandlerCompat to register

Returns
IBinder

IBinder uniquely identify the passed SdkSandboxActivityHandlerCompat

registerSdkSandboxClientImportanceListener

Added in 1.0.0-alpha16
fun registerSdkSandboxClientImportanceListener(
    executor: Executor,
    listenerCompat: SdkSandboxClientImportanceListenerCompat
): Unit

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

Parameters
executor: Executor

Executor for running listenerCompat

listenerCompat: SdkSandboxClientImportanceListenerCompat

an implementation of SdkSandboxClientImportanceListenerCompat to register.

unregisterSdkSandboxActivityHandler

Added in 1.0.0-alpha16
fun unregisterSdkSandboxActivityHandler(
    handlerCompat: SdkSandboxActivityHandlerCompat
): Unit

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
handlerCompat: SdkSandboxActivityHandlerCompat

is the SdkSandboxActivityHandlerCompat to unregister.

unregisterSdkSandboxClientImportanceListener

Added in 1.0.0-alpha16
fun unregisterSdkSandboxClientImportanceListener(
    listenerCompat: SdkSandboxClientImportanceListenerCompat
): Unit

Unregisters a listener previously registered using registerSdkSandboxClientImportanceListener

Parameters
listenerCompat: SdkSandboxClientImportanceListenerCompat

an implementation of SdkSandboxClientImportanceListenerCompat to unregister.