public interface

RetryPolicy.ExecutionState

 androidx.camera.core.RetryPolicy.ExecutionState

Subclasses:

CameraProviderExecutionState

Overview

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

Fields
public static final intSTATUS_CAMERA_UNAVAILABLE

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

public static final intSTATUS_CONFIGURATION_FAIL

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

public static final intSTATUS_UNKNOWN_ERROR

Indicates that the initialization encountered an unknown error.

Methods
public java.lang.ThrowablegetCause()

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

public longgetExecutedTimeInMillis()

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

public intgetNumOfAttempts()

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

public intgetStatus()

Retrieves the status of the most recently completed initialization attempt.

Fields

public static final int STATUS_UNKNOWN_ERROR

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

public static final int STATUS_CONFIGURATION_FAIL

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.

See also: ProcessCameraProvider.configureInstance(CameraXConfig), CameraXConfig.Builder

public static final int STATUS_CAMERA_UNAVAILABLE

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.

Methods

public int getStatus()

Retrieves the status of the most recently completed initialization attempt.

Returns:

The status code representing the outcome of the initialization.

public java.lang.Throwable getCause()

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

Returns:

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

public long getExecutedTimeInMillis()

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

Returns:

The total execution time of the initialization task in milliseconds.

public int getNumOfAttempts()

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

Returns:

The total number of attempts made to initialize the camera.