AppOwnedSdkSandboxInterface

public final class AppOwnedSdkSandboxInterface
extends Object implements Parcelable

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


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

SDK 和应用可以协商一个由应用实现的 Binder 接口,并通过 AppOwnedSdkSandboxInterface 对象进行共享。

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

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

一旦 SDK 获得了想要通信的 AppOwnedSdkSandboxInterface,在发起通信之前,必须将 getInterface() 中的 Binder 对象转换为预设的接口。

摘要

继承的常量

字段

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)

将此对象展平到 Parcel 中。

继承的方法

字段

公共构造函数

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:关于如何写入对象的附加标志。可以是 0Parcelable.PARCELABLE_WRITE_RETURN_VALUE。值可以是 0Parcelable.PARCELABLE_WRITE_RETURN_VALUE 和 android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES 的组合。