public static class UpdateFetchOutcome


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 UpdateCheckTelemetry object passed to UpdateInfoService.onRequestCompleted.

Summary

Nested types

@Retention(value = AnnotationRetention.SOURCE)
@IntDef(value = [1, 3, 4, 2, 5])
public annotation UpdateFetchOutcome.Code

Constants

static final int

The request was satisfied immediately from the local cache.

static final int

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

static final int
FAILED = 5

The operation failed with an exception.

static final int

A network fetch was performed and fresh data was returned.

static final int

The request was blocked by the rate limiter.

Public fields

static @NonNull UpdateFetchOutcome

Constants

CACHE_HIT

Added in 1.0.0-alpha02
public static final int CACHE_HIT = 1

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-alpha02
public static final int COALESCED = 2

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-alpha02
public static final int FAILED = 5

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-alpha02
public static final int FETCHED = 3

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 UpdateInfoService.fetchUpdates implementation successfully retrieved new data from the backend. This represents the "Slow Path" for the service.

THROTTLED

Added in 1.0.0-alpha02
public static final int THROTTLED = 4

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.

Public fields

INSTANCE

Added in 1.0.0-alpha02
public static @NonNull UpdateFetchOutcome INSTANCE