SdkSandboxController

public class SdkSandboxController
extends Object

java.lang.Object
   ↳ android.app.sdksandbox.sdkprovider.SdkSandboxController


Controller that is used by SDK loaded in the sandbox to access information provided by the sdk sandbox.

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

An instance of SdkSandboxController can be obtained using Context.getSystemService(Class) and class. The Context can in turn be obtained using SandboxedSdkProvider.getContext().

Summary

Constants

String SDK_SANDBOX_CONTROLLER_SERVICE

Public methods

List<AppOwnedSdkSandboxInterface> getAppOwnedSdkSandboxInterfaces()

Fetches all AppOwnedSdkSandboxInterface that are registered by the app.

SharedPreferences getClientSharedPreferences()

Returns SharedPreferences containing data synced from the client app.

List<SandboxedSdk> getSandboxedSdks()

Fetches information about Sdks that are loaded in the sandbox.

IBinder registerSdkSandboxActivityHandler(SdkSandboxActivityHandler sdkSandboxActivityHandler)

Returns an identifier for a SdkSandboxActivityHandler after registering it.

void unregisterSdkSandboxActivityHandler(SdkSandboxActivityHandler sdkSandboxActivityHandler)

Unregister an already registered SdkSandboxActivityHandler.

Inherited methods

Constants

SDK_SANDBOX_CONTROLLER_SERVICE

public static final String SDK_SANDBOX_CONTROLLER_SERVICE

Constant Value: "sdk_sandbox_controller_service"

Public methods

getAppOwnedSdkSandboxInterfaces

public List<AppOwnedSdkSandboxInterface> getAppOwnedSdkSandboxInterfaces ()

Fetches all AppOwnedSdkSandboxInterface that are registered by the app.

Returns
List<AppOwnedSdkSandboxInterface> List of AppOwnedSdkSandboxInterface containing all currently registered AppOwnedSdkSandboxInterface. This value cannot be null.

Throws
UnsupportedOperationException if the controller is obtained from an unexpected context. Use SandboxedSdkProvider#getContext() for the right context

getClientSharedPreferences

public SharedPreferences getClientSharedPreferences ()

Returns SharedPreferences containing data synced from the client app.

Keys that have been synced by the client app using SdkSandboxManager.addSyncedSharedPreferencesKeys(Set) can be found in this SharedPreferences.

The returned SharedPreferences should only be read. Writing to it is not supported.

Returns
SharedPreferences SharedPreferences containing data synced from client app. This value cannot be null.

Throws
UnsupportedOperationException if the controller is obtained from an unexpected context. Use SandboxedSdkProvider#getContext() for the right context

getSandboxedSdks

public List<SandboxedSdk> getSandboxedSdks ()

Fetches information about Sdks that are loaded in the sandbox.

Returns
List<SandboxedSdk> List of SandboxedSdk containing all currently loaded sdks This value cannot be null.

Throws
UnsupportedOperationException if the controller is obtained from an unexpected context. Use SandboxedSdkProvider#getContext() for the right context

registerSdkSandboxActivityHandler

public IBinder registerSdkSandboxActivityHandler (SdkSandboxActivityHandler sdkSandboxActivityHandler)

Returns an identifier for a SdkSandboxActivityHandler after registering it.

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

If the same SdkSandboxActivityHandler registered multiple times without unregistering, the same IBinder token will be returned.

Parameters
sdkSandboxActivityHandler SdkSandboxActivityHandler: is the SdkSandboxActivityHandler to register. This value cannot be null.

Returns
IBinder IBinder uniquely identify the passed SdkSandboxActivityHandler. This value cannot be null.

unregisterSdkSandboxActivityHandler

public void unregisterSdkSandboxActivityHandler (SdkSandboxActivityHandler sdkSandboxActivityHandler)

Unregister an already registered SdkSandboxActivityHandler.

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

After unregistering, SDK can register the same handler object again or create a new one in case it wants a new Activity.

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

Parameters
sdkSandboxActivityHandler SdkSandboxActivityHandler: is the SdkSandboxActivityHandler to unregister. This value cannot be null.

Returns
void This value cannot be null.