public final class

RetryPolicy.RetryConfig.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.camera.core.RetryPolicy.RetryConfig.Builder

Overview

A builder class for creating and customizing RetryPolicy.RetryConfig objects.

While predefined configs like RetryPolicy.RetryConfig.DEFAULT_DELAY_RETRY are recommended for typical recovery scenarios, this builder allows for fine-tuned control when specific requirements necessitate a different approach.

Summary

Constructors
publicBuilder()

Methods
public RetryPolicy.RetryConfigbuild()

Builds the customized RetryPolicy.RetryConfig object.

public RetryPolicy.RetryConfig.BuildersetRetryDelayInMillis(long timeoutInMillis)

Sets the retry delay in milliseconds.

public RetryPolicy.RetryConfig.BuildersetShouldRetry(boolean shouldRetry)

Specifies whether a retry should be attempted.

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

Constructors

public Builder()

Methods

public RetryPolicy.RetryConfig.Builder setShouldRetry(boolean shouldRetry)

Specifies whether a retry should be attempted.

Parameters:

shouldRetry: If true (the default), initialization will be retried. If false, initialization will not be retried.

Returns:

this for method chaining.

public RetryPolicy.RetryConfig.Builder setRetryDelayInMillis(long timeoutInMillis)

Sets the retry delay in milliseconds.

If set, the initialization will be retried after the specified delay. For optimal results, the delay should be within the range of 100 to 2000 milliseconds. This aligns with lab testing, which suggests this range provides sufficient recovery time for most common camera issues while minimizing latency.

Parameters:

timeoutInMillis: The delay in milliseconds.

Returns:

this for method chaining.

Builds the customized RetryPolicy.RetryConfig object.

Returns:

The configured RetryConfig.