# AdSelectionManagerFutures

Artifact: [androidx.privacysandbox.ads:ads-adservices-java](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads) [View Source](https://cs.android.com/search?q=file:androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFutures.kt+class:androidx.privacysandbox.ads.adservices.java.adselection.AdSelectionManagerFutures) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.0.0)

*** ** * ** ***

<br />

```
public abstract class AdSelectionManagerFutures
```

<br />

*** ** * ** ***

This class provides APIs to select ads and report impressions. This class can be used by Java clients.

## Summary

| ### Public methods |
|---|---|
| `static final https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFutures` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFutures#from(android.content.Context)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context)` Creates `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFutures`. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/GetAdSelectionDataOutcome>` | `@https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/ExperimentalFeatures.Ext10OptIn @https://developer.android.com/reference/androidx/annotation/RequiresPermission(value = "android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE") https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFutures#getAdSelectionDataAsync(androidx.privacysandbox.ads.adservices.adselection.GetAdSelectionDataRequest)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/GetAdSelectionDataRequest getAdSelectionDataRequest )` Collects custom audience data from device. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/AdSelectionOutcome>` | `@https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/ExperimentalFeatures.Ext10OptIn @https://developer.android.com/reference/androidx/annotation/RequiresPermission(value = "android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE") https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFutures#persistAdSelectionResultAsync(androidx.privacysandbox.ads.adservices.adselection.PersistAdSelectionResultRequest)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/PersistAdSelectionResultRequest persistAdSelectionResultRequest )` Persists the ad selection results from the server-side. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html>` | `@https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/ExperimentalFeatures.Ext8OptIn @https://developer.android.com/reference/androidx/annotation/RequiresPermission(value = "android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE") https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFutures#reportEventAsync(androidx.privacysandbox.ads.adservices.adselection.ReportEventRequest)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/ReportEventRequest reportEventRequest)` Notifies the service that there is a new ad event to report for the ad selected by the ad-selection run identified by {@code adSelectionId}. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html>` | `@https://developer.android.com/reference/androidx/annotation/RequiresPermission(value = "android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE") https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFutures#reportImpressionAsync(androidx.privacysandbox.ads.adservices.adselection.ReportImpressionRequest)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/ReportImpressionRequest reportImpressionRequest )` Report the given impression. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/AdSelectionOutcome>` | `@https://developer.android.com/reference/androidx/annotation/RequiresPermission(value = "android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE") https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFutures#selectAdsAsync(androidx.privacysandbox.ads.adservices.adselection.AdSelectionConfig)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/AdSelectionConfig adSelectionConfig)` Runs the ad selection process on device to select a remarketing ad for the caller application. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/AdSelectionOutcome>` | `@https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/ExperimentalFeatures.Ext10OptIn @https://developer.android.com/reference/androidx/annotation/RequiresPermission(value = "android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE") https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFutures#selectAdsAsync(androidx.privacysandbox.ads.adservices.adselection.AdSelectionFromOutcomesConfig)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/AdSelectionFromOutcomesConfig adSelectionFromOutcomesConfig )` Selects an ad from the results of previously ran ad selections. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html>` | `@https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/ExperimentalFeatures.Ext8OptIn @https://developer.android.com/reference/androidx/annotation/RequiresPermission(value = "android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE") https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFutures#updateAdCounterHistogramAsync(androidx.privacysandbox.ads.adservices.adselection.UpdateAdCounterHistogramRequest)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/UpdateAdCounterHistogramRequest updateAdCounterHistogramRequest )` Updates the counter histograms for an ad which was previously selected by a call to `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFutures#selectAdsAsync(androidx.privacysandbox.ads.adservices.adselection.AdSelectionConfig)`. |

## Public methods

### from

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.0.0)

```
public static final AdSelectionManagerFutures from(@NonNull Context context)
```

Creates `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFutures`.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFutures` | AdSelectionManagerFutures object. If the device is running an incompatible build, the value returned is null. |

### getAdSelectionDataAsync

Added in [1.1.0-beta12](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.1.0-beta12)

```
@ExperimentalFeatures.Ext10OptIn
@RequiresPermission(value = "android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE")
public abstract @NonNull ListenableFuture<@NonNull GetAdSelectionDataOutcome> getAdSelectionDataAsync(
    @NonNull GetAdSelectionDataRequest getAdSelectionDataRequest
)
```

Collects custom audience data from device. Returns a compressed and encrypted blob to send to auction servers for ad selection.

Custom audience ads must have a {@code ad_render_id} to be eligible for to be collected.

See AdSelectionManager#persistAdSelectionResult for how to process the results of the ad selection run on server-side with the blob generated by this API.

The output is passed by the receiver, which either returns an `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/GetAdSelectionDataOutcome` for a successful run, or an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-exception/index.html` includes the type of the exception thrown and the corresponding error message.

If the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` is thrown, it is caused by invalid input argument the API received to run the ad selection.

If the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` is thrown with error message "Failure of AdSelection services.", it is caused by an internal failure of the ad selection service.

If the `https://developer.android.com/reference/java/util/concurrent/TimeoutException.html` is thrown, it is caused when a timeout is encountered during bidding, scoring, or overall selection process to find winning Ad.

If the `https://developer.android.com/reference/android/os/LimitExceededException.html` is thrown, it is caused when the calling package exceeds the allowed rate limits and is throttled.

If the `https://developer.android.com/reference/java/lang/SecurityException.html` is thrown, it is caused when the caller is not authorized or permission is not requested.

If the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html` is thrown, it is caused when the Android API level and AdServices module versions don't support this API.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/GetAdSelectionDataRequest getAdSelectionDataRequest` | the request for get ad selection data. |

### persistAdSelectionResultAsync

Added in [1.1.0-beta12](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.1.0-beta12)

```
@ExperimentalFeatures.Ext10OptIn
@RequiresPermission(value = "android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE")
public abstract @NonNull ListenableFuture<@NonNull AdSelectionOutcome> persistAdSelectionResultAsync(
    @NonNull PersistAdSelectionResultRequest persistAdSelectionResultRequest
)
```

Persists the ad selection results from the server-side.

See AdSelectionManager#getAdSelectionData for how to generate an encrypted blob to run an ad selection on the server side.

The output is passed by the receiver, which either returns an `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/AdSelectionOutcome` for a successful run, or an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-exception/index.html` includes the type of the exception thrown and the corresponding error message.

If the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` is thrown, it is caused by invalid input argument the API received to run the ad selection.

If the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` is thrown with error message "Failure of AdSelection services.", it is caused by an internal failure of the ad selection service.

If the `https://developer.android.com/reference/java/util/concurrent/TimeoutException.html` is thrown, it is caused when a timeout is encountered during bidding, scoring, or overall selection process to find winning Ad.

If the `https://developer.android.com/reference/android/os/LimitExceededException.html` is thrown, it is caused when the calling package exceeds the allowed rate limits and is throttled.

If the `https://developer.android.com/reference/java/lang/SecurityException.html` is thrown, it is caused when the caller is not authorized or permission is not requested.

If the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html` is thrown, it is caused when the Android API level and AdServices module versions don't support this API.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/PersistAdSelectionResultRequest persistAdSelectionResultRequest` | the request for persist ad selection result. |

### reportEventAsync

Added in [1.1.0-beta12](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.1.0-beta12)

```
@ExperimentalFeatures.Ext8OptIn
@RequiresPermission(value = "android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE")
public abstract @NonNull ListenableFuture<Unit> reportEventAsync(@NonNull ReportEventRequest reportEventRequest)
```

Notifies the service that there is a new ad event to report for the ad selected by the ad-selection run identified by {@code adSelectionId}. An ad event is any occurrence that happens to an ad associated with the given {@code adSelectionId}. There is no guarantee about when the ad event will be reported. The event reporting could be delayed and reports could be batched.

Using ReportEventRequest#getKey(), the service will fetch the {@code reportingUri} that was registered in {@code registerAdBeacon}. See documentation of `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFutures#reportImpressionAsync(androidx.privacysandbox.ads.adservices.adselection.ReportImpressionRequest)` for more details regarding {@code registerAdBeacon}. Then, the service will attach ReportEventRequest#getData() to the request body of a POST request and send the request. The body of the POST request will have the {@code content-type} of {@code text/plain}, and the data will be transmitted in {@code charset=UTF-8}.

The output is passed by the receiver, which either returns an empty `https://developer.android.com/reference/java/lang/Object.html` for a successful run, or an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-exception/index.html` includes the type of the exception thrown and the corresponding error message.

If the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` is thrown, it is caused by invalid input argument the API received to report the ad event.

If the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` is thrown with error message "Failure of AdSelection services.", it is caused by an internal failure of the ad selection service.

If the `https://developer.android.com/reference/android/os/LimitExceededException.html` is thrown, it is caused when the calling package exceeds the allowed rate limits and is throttled.

If the `https://developer.android.com/reference/java/lang/SecurityException.html` is thrown, it is caused when the caller is not authorized or permission is not requested.

If the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html` is thrown, it is caused when the Android API level and AdServices module versions don't support this API.

Events will be reported at most once as a best-effort attempt.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/ReportEventRequest reportEventRequest` | the request for reporting event. |

### reportImpressionAsync

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.0.0)

```
@RequiresPermission(value = "android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE")
public abstract @NonNull ListenableFuture<Unit> reportImpressionAsync(
    @NonNull ReportImpressionRequest reportImpressionRequest
)
```

Report the given impression. The `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/ReportImpressionRequest` is provided by the Ads SDK. The receiver either returns a {@code void} for a successful run, or an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-exception/index.html` indicates the error.

If the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` is thrown, it is caused by invalid input argument the API received to report the impression.

If the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` is thrown with error message "Failure of AdSelection services.", it is caused by an internal failure of the ad selection service.

If the `https://developer.android.com/reference/android/os/LimitExceededException.html` is thrown, it is caused when the calling package exceeds the allowed rate limits and is throttled.

If the `https://developer.android.com/reference/java/lang/SecurityException.html` is thrown, it is caused when the caller is not authorized or permission is not requested.

If the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html` is thrown, it is caused when the Android API level and AdServices module versions don't support `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/ReportImpressionRequest` with null {@code AdSelectionConfig}

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/ReportImpressionRequest reportImpressionRequest` | the request for reporting impression. |

### selectAdsAsync

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.0.0)

```
@RequiresPermission(value = "android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE")
public abstract @NonNull ListenableFuture<@NonNull AdSelectionOutcome> selectAdsAsync(@NonNull AdSelectionConfig adSelectionConfig)
```

Runs the ad selection process on device to select a remarketing ad for the caller application.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/AdSelectionConfig adSelectionConfig` | the config The input {@code adSelectionConfig} is provided by the Ads SDK and the `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/AdSelectionConfig` object is transferred via a Binder call. For this reason, the total size of these objects is bound to the Android IPC limitations. Failures to transfer the `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/AdSelectionConfig` will throws an `https://developer.android.com/reference/android/os/TransactionTooLargeException.html`. The output is passed by the receiver, which either returns an `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/AdSelectionOutcome` for a successful run, or an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-exception/index.html` includes the type of the exception thrown and the corresponding error message. If the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` is thrown, it is caused by invalid input argument the API received to run the ad selection. If the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` is thrown with error message "Failure of AdSelection services.", it is caused by an internal failure of the ad selection service. If the `https://developer.android.com/reference/java/util/concurrent/TimeoutException.html` is thrown, it is caused when a timeout is encountered during bidding, scoring, or overall selection process to find winning Ad. If the `https://developer.android.com/reference/android/os/LimitExceededException.html` is thrown, it is caused when the calling package exceeds the allowed rate limits and is throttled. |

### selectAdsAsync

Added in [1.1.0-beta12](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.1.0-beta12)

```
@ExperimentalFeatures.Ext10OptIn
@RequiresPermission(value = "android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE")
public abstract @NonNull ListenableFuture<@NonNull AdSelectionOutcome> selectAdsAsync(
    @NonNull AdSelectionFromOutcomesConfig adSelectionFromOutcomesConfig
)
```

Selects an ad from the results of previously ran ad selections.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/AdSelectionFromOutcomesConfig adSelectionFromOutcomesConfig` | is provided by the Ads SDK and the `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/AdSelectionFromOutcomesConfig` object is transferred via a Binder call. For this reason, the total size of these objects is bound to the Android IPC limitations. Failures to transfer the `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/AdSelectionFromOutcomesConfig` will throw an `https://developer.android.com/reference/android/os/TransactionTooLargeException.html`. The output is passed by the receiver, which either returns an `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/AdSelectionOutcome` for a successful run, or an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-exception/index.html` includes the type of the exception thrown and the corresponding error message. If the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` is thrown, it is caused by invalid input argument the API received to run the ad selection. If the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` is thrown with error message "Failure of AdSelection services.", it is caused by an internal failure of the ad selection service. If the `https://developer.android.com/reference/java/util/concurrent/TimeoutException.html` is thrown, it is caused when a timeout is encountered during bidding, scoring, or overall selection process to find winning Ad. If the `https://developer.android.com/reference/android/os/LimitExceededException.html` is thrown, it is caused when the calling package exceeds the allowed rate limits and is throttled. If the `https://developer.android.com/reference/java/lang/SecurityException.html` is thrown, it is caused when the caller is not authorized or permission is not requested. If the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html` is thrown, it is caused when the Android API level and AdServices module versions don't support this API. |

### updateAdCounterHistogramAsync

Added in [1.1.0-beta12](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.1.0-beta12)

```
@ExperimentalFeatures.Ext8OptIn
@RequiresPermission(value = "android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE")
public abstract @NonNull ListenableFuture<Unit> updateAdCounterHistogramAsync(
    @NonNull UpdateAdCounterHistogramRequest updateAdCounterHistogramRequest
)
```

Updates the counter histograms for an ad which was previously selected by a call to `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/java/adselection/AdSelectionManagerFutures#selectAdsAsync(androidx.privacysandbox.ads.adservices.adselection.AdSelectionConfig)`.

The counter histograms are used in ad selection to inform frequency cap filtering on candidate ads, where ads whose frequency caps are met or exceeded are removed from the bidding process during ad selection.

Counter histograms can only be updated for ads specified by the given {@code adSelectionId} returned by a recent call to Protected Audience API ad selection from the same caller app.

A `https://developer.android.com/reference/java/lang/SecurityException.html` is returned if:

1. the app has not declared the correct permissions in its manifest, or
2. the app or entity identified by the {@code callerAdTechIdentifier} are not authorized to use the API.

An `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` is returned if the call does not come from an app with a foreground activity.

A `https://developer.android.com/reference/android/os/LimitExceededException.html` is returned if the call exceeds the calling app's API throttle.

An `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html` is returned if the Android API level and AdServices module versions don't support this API.

In all other failure cases, it will return an empty `https://developer.android.com/reference/java/lang/Object.html`. Note that to protect user privacy, internal errors will not be sent back via an exception.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adselection/UpdateAdCounterHistogramRequest updateAdCounterHistogramRequest` | the request for updating the ad counter histogram. |