SandboxedSdkProvider
public
abstract
class
SandboxedSdkProvider
extends Object
java.lang.Object | |
↳ | 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 | |
---|---|
SandboxedSdkProvider()
|
Public methods | |
---|---|
final
void
|
attachContext(Context context)
Sets the SDK |
void
|
beforeUnloadSdk()
Does the work needed for the SDK to free its resources before being unloaded. |
final
Context
|
getContext()
Return the |
abstract
View
|
getView(Context windowContext, Bundle params, int width, int height)
This method was deprecated
in API level 36.
This method will no longer be supported as it is being used by |
abstract
SandboxedSdk
|
onLoadSdk(Bundle params)
Does the work needed for the SDK to start handling requests. |
Inherited methods | |
---|---|
Public constructors
SandboxedSdkProvider
public SandboxedSdkProvider ()
Public methods
attachContext
public final void attachContext (Context context)
Sets the SDK Context
which can then be received using getContext()
. This is called before onLoadSdk(Bundle)
is invoked. No operations requiring a Context
should
be performed before then, as SandboxedSdkProvider#getContext
will return null until
this method has been called.
Throws IllegalStateException if a base context has already been set.
Parameters | |
---|---|
context |
Context : The new base context.
This value cannot be null . |
beforeUnloadSdk
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 SandboxedSdk.getInterface()
.
The SDK should not do any long-running tasks here, like I/O and network calls.
getContext
public final Context getContext ()
Return the Context
previously set through SandboxedSdkProvider#attachContext
.
This will return null if no context has been previously set.
Returns | |
---|---|
Context |
getView
public abstract View getView (Context windowContext, Bundle params, int width, int height)
This method was deprecated
in API level 36.
This method will no longer be supported as it is being used by SdkSandboxManager.requestSurfacePackage(String, Bundle, Executor, OutcomeReceiver)
which is getting deprecated.
Requests a view to be remotely rendered to the client app process.
Returns View
will be wrapped into SurfacePackage
. the resulting SurfacePackage
will be sent back to the client application.
The SDK 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.
Parameters | |
---|---|
windowContext |
Context : the Context of the display which meant to show the view
This value cannot be null . |
params |
Bundle : list of params passed from the client application requesting the view
This value cannot be null . |
width |
int : The view returned will be laid as if in a window of this width, in pixels. |
height |
int : The view returned will be laid as if in a window of this height, in pixels. |
Returns | |
---|---|
View |
a View which SDK sandbox pass to the client application requesting the view
This value cannot be null . |
onLoadSdk
public abstract SandboxedSdk onLoadSdk (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 | |
---|---|
params |
Bundle : list of params passed from the client when it loads the SDK. This can be empty.
This value cannot be null . |
Returns | |
---|---|
SandboxedSdk |
Returns a SandboxedSdk , passed back to the client. The IBinder used to create
the SandboxedSdk object will be used by the client to call into the SDK.
This value cannot be null . |
Throws | |
---|---|
LoadSdkException |