TestAdSelectionManager


public class TestAdSelectionManager
extends Object

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


TestAdSelectionManager provides APIs for apps and ad SDKs to test ad selection processes.

These APIs are intended to be used for end-to-end testing. They are enabled only for debuggable apps on phones running a debuggable OS build with developer options enabled.

Summary

Public methods

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

Overrides the AdSelection API for a given AdSelectionConfig to avoid fetching data from remote servers and use the data provided in AddAdSelectionOverrideRequest instead.

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

Overrides the AdSelection API for AdSelectionFromOutcomesConfig to avoid fetching data from remote servers and use the data provided in AddAdSelectionFromOutcomesOverrideRequest instead.

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

Removes an override for AdSelectionConfig in the Ad Selection API with associated the data in RemoveAdSelectionOverrideRequest.

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

Removes an override for AdSelectionFromOutcomesConfig in th Ad Selection API with associated the data in RemoveAdSelectionOverrideRequest.

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

Removes all override data for AdSelectionConfig in the Ad Selection API.

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

Removes all override data for AdSelectionFromOutcomesConfig in the Ad Selection API.

Inherited methods

Public methods

overrideAdSelectionConfigRemoteInfo

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

Overrides the AdSelection API for a given AdSelectionConfig to avoid fetching data from remote servers and use the data provided in AddAdSelectionOverrideRequest instead. The AddAdSelectionOverrideRequest is provided by the Ads SDK.

This method is intended to be used for end-to-end testing. This API is enabled only for apps in debug mode with developer options enabled.
Requires AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE or AdServicesPermissions.ACCESS_ADSERVICES_PROTECTED_SIGNALS or AdServicesPermissions.ACCESS_ADSERVICES_AD_SELECTION

Parameters
request AddAdSelectionOverrideRequest: This value cannot be null.

executor Executor: This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.

receiver OutcomeReceiver: This value cannot be null.

Throws
IllegalStateException if this API is not enabled for the caller

The receiver either returns a void for a successful run, or an Exception indicates the error.

overrideAdSelectionFromOutcomesConfigRemoteInfo

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

Overrides the AdSelection API for AdSelectionFromOutcomesConfig to avoid fetching data from remote servers and use the data provided in AddAdSelectionFromOutcomesOverrideRequest instead. The AddAdSelectionFromOutcomesOverrideRequest is provided by the Ads SDK.

This method is intended to be used for end-to-end testing. This API is enabled only for apps in debug mode with developer options enabled.
Requires AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE or AdServicesPermissions.ACCESS_ADSERVICES_PROTECTED_SIGNALS or AdServicesPermissions.ACCESS_ADSERVICES_AD_SELECTION

Parameters
request AddAdSelectionFromOutcomesOverrideRequest: This value cannot be null.

executor Executor: This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.

receiver OutcomeReceiver: This value cannot be null.

Throws
IllegalStateException if this API is not enabled for the caller

The receiver either returns a void for a successful run, or an Exception indicates the error.

removeAdSelectionConfigRemoteInfoOverride

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

Removes an override for AdSelectionConfig in the Ad Selection API with associated the data in RemoveAdSelectionOverrideRequest. The RemoveAdSelectionOverrideRequest is provided by the Ads SDK.

This method is intended to be used for end-to-end testing. This API is enabled only for apps in debug mode with developer options enabled.
Requires AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE or AdServicesPermissions.ACCESS_ADSERVICES_PROTECTED_SIGNALS or AdServicesPermissions.ACCESS_ADSERVICES_AD_SELECTION

Parameters
request RemoveAdSelectionOverrideRequest: This value cannot be null.

executor Executor: This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.

receiver OutcomeReceiver: This value cannot be null.

Throws
IllegalStateException if this API is not enabled for the caller

The receiver either returns a void for a successful run, or an Exception indicates the error.

removeAdSelectionFromOutcomesConfigRemoteInfoOverride

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

Removes an override for AdSelectionFromOutcomesConfig in th Ad Selection API with associated the data in RemoveAdSelectionOverrideRequest. The RemoveAdSelectionOverrideRequest is provided by the Ads SDK.

This method is intended to be used for end-to-end testing. This API is enabled only for apps in debug mode with developer options enabled.
Requires AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE or AdServicesPermissions.ACCESS_ADSERVICES_PROTECTED_SIGNALS or AdServicesPermissions.ACCESS_ADSERVICES_AD_SELECTION

Parameters
request RemoveAdSelectionFromOutcomesOverrideRequest: This value cannot be null.

executor Executor: This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.

receiver OutcomeReceiver: This value cannot be null.

Throws
IllegalStateException if this API is not enabled for the caller

The receiver either returns a void for a successful run, or an Exception indicates the error.

resetAllAdSelectionConfigRemoteOverrides

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

Removes all override data for AdSelectionConfig in the Ad Selection API.

This method is intended to be used for end-to-end testing. This API is enabled only for apps in debug mode with developer options enabled.
Requires AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE or AdServicesPermissions.ACCESS_ADSERVICES_PROTECTED_SIGNALS or AdServicesPermissions.ACCESS_ADSERVICES_AD_SELECTION

Parameters
executor Executor: This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.

receiver OutcomeReceiver: This value cannot be null.

Throws
IllegalStateException if this API is not enabled for the caller

The receiver either returns a void for a successful run, or an Exception indicates the error.

resetAllAdSelectionFromOutcomesConfigRemoteOverrides

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

Removes all override data for AdSelectionFromOutcomesConfig in the Ad Selection API.

This method is intended to be used for end-to-end testing. This API is enabled only for apps in debug mode with developer options enabled.
Requires AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE or AdServicesPermissions.ACCESS_ADSERVICES_PROTECTED_SIGNALS or AdServicesPermissions.ACCESS_ADSERVICES_AD_SELECTION

Parameters
executor Executor: This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.

receiver OutcomeReceiver: This value cannot be null.

Throws
IllegalStateException if this API is not enabled for the caller

The receiver either returns a void for a successful run, or an Exception indicates the error.