RetryPolicy.RetryConfig


@ExperimentalRetryPolicy
class RetryPolicy.RetryConfig


Represents the outcome of a RetryPolicy decision.

Summary

Nested types

A builder class for creating and customizing RetryConfig objects.

Constants

const RetryPolicy.RetryConfig

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

const RetryPolicy.RetryConfig

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

const RetryPolicy.RetryConfig

A RetryConfig indicating that no further retries should be attempted.

Public functions

java-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
const val DEFAULT_DELAY_RETRYRetryPolicy.RetryConfig

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
const val MINI_DELAY_RETRYRetryPolicy.RetryConfig

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
const val NOT_RETRYRetryPolicy.RetryConfig

A RetryConfig indicating that no further retries should be attempted.

Public functions

getDefaultRetryDelayInMillis

Added in 1.4.0
java-static fun getDefaultRetryDelayInMillis(): Long

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
fun getRetryDelayInMillis(): Long

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
fun shouldRetry(): Boolean

Determines whether the initialization should be retried.

Returns
Boolean

true if the initialization should be retried, false otherwise.