RetryPolicy.ExecutionState


@ExperimentalRetryPolicy
public interface RetryPolicy.ExecutionState


Provides insights into the current execution state of the camera initialization process.

The ExecutionState empowers app developers to make informed decisions about retry strategies and fine-tune timeout settings. It also facilitates comprehensive app-level logging for tracking initialization success/failure rates and overall camera performance.

Key use cases:

  • Determining whether to retry initialization based on specific error conditions.
  • Logging detailed execution information for debugging and analysis.
  • Monitoring retry success/failure rates to identify potential issues.

Summary

Constants

default static final int

Indicates that the CameraProvider failed to initialize due to an unavailable camera.

default static final int

Indicates that initialization of CameraX failed due to invalid customization options within the provided CameraXConfig.

default static final int

Indicates that the initialization encountered an unknown error.

Public methods

abstract @Nullable Throwable

Gets the cause that occurred during the task execution, if any.

abstract long

Gets the total execution time of the initialization task in milliseconds.

abstract int

Indicates the total number of attempts made to initialize the camera, including the current attempt.

abstract int

Retrieves the status of the most recently completed initialization attempt.

Constants

STATUS_CAMERA_UNAVAILABLE

Added in 1.4.0-alpha05
default static final int STATUS_CAMERA_UNAVAILABLE = 2

Indicates that the CameraProvider failed to initialize due to an unavailable camera. This error suggests a temporary issue with the device's cameras, and retrying may resolve the issue.

STATUS_CONFIGURATION_FAIL

Added in 1.4.0-alpha05
default static final int STATUS_CONFIGURATION_FAIL = 1

Indicates that initialization of CameraX failed due to invalid customization options within the provided CameraXConfig. This error typically indicates a problem with the configuration settings and may require developer attention to resolve.

Possible Causes:

  • Incorrect or incompatible settings within the CameraXConfig.
  • Conflicting options that prevent successful initialization.
  • Missing or invalid values for essential configuration parameters.

To troubleshoot: Please see getCause().getMessage() for details, and review configuration of the CameraXConfig to identify potential errors or inconsistencies in the customization options.

STATUS_UNKNOWN_ERROR

Added in 1.4.0-alpha05
default static final int STATUS_UNKNOWN_ERROR = 0

Indicates that the initialization encountered an unknown error. This error may be transient, and retrying may resolve the issue.

Public methods

getCause

Added in 1.4.0-alpha05
abstract @Nullable Throwable getCause()

Gets the cause that occurred during the task execution, if any.

Returns
@Nullable Throwable

The cause that occurred during the task execution, or null if there was no error.

getExecutedTimeInMillis

Added in 1.4.0-alpha05
abstract long getExecutedTimeInMillis()

Gets the total execution time of the initialization task in milliseconds.

Returns
long

The total execution time of the initialization task in milliseconds.

getNumOfAttempts

Added in 1.4.0-alpha05
abstract int getNumOfAttempts()

Indicates the total number of attempts made to initialize the camera, including the current attempt. The count starts from 1.

Returns
int

The total number of attempts made to initialize the camera.

getStatus

Added in 1.4.0-alpha05
abstract int getStatus()

Retrieves the status of the most recently completed initialization attempt.

Returns
int

The status code representing the outcome of the initialization.