public final class

RetryPolicy.RetryConfig

extends java.lang.Object

 java.lang.Object

↳androidx.camera.core.RetryPolicy.RetryConfig

Overview

Represents the outcome of a RetryPolicy decision.

Summary

Fields
public static RetryPolicy.RetryConfigCOMPLETE_WITHOUT_FAILURE

A RetryConfig indicating that the initialization should be considered complete without retrying.

public static final RetryPolicy.RetryConfigDEFAULT_DELAY_RETRY

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

public static final RetryPolicy.RetryConfigMINI_DELAY_RETRY

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

public static final RetryPolicy.RetryConfigNOT_RETRY

A RetryConfig indicating that no further retries should be attempted.

Methods
public static longgetDefaultRetryDelayInMillis()

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

public longgetRetryDelayInMillis()

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

public booleanshouldCompleteWithoutFailure()

Signals to treat initialization errors as successful for legacy behavior compatibility.

public booleanshouldRetry()

Determines whether the initialization should be retried.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Fields

public static final RetryPolicy.RetryConfig NOT_RETRY

A RetryConfig indicating that no further retries should be attempted.

public static final RetryPolicy.RetryConfig DEFAULT_DELAY_RETRY

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

public static final 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.

public static RetryPolicy.RetryConfig COMPLETE_WITHOUT_FAILURE

A RetryConfig indicating that the initialization should be considered complete without retrying. This config is intended for internal use and is not intended to trigger further retries. It represents the legacy behavior of not failing the initialization task for minor issues.

Methods

public static long getDefaultRetryDelayInMillis()

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

Returns:

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.

public boolean shouldRetry()

Determines whether the initialization should be retried.

Returns:

true if the initialization should be retried, false otherwise.

public long getRetryDelayInMillis()

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

Returns:

The delay time in milliseconds.

public boolean shouldCompleteWithoutFailure()

Signals to treat initialization errors as successful for legacy behavior compatibility.

This config is intended for internal use and is not intended to trigger further retries.

Returns:

true if initialization should be deemed complete without additional retries, despite any errors encountered. Otherwise, returns false.