public class

SessionConfig.Builder

extends androidx.camera.core.impl.SessionConfig.BaseBuilder

 java.lang.Object

↳androidx.camera.core.impl.SessionConfig.BaseBuilder

↳androidx.camera.core.impl.SessionConfig.Builder

Overview

Builder for easy modification/rebuilding of a SessionConfig.

Summary

Constructors
publicBuilder()

Methods
public SessionConfig.BuilderaddAllCameraCaptureCallbacks(java.util.Collection<CameraCaptureCallback> cameraCaptureCallbacks)

Adds all CameraCaptureCallback callbacks for single and repeating requests.

public SessionConfig.BuilderaddAllDeviceStateCallbacks(java.util.Collection<CameraDevice.StateCallback> deviceStateCallbacks)

Adds all callbacks.

public SessionConfig.BuilderaddAllRepeatingCameraCaptureCallbacks(java.util.Collection<CameraCaptureCallback> cameraCaptureCallbacks)

Adds all CameraCaptureCallback callbacks.

public SessionConfig.BuilderaddAllSessionStateCallbacks(java.util.List<CameraCaptureSession.StateCallback> sessionStateCallbacks)

Adds all callbacks.

public SessionConfig.BuilderaddCameraCaptureCallback(CameraCaptureCallback cameraCaptureCallback)

Adds a CameraCaptureCallback callback for single and repeating requests.

public SessionConfig.BuilderaddDeviceStateCallback(CameraDevice.StateCallback deviceStateCallback)

Adds a callback.

public SessionConfig.BuilderaddImplementationOptions(Config config)

Add a set of Config to the implementation specific options.

public SessionConfig.BuilderaddNonRepeatingSurface(DeferrableSurface surface)

Add a surface for the session which only used for single captures.

public SessionConfig.BuilderaddNonRepeatingSurface(DeferrableSurface surface, DynamicRange dynamicRange)

Add a surface with the provided dynamic range for the session which only used for single captures.

public SessionConfig.BuilderaddOutputConfig(SessionConfig.OutputConfig outputConfig)

Adds an SessionConfig.OutputConfig to create the capture session with.

public SessionConfig.BuilderaddRepeatingCameraCaptureCallback(CameraCaptureCallback cameraCaptureCallback)

Adds a CameraCaptureCallback callback for repeating requests.

public SessionConfig.BuilderaddSessionStateCallback(CameraCaptureSession.StateCallback sessionStateCallback)

Adds a callback.

public SessionConfig.BuilderaddSurface(DeferrableSurface surface)

Add a surface to the set that the session repeatedly writes data to.

public SessionConfig.BuilderaddSurface(DeferrableSurface surface, DynamicRange dynamicRange, java.lang.String physicalCameraId, int mirrorMode)

Add a surface with the provided dynamic range to the set that the session repeatedly writes data to.

public SessionConfig.BuilderaddTag(java.lang.String key, java.lang.Object tag)

Adds a tag to the SessionConfig with a key.

public SessionConfigbuild()

Builds an instance of a SessionConfig that has all the combined parameters of the SessionConfig that have been added to the Builder.

public SessionConfig.BuilderclearSurfaces()

Clears all surfaces from the set which the session writes to.

public static SessionConfig.BuildercreateFrom(UseCaseConfig<UseCase> config, Size resolution)

Creates a SessionConfig.OutputConfig.Builder from a UseCaseConfig.

public java.util.List<CameraCaptureCallback>getSingleCameraCaptureCallbacks()

Obtain all CameraCaptureCallback callbacks for single requests.

public booleanremoveCameraCaptureCallback(CameraCaptureCallback cameraCaptureCallback)

Removes a previously added CameraCaptureCallback callback for single and/or repeating requests.

public SessionConfig.BuilderremoveSurface(DeferrableSurface surface)

Remove a surface from the set which the session repeatedly writes to.

public SessionConfig.BuildersetErrorListener(SessionConfig.ErrorListener errorListener)

Adds all SessionConfig.ErrorListener listeners repeating requests.

public SessionConfig.BuildersetExpectedFrameRateRange(<any> expectedFrameRateRange)

Set the expected frame rate range of the SessionConfig.

public SessionConfig.BuildersetImplementationOptions(Config config)

Set the Config for options that are implementation specific.

public SessionConfig.BuildersetInputConfiguration(InputConfiguration inputConfiguration)

Set the input configuration for reprocessable capture session.

public SessionConfig.BuildersetPostviewSurface(DeferrableSurface surface)

Sets the postview surface.

public SessionConfig.BuildersetPreviewStabilization(int mode)

Set the preview stabilization mode of the SessionConfig.

public SessionConfig.BuildersetSessionType(int sessionType)

Sets the session type.

public SessionConfig.BuildersetTemplateType(int templateType)

Set the template characteristics of the SessionConfig.

public SessionConfig.BuildersetVideoStabilization(int mode)

Set the video stabilization mode of the SessionConfig.

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

Constructors

public Builder()

Methods

public static SessionConfig.Builder createFrom(UseCaseConfig<UseCase> config, Size resolution)

Creates a SessionConfig.OutputConfig.Builder from a UseCaseConfig.

Populates the builder with all the properties defined in the base configuration.

public SessionConfig.Builder setInputConfiguration(InputConfiguration inputConfiguration)

Set the input configuration for reprocessable capture session.

Parameters:

inputConfiguration: The input configuration.

public SessionConfig.Builder setTemplateType(int templateType)

Set the template characteristics of the SessionConfig.

Parameters:

templateType: Template constant that must match those defined by CameraDevice

TODO(b/120949879): This is camera2 implementation detail that should be moved

public SessionConfig.Builder setSessionType(int sessionType)

Sets the session type.

public SessionConfig.Builder setExpectedFrameRateRange(<any> expectedFrameRateRange)

Set the expected frame rate range of the SessionConfig.

Parameters:

expectedFrameRateRange: The frame rate range calculated from the UseCases for CameraDevice

public SessionConfig.Builder setPreviewStabilization(int mode)

Set the preview stabilization mode of the SessionConfig.

Parameters:

mode: StabilizationMode

public SessionConfig.Builder setVideoStabilization(int mode)

Set the video stabilization mode of the SessionConfig.

Parameters:

mode: StabilizationMode

public SessionConfig.Builder addTag(java.lang.String key, java.lang.Object tag)

Adds a tag to the SessionConfig with a key. For tracking the source.

public SessionConfig.Builder addDeviceStateCallback(CameraDevice.StateCallback deviceStateCallback)

Adds a callback.

public SessionConfig.Builder addAllDeviceStateCallbacks(java.util.Collection<CameraDevice.StateCallback> deviceStateCallbacks)

Adds all callbacks.

public SessionConfig.Builder addSessionStateCallback(CameraCaptureSession.StateCallback sessionStateCallback)

Adds a callback.

public SessionConfig.Builder addAllSessionStateCallbacks(java.util.List<CameraCaptureSession.StateCallback> sessionStateCallbacks)

Adds all callbacks.

public SessionConfig.Builder addRepeatingCameraCaptureCallback(CameraCaptureCallback cameraCaptureCallback)

Adds a CameraCaptureCallback callback for repeating requests.

This callback does not call for single requests.

public SessionConfig.Builder addAllRepeatingCameraCaptureCallbacks(java.util.Collection<CameraCaptureCallback> cameraCaptureCallbacks)

Adds all CameraCaptureCallback callbacks.

These callbacks do not call for single requests.

public SessionConfig.Builder addCameraCaptureCallback(CameraCaptureCallback cameraCaptureCallback)

Adds a CameraCaptureCallback callback for single and repeating requests.

Listeners added here are available in both the SessionConfig.getRepeatingCameraCaptureCallbacks() and SessionConfig.Builder.getSingleCameraCaptureCallbacks() methods.

public SessionConfig.Builder addAllCameraCaptureCallbacks(java.util.Collection<CameraCaptureCallback> cameraCaptureCallbacks)

Adds all CameraCaptureCallback callbacks for single and repeating requests.

Listeners added here are available in both the SessionConfig.getRepeatingCameraCaptureCallbacks() and SessionConfig.Builder.getSingleCameraCaptureCallbacks() methods.

public boolean removeCameraCaptureCallback(CameraCaptureCallback cameraCaptureCallback)

Removes a previously added CameraCaptureCallback callback for single and/or repeating requests.

Parameters:

cameraCaptureCallback: The callback to remove.

Returns:

true if the callback was successfully removed. false if the callback wasn't present in this builder.

public java.util.List<CameraCaptureCallback> getSingleCameraCaptureCallbacks()

Obtain all CameraCaptureCallback callbacks for single requests.

public SessionConfig.Builder setErrorListener(SessionConfig.ErrorListener errorListener)

Adds all SessionConfig.ErrorListener listeners repeating requests.

public SessionConfig.Builder addSurface(DeferrableSurface surface)

Add a surface to the set that the session repeatedly writes data to.

The dynamic range of this surface will default to DynamicRange.SDR. To manually set the dynamic range, use SessionConfig.Builder.addSurface(DeferrableSurface, DynamicRange, String, int).

public SessionConfig.Builder addSurface(DeferrableSurface surface, DynamicRange dynamicRange, java.lang.String physicalCameraId, int mirrorMode)

Add a surface with the provided dynamic range to the set that the session repeatedly writes data to.

public SessionConfig.Builder addOutputConfig(SessionConfig.OutputConfig outputConfig)

Adds an SessionConfig.OutputConfig to create the capture session with. The surface set in the SessionConfig.OutputConfig will be added to the repeating request.

public SessionConfig.Builder addNonRepeatingSurface(DeferrableSurface surface)

Add a surface for the session which only used for single captures.

The dynamic range of this surface will default to DynamicRange.SDR. To manually set the dynamic range, use SessionConfig.Builder.addNonRepeatingSurface(DeferrableSurface, DynamicRange).

public SessionConfig.Builder addNonRepeatingSurface(DeferrableSurface surface, DynamicRange dynamicRange)

Add a surface with the provided dynamic range for the session which only used for single captures.

public SessionConfig.Builder setPostviewSurface(DeferrableSurface surface)

Sets the postview surface.

public SessionConfig.Builder removeSurface(DeferrableSurface surface)

Remove a surface from the set which the session repeatedly writes to.

public SessionConfig.Builder clearSurfaces()

Clears all surfaces from the set which the session writes to.

public SessionConfig.Builder setImplementationOptions(Config config)

Set the Config for options that are implementation specific.

public SessionConfig.Builder addImplementationOptions(Config config)

Add a set of Config to the implementation specific options.

public SessionConfig build()

Builds an instance of a SessionConfig that has all the combined parameters of the SessionConfig that have been added to the Builder.