RetryPolicy.RetryConfig


@ExperimentalRetryPolicy
public final class RetryPolicy.RetryConfig


Represents the outcome of a RetryPolicy decision.

Summary

Nested types

A builder class for creating and customizing RetryConfig objects.

Constants

static final @NonNull RetryPolicy.RetryConfig

A RetryConfig indicating that the initialization should be retried after the default delay (determined by getDefaultRetryDelayInMillis).

static final @NonNull RetryPolicy.RetryConfig

A RetryConfig indicating that the initialization should be retried after a minimum delay of 100 milliseconds.

static final @NonNull RetryPolicy.RetryConfig

A RetryConfig indicating that no further retries should be attempted.

Public methods

static long

Returns the recommended default delay to optimize retry attempts and camera recovery.

long

Gets the delay time in milliseconds before the next retry attempt should be made.

boolean

Determines whether the initialization should be retried.

Constants

DEFAULT_DELAY_RETRY

Added in 1.4.0-alpha05
public static final @NonNull RetryPolicy.RetryConfig DEFAULT_DELAY_RETRY

A RetryConfig indicating that the initialization should be retried after the default delay (determined by getDefaultRetryDelayInMillis). This delay provides sufficient time for typical device recovery processes, balancing retry efficiency and minimizing user wait time.

MINI_DELAY_RETRY

Added in 1.4.0-alpha05
public static final @NonNull RetryPolicy.RetryConfig MINI_DELAY_RETRY

A RetryConfig indicating that the initialization should be retried after a minimum delay of 100 milliseconds. This short delay serves two purposes:

  • Reduced Latency: Minimizes the wait time for the camera to become available, improving user experience.
  • Camera Self-Recovery: Provides a brief window for the camera to potentially recover from temporary issues.
This approach balances quick retries with potential self-recovery, aiming for the fastest possible camera restoration.

NOT_RETRY

Added in 1.4.0-alpha05
public static final @NonNull RetryPolicy.RetryConfig NOT_RETRY

A RetryConfig indicating that no further retries should be attempted.

Public methods

getDefaultRetryDelayInMillis

Added in 1.4.0-alpha05
public static long getDefaultRetryDelayInMillis()

Returns the recommended default delay to optimize retry attempts and camera recovery.

Returns
long

The default delay value, carefully calibrated based on extensive lab testing to:

  • Provide sufficient time for typical device recovery processes in common bad camera states.
  • Strike an optimal balance between minimizing latency and avoiding excessive retries, ensuring efficient camera initialization without unnecessary overhead.
This value represents the generally recommended delay for most scenarios, striking a balance between providing adequate time for camera recovery and maintaining a smooth user experience.

getRetryDelayInMillis

Added in 1.4.0-alpha05
public long getRetryDelayInMillis()

Gets the delay time in milliseconds before the next retry attempt should be made.

Returns
long

The delay time in milliseconds.

shouldRetry

Added in 1.4.0-alpha05
public boolean shouldRetry()

Determines whether the initialization should be retried.

Returns
boolean

true if the initialization should be retried, false otherwise.