# UpdateFetchOutcome

Artifact: [androidx.security:security-state-provider](https://developer.android.com/jetpack/androidx/releases/security) [View Source](https://cs.android.com/search?q=file:androidx/security/state/provider/UpdateFetchOutcome.kt+class:androidx.security.state.provider.UpdateFetchOutcome) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/security#1.0.0)

*** ** * ** ***


```
object UpdateFetchOutcome
```

<br />

*** ** * ** ***

Represents the detailed outcome of an update check request.

This class defines constants describing *how* a request to `listAvailableUpdates` was satisfied. It is used primarily for telemetry and monitoring, allowing host applications to distinguish between requests served from the local cache, requests that triggered a network fetch, and requests that were throttled or failed.

Host applications receive this outcome in the `https://developer.android.com/reference/kotlin/androidx/security/state/provider/UpdateCheckTelemetry` object passed to `https://developer.android.com/reference/kotlin/androidx/security/state/provider/UpdateInfoService#onRequestCompleted(androidx.security.state.provider.UpdateCheckTelemetry)`.

## Summary

| ### Nested types |
|---|
| `@https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.annotation/-retention/index.html(value = https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.annotation/-annotation-retention/-s-o-u-r-c-e/index.html) @https://developer.android.com/reference/kotlin/androidx/annotation/IntDef(value = [1, 3, 4, 2, 5]) annotation https://developer.android.com/reference/kotlin/androidx/security/state/provider/UpdateFetchOutcome.Code` |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/security/state/provider/UpdateFetchOutcome#CACHE_HIT() = 1` The request was satisfied immediately from the local cache. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/security/state/provider/UpdateFetchOutcome#COALESCED() = 2` The request was satisfied from the local cache after waiting for another thread to complete a network fetch. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/security/state/provider/UpdateFetchOutcome#FAILED() = 5` The operation failed with an exception. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/security/state/provider/UpdateFetchOutcome#FETCHED() = 3` A network fetch was performed and fresh data was returned. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/security/state/provider/UpdateFetchOutcome#THROTTLED() = 4` The request was blocked by the rate limiter. |

## Constants

### CACHE_HIT

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

```
const val CACHE_HIT = 1: Int
```

The request was satisfied immediately from the local cache.

This outcome occurs when the cached data is considered fresh (e.g., it was last updated within the freshness threshold) and no network locks needed to be acquired. This represents the "Fast Path" for the service.

### COALESCED

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

```
const val COALESCED = 2: Int
```

The request was satisfied from the local cache after waiting for another thread to complete a network fetch.

This outcome occurs when multiple clients request updates simultaneously (a "thundering herd"). The current thread waited for the `fetchUpdates` lock, and by the time it acquired the lock, another thread had already refreshed the cache. This is considered a "Slow Path" outcome due to the lock wait time, even though no network call was made by this specific thread.

### FAILED

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

```
const val FAILED = 5: Int
```

The operation failed with an exception.

This outcome occurs if an unhandled exception was thrown during any part of the update check lifecycle (e.g., network failure, disk I/O error, or rate limiter error). The service returned cached data to the client to prevent the crash from propagating.

### FETCHED

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

```
const val FETCHED = 3: Int
```

A network fetch was performed and fresh data was returned.

This outcome occurs when the cache was stale, the rate limiter allowed the request, and the `https://developer.android.com/reference/kotlin/androidx/security/state/provider/UpdateInfoService#fetchUpdates()` implementation successfully retrieved new data from the backend. This represents the "Slow Path" for the service.

### THROTTLED

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

```
const val THROTTLED = 4: Int
```

The request was blocked by the rate limiter.

This outcome occurs when the cache was stale, but the rate limiter determined that a network fetch should not be attempted (e.g., because a check was performed too recently). The service returned cached data to the client to ensure graceful degradation.