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 |
default static final int |
Indicates that initialization of CameraX failed due to invalid customization options within the provided |
default static final int |
Indicates that the initialization encountered an unknown error. |
Public methods |
|
|---|---|
abstract @Nullable Throwable |
getCause()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
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
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.
| See also | |
|---|---|
configureInstance |
|
CameraXConfig.Builder |
STATUS_UNKNOWN_ERROR
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
abstract @Nullable Throwable getCause()
Gets the cause that occurred during the task execution, if any.
getExecutedTimeInMillis
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
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. |