已在 API 级别 34 中引入
也已在广告服务扩展 4 中引入

TestAdSelectionManager

public class TestAdSelectionManager
extends Object

java.lang.Object
   ↳ android.adservices.adselection.TestAdSelectionManager


TestAdSelectionManager 为应用和广告 SDK 提供用于测试广告选择流程的 API。

这些 API 旨在用于端到端测试。只有 搭载可调试 OS build 且启用了开发者选项的手机上的可调试应用。

摘要

公共方法

void overrideAdSelectionConfigRemoteInfo(AddAdSelectionOverrideRequest request, Executor executor, OutcomeReceiver<ObjectException> receiver)

替换给定 AdSelectionConfig 的 AdSelection API,以避免提取数据 并使用 AddAdSelectionOverrideRequest 中提供的数据 。

void overrideAdSelectionFromOutcomesConfigRemoteInfo(AddAdSelectionFromOutcomesOverrideRequest request, Executor executor, OutcomeReceiver<ObjectException> receiver)

替换 AdSelectionFromOutcomesConfig 的 AdSelection API,以避免提取 并改用 AddAdSelectionFromOutcomesOverrideRequest 中提供的数据。

void removeAdSelectionConfigRemoteInfoOverride(RemoveAdSelectionOverrideRequest request, Executor executor, OutcomeReceiver<ObjectException> receiver)

删除 Ad Selection API 中的 AdSelectionConfigRemoveAdSelectionOverrideRequest 中的数据。

void removeAdSelectionFromOutcomesConfigRemoteInfoOverride(RemoveAdSelectionFromOutcomesOverrideRequest request, Executor executor, OutcomeReceiver<ObjectException> receiver)

从 Ad Selection API 移除 AdSelectionFromOutcomesConfig 的替换项,值为 关联了 RemoveAdSelectionOverrideRequest 中的数据。

void resetAllAdSelectionConfigRemoteOverrides(Executor executor, OutcomeReceiver<ObjectException> receiver)

移除 Ad Selection API 中 AdSelectionConfig 的所有替换数据。

void resetAllAdSelectionFromOutcomesConfigRemoteOverrides(Executor executor, OutcomeReceiver<ObjectException> receiver)

移除 Ad Selection API 中 AdSelectionFromOutcomesConfig 的所有替换数据。

继承的方法

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()

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

公共方法

OverrideAdSelectionConfigRemoteInfo

已在 API 级别 34 中引入
也已在广告服务扩展 4 中引入
public void overrideAdSelectionConfigRemoteInfo (AddAdSelectionOverrideRequest request, 
                Executor executor, 
                OutcomeReceiver<ObjectException> receiver)

替换给定 AdSelectionConfig 的 AdSelection API,以避免提取数据 并使用 AddAdSelectionOverrideRequest 中提供的数据 。AddAdSelectionOverrideRequest 由广告 SDK 提供。

此方法旨在用于端到端测试。此 API 仅对 启用开发者选项的调试模式应用。
需要 AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE

参数
request AddAdSelectionOverrideRequest:此值不能为 null

executor Executor:此值不能为 null。 回调和监听器事件通过此 Executor,可让您轻松控制要 。要通过 可以使用 Context.getMainExecutor()。 否则,请提供分派给相应线程的 Executor

receiver OutcomeReceiver:此值不能为 null

抛出
IllegalStateException 如果没有为调用方启用此 API

接收器会返回 void 表示运行成功,或者 Exception 指示错误。

覆盖 AdSelectionFromOutcomesConfigRemoteInfo

public void overrideAdSelectionFromOutcomesConfigRemoteInfo (AddAdSelectionFromOutcomesOverrideRequest request, 
                Executor executor, 
                OutcomeReceiver<ObjectException> receiver)

替换 AdSelectionFromOutcomesConfig 的 AdSelection API,以避免提取 并改用 AddAdSelectionFromOutcomesOverrideRequest 中提供的数据。AddAdSelectionFromOutcomesOverrideRequest 由广告 SDK 提供。

此方法旨在用于端到端测试。此 API 仅对 启用开发者选项的调试模式应用。
需要 AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE

参数
request AddAdSelectionFromOutcomesOverrideRequest:此值不能为 null

executor Executor:此值不能为 null。 回调和监听器事件通过此 Executor,可让您轻松控制要 。要通过 可以使用 Context.getMainExecutor()。 否则,请提供分派给相应线程的 Executor

receiver OutcomeReceiver:此值不能为 null

抛出
IllegalStateException 如果没有为调用方启用此 API

接收器会返回 void 表示运行成功,或者 Exception 指示错误。

removeAdSelectionConfigRemoteInfoOverride

已在 API 级别 34 中引入
也已在广告服务扩展 4 中引入
public void removeAdSelectionConfigRemoteInfoOverride (RemoveAdSelectionOverrideRequest request, 
                Executor executor, 
                OutcomeReceiver<ObjectException> receiver)

删除 Ad Selection API 中的 AdSelectionConfigRemoveAdSelectionOverrideRequest 中的数据。RemoveAdSelectionOverrideRequest 由广告 SDK 提供。

此方法旨在用于端到端测试。此 API 仅对 启用开发者选项的调试模式应用。
需要 AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE

参数
request RemoveAdSelectionOverrideRequest:此值不能为 null

executor Executor:此值不能为 null。 回调和监听器事件通过此 Executor,可让您轻松控制要 。要通过 可以使用 Context.getMainExecutor()。 否则,请提供分派给相应线程的 Executor

receiver OutcomeReceiver:此值不能为 null

抛出
IllegalStateException 如果没有为调用方启用此 API

接收器会返回 void 表示运行成功,或者 Exception 指示错误。

removeAdSelectionFromOutcomesConfigRemoteInfoOverride

public void removeAdSelectionFromOutcomesConfigRemoteInfoOverride (RemoveAdSelectionFromOutcomesOverrideRequest request, 
                Executor executor, 
                OutcomeReceiver<ObjectException> receiver)

从 Ad Selection API 移除 AdSelectionFromOutcomesConfig 的替换项,值为 关联了 RemoveAdSelectionOverrideRequest 中的数据。RemoveAdSelectionOverrideRequest 由广告 SDK 提供。

此方法旨在用于端到端测试。此 API 仅对 启用开发者选项的调试模式应用。
需要 AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE

参数
request RemoveAdSelectionFromOutcomesOverrideRequest:此值不能为 null

executor Executor:此值不能为 null。 回调和监听器事件通过此 Executor,可让您轻松控制要 。要通过 可以使用 Context.getMainExecutor()。 否则,请提供分派给相应线程的 Executor

receiver OutcomeReceiver:此值不能为 null

抛出
IllegalStateException 如果没有为调用方启用此 API

接收器会返回 void 表示运行成功,或者 Exception 指示错误。

resetAllAdSelectionConfigRemoteOverrides

已在 API 级别 34 中引入
也已在广告服务扩展 4 中引入
public void resetAllAdSelectionConfigRemoteOverrides (Executor executor, 
                OutcomeReceiver<ObjectException> receiver)

移除 Ad Selection API 中 AdSelectionConfig 的所有替换数据。

此方法旨在用于端到端测试。此 API 仅对 启用开发者选项的调试模式应用。
需要 AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE

参数
executor Executor:此值不能为 null。 回调和监听器事件通过此 Executor,可让您轻松控制要 。要通过 可以使用 Context.getMainExecutor()。 否则,请提供分派给相应线程的 Executor

receiver OutcomeReceiver:此值不能为 null

抛出
IllegalStateException 如果没有为调用方启用此 API

接收器会返回 void 表示运行成功,或者 Exception 指示错误。

resetAllAdSelectionFromOutcomesConfigRemoteOverrides

public void resetAllAdSelectionFromOutcomesConfigRemoteOverrides (Executor executor, 
                OutcomeReceiver<ObjectException> receiver)

移除 Ad Selection API 中 AdSelectionFromOutcomesConfig 的所有替换数据。

此方法旨在用于端到端测试。此 API 仅对 启用开发者选项的调试模式应用。
需要 AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE

参数
executor Executor:此值不能为 null。 回调和监听器事件通过此 Executor,可让您轻松控制要 。要通过 可以使用 Context.getMainExecutor()。 否则,请提供分派给相应线程的 Executor

receiver OutcomeReceiver:此值不能为 null

抛出
IllegalStateException 如果没有为调用方启用此 API

接收器会返回 void 表示运行成功,或者 Exception 指示错误。