AppOwnedSdkSandboxInterface

public final class AppOwnedSdkSandboxInterface
extends Object implements Parcelable

java.lang.Object
   ↳ android.app.sdksandbox.AppOwnedSdkSandboxInterface


表示沙盒进程中的 SDK 与应用交互的渠道。

SDK 和应用可商定要由应用实现并通过 AppOwnedSdkSandboxInterface 对象共享的 binder 接口。

应用使用 SdkSandboxManager.registerAppOwnedSdkSandboxInterface(AppOwnedSdkSandboxInterface) 注册 AppOwnedSdkSandboxInterface。

然后,沙盒进程中的 SDK 可以使用 ERROR(/SdkSandboxController#getAppOwnedSdkSandboxInterfaces) 查询已注册的 AppOwnedSdkSandboxInterface 的列表。

SDK 在有了要与之通信的 AppOwnedSdkSandboxInterface 后,必须先将 binder 对象从 getInterface() 转换为预先安排的接口,然后才能发起通信。

总结

继承的常量

字段

public static final Creator<AppOwnedSdkSandboxInterface> CREATOR

公共构造函数

AppOwnedSdkSandboxInterface(String name, long version, IBinder binder)

公共方法

int describeContents()

描述此 Parcelable 实例的编排表示法中包含的特殊对象的种类。

IBinder getInterface()

返回与 AppOwnedSdkSandboxInterface 相关联的 binder 对象。

String getName()

返回用于注册 AppOwnedSdkSandboxInterface 的名称。

long getVersion()

返回用于注册 AppOwnedSdkSandboxInterface 的版本。

void writeToParcel(Parcel dest, int flags)

将此对象展平为一个地块。

继承的方法

字段

公共构造函数

AppOwnedSdkSandboxInterface

public AppOwnedSdkSandboxInterface (String name, 
                long version, 
                IBinder binder)

参数
name String:此值不能为 null

version long

binder IBinder:此值不能为 null

公共方法

describeContents

public int describeContents ()

描述此 Parcelable 实例的编排表示法中包含的特殊对象的种类。例如,如果对象将在 writeToParcel(android.os.Parcel, int) 的输出中添加一个文件描述符,那么此方法的返回值就必须包含 CONTENTS_FILE_DESCRIPTOR 位。

开球回攻次数
int 一个位掩码,表示此 Parcelable 对象实例所编排的特殊对象类型集。 值为 0CONTENTS_FILE_DESCRIPTOR

getInterface

public IBinder getInterface ()

返回与 AppOwnedSdkSandboxInterface 相关联的 binder 对象。

SDK 和应用可商定要由应用实现并通过此对象共享的 binder 接口,具体请参阅 AppOwnedSdkSandboxInterface

沙盒中的 SDK 必须先将从此方法接收到的 binder 对象转换为商定的接口,然后才能使用它。

返回
IBinder 此值不能为 null

getName

public String getName ()

返回用于注册 AppOwnedSdkSandboxInterface 的名称。

应用只能注册一个给定名称的接口。

开球回攻次数
String 此值不能为 null

getVersion

public long getVersion ()

返回用于注册 AppOwnedSdkSandboxInterface 的版本。

版本可以由应用选择,并用于传达应用对此实现所做的任何更新。

开球回攻次数
long

writeToParcel

public void writeToParcel (Parcel dest, 
                int flags)

将此对象扁平化为 Parcel。

参数
dest Parcel:此值不能为 null

flags int:关于如何写入对象的其他标志。可为 0 或 Parcelable.PARCELABLE_WRITE_RETURN_VALUE。 值为 0Parcelable.PARCELABLE_WRITE_RETURN_VALUE 和 android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES 的组合