SandboxedSdkProviderCompat


public abstract class SandboxedSdkProviderCompat


Compat version of android.app.sdksandbox.SandboxedSdkProvider.

Encapsulates API which SDK sandbox can use to interact with SDKs loaded into it.

SDK has to implement this abstract class to generate an entry point for SDK sandbox to be able to call it through.

Summary

Public constructors

Public methods

final void

Sets the SDK Context which can then be received using SandboxedSdkProviderCompat.context

void

Does the work needed for the SDK to free its resources before being unloaded.

final Context

Context previously set through SandboxedSdkProviderCompat.attachContext.

abstract @NonNull View
getView(
    @NonNull Context windowContext,
    @NonNull Bundle params,
    int width,
    int height
)

Requests a view to be remotely rendered to the client app process.

abstract @NonNull SandboxedSdkCompat

Does the work needed for the SDK to start handling requests.

Public constructors

SandboxedSdkProviderCompat

Added in 1.0.0-alpha14
public SandboxedSdkProviderCompat()

Public methods

attachContext

Added in 1.0.0-alpha14
public final void attachContext(@NonNull Context context)

Sets the SDK Context which can then be received using SandboxedSdkProviderCompat.context

This is called before SandboxedSdkProviderCompat.onLoadSdk is invoked. No operations requiring a Context should be performed before then, as SandboxedSdkProviderCompat.context will return null until this method has been called.

Parameters
@NonNull Context context

The new base context.

Throws
kotlin.IllegalStateException

if a base context has already been set.

See also
attachContext

beforeUnloadSdk

Added in 1.0.0-alpha14
public void beforeUnloadSdk()

Does the work needed for the SDK to free its resources before being unloaded.

This function is called by the SDK sandbox manager before it unloads the SDK. The SDK should fail any invocations on the Binder previously returned to the client through SandboxedSdkCompat.getInterface

The SDK should not do any long-running tasks here, like I/O and network calls.

See also
beforeUnloadSdk

getContext

Added in 1.0.0-alpha14
public final Context getContext()

Context previously set through SandboxedSdkProviderCompat.attachContext. This will return null if no context has been previously set.

getView

Added in 1.0.0-alpha14
public abstract @NonNull View getView(
    @NonNull Context windowContext,
    @NonNull Bundle params,
    int width,
    int height
)

Requests a view to be remotely rendered to the client app process.

See also
getView

onLoadSdk

Added in 1.0.0-alpha14
public abstract @NonNull SandboxedSdkCompat onLoadSdk(@NonNull Bundle params)

Does the work needed for the SDK to start handling requests.

This function is called by the SDK sandbox after it loads the SDK.

SDK should do any work to be ready to handle upcoming requests. It should not do any long-running tasks here, like I/O and network calls. Doing so can prevent the SDK from receiving requests from the client. Additionally, it should not do initialization that depends on other SDKs being loaded into the SDK sandbox.

The SDK should not do any operations requiring a Context object before this method has been called.

Parameters
@NonNull Bundle params

list of params passed from the client when it loads the SDK. This can be empty.

Returns
@NonNull SandboxedSdkCompat

Returns a SandboxedSdkCompat, passed back to the client. The IBinder used to create the SandboxedSdkCompat object will be used by the client to call into the SDK.

See also
onLoadSdk