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() 转换为预先安排的接口,然后才能发起通信。

摘要

继承的常量

int CONTENTS_FILE_DESCRIPTOR

describeContents() 一起使用的描述符位:表示 Parcelable 对象的扁平化表示中包含一个文件描述符。

int PARCELABLE_WRITE_RETURN_VALUE

writeToParcel(Parcel, int) 搭配使用的标志:正在写入的对象 是一个返回值,该值是如下函数的结果: “Parcelable someFunction()”、 “void someFunction(out Parcelable)”或 “void someFunction(inout Parcelable)”。

字段

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。

继承的方法

Object clone()

创建并返回此对象的副本。

boolean equals(Object obj)

指示某个其他对象是否“等于”这个。

void finalize()

垃圾回收时,由垃圾回收器针对对象调用 确定没有对对象的更多引用。

final Class<?> getClass()

返回此 Object 的运行时类。

int hashCode()

返回对象的哈希代码值。

final void notify()

唤醒正在等待此对象的 监控。

final void notifyAll()

唤醒正在等待此对象的监控器的所有线程。

String toString()

返回对象的字符串表示。

final void wait(long timeoutMillis, int nanos)

导致当前线程处于等待状态,直到其被唤醒,这通常是 通知中断,或者直到 经过了一定量的实时。

final void wait(long timeoutMillis)

导致当前线程处于等待状态,直到其被唤醒,这通常是 通知中断,或者直到 经过了一定量的实时。

final void wait()

导致当前线程处于等待状态,直到其被唤醒,这通常是 通知中断

abstract int describeContents()

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

abstract 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 一个位掩码,表示编组的特殊对象类型集 。 值为 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 的组合