Builder

class Builder : BaseBuilder
androidx.camera.core.impl.SessionConfig.Builder

Builder for easy modification/rebuilding of a SessionConfig.

Summary

Public constructors

Builder for easy modification/rebuilding of a SessionConfig.

Public methods
open SessionConfig.Builder

Adds all CameraCaptureCallback callbacks for single and repeating requests.

open SessionConfig.Builder

Adds all CameraDevice.StateCallback callbacks.

open SessionConfig.Builder

Adds all CameraCaptureCallback callbacks.

open SessionConfig.Builder
addAllSessionStateCallbacks(@NonNull sessionStateCallbacks: MutableList<StateCallback!>)

Adds all CameraCaptureSession.StateCallback callbacks.

open SessionConfig.Builder
addCameraCaptureCallback(@NonNull cameraCaptureCallback: CameraCaptureCallback)

Adds a CameraCaptureCallback callback for single and repeating requests.

open SessionConfig.Builder
addDeviceStateCallback(@NonNull deviceStateCallback: StateCallback)

Adds a CameraDevice.StateCallback callback.

open SessionConfig.Builder

Adds all ErrorListener listeners repeating requests.

open SessionConfig.Builder
addImplementationOptions(@NonNull config: Config)

Add a set of Config to the implementation specific options.

open SessionConfig.Builder

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

open SessionConfig.Builder

Adds an OutputConfig to create the capture session with.

open SessionConfig.Builder

Adds a CameraCaptureCallback callback for repeating requests.

open SessionConfig.Builder
addSessionStateCallback(@NonNull sessionStateCallback: StateCallback)

Adds a CameraCaptureSession.StateCallback callback.

open SessionConfig.Builder
addSurface(@NonNull surface: DeferrableSurface)

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

open SessionConfig.Builder
addTag(@NonNull key: String, @NonNull tag: Any)

Adds a tag to the SessionConfig with a key.

open SessionConfig

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

open SessionConfig.Builder

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

open static SessionConfig.Builder
createFrom(@NonNull config: UseCaseConfig<*>)

Creates a Builder from a UseCaseConfig.

open MutableList<CameraCaptureCallback!>

Obtain all CameraCaptureCallback callbacks for single requests.

open Boolean
removeCameraCaptureCallback(@NonNull cameraCaptureCallback: CameraCaptureCallback)

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

open SessionConfig.Builder
removeSurface(@NonNull surface: DeferrableSurface)

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

open SessionConfig.Builder
setImplementationOptions(@NonNull config: Config)

Set the Config for options that are implementation specific.

open SessionConfig.Builder
setInputConfiguration(@Nullable inputConfiguration: InputConfiguration?)

Set the input configuration for reprocessable capture session.

open SessionConfig.Builder
setTemplateType(templateType: Int)

Set the template characteristics of the SessionConfig.

Public constructors

Builder

Builder()

Builder for easy modification/rebuilding of a SessionConfig.

Public methods

addAllCameraCaptureCallbacks

@NonNull open fun addAllCameraCaptureCallbacks(@NonNull cameraCaptureCallbacks: MutableCollection<CameraCaptureCallback!>): SessionConfig.Builder

Adds all CameraCaptureCallback callbacks for single and repeating requests.

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

addAllDeviceStateCallbacks

@NonNull open fun addAllDeviceStateCallbacks(@NonNull deviceStateCallbacks: MutableCollection<StateCallback!>): SessionConfig.Builder

Adds all CameraDevice.StateCallback callbacks.

addAllRepeatingCameraCaptureCallbacks

@NonNull open fun addAllRepeatingCameraCaptureCallbacks(@NonNull cameraCaptureCallbacks: MutableCollection<CameraCaptureCallback!>): SessionConfig.Builder

Adds all CameraCaptureCallback callbacks.

These callbacks do not call for single requests.

addAllSessionStateCallbacks

@NonNull open fun addAllSessionStateCallbacks(@NonNull sessionStateCallbacks: MutableList<StateCallback!>): SessionConfig.Builder

Adds all CameraCaptureSession.StateCallback callbacks.

addCameraCaptureCallback

@NonNull open fun addCameraCaptureCallback(@NonNull cameraCaptureCallback: CameraCaptureCallback): SessionConfig.Builder

Adds a CameraCaptureCallback callback for single and repeating requests.

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

addDeviceStateCallback

@NonNull open fun addDeviceStateCallback(@NonNull deviceStateCallback: StateCallback): SessionConfig.Builder

Adds a CameraDevice.StateCallback callback.

addErrorListener

@NonNull open fun addErrorListener(@NonNull errorListener: SessionConfig.ErrorListener): SessionConfig.Builder

Adds all ErrorListener listeners repeating requests.

addImplementationOptions

@NonNull open fun addImplementationOptions(@NonNull config: Config): SessionConfig.Builder

Add a set of Config to the implementation specific options.

addNonRepeatingSurface

@NonNull open fun addNonRepeatingSurface(@NonNull surface: DeferrableSurface): SessionConfig.Builder

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

addOutputConfig

@NonNull open fun addOutputConfig(@NonNull outputConfig: SessionConfig.OutputConfig): SessionConfig.Builder

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

addRepeatingCameraCaptureCallback

@NonNull open fun addRepeatingCameraCaptureCallback(@NonNull cameraCaptureCallback: CameraCaptureCallback): SessionConfig.Builder

Adds a CameraCaptureCallback callback for repeating requests.

This callback does not call for single requests.

addSessionStateCallback

@NonNull open fun addSessionStateCallback(@NonNull sessionStateCallback: StateCallback): SessionConfig.Builder

Adds a CameraCaptureSession.StateCallback callback.

addSurface

@NonNull open fun addSurface(@NonNull surface: DeferrableSurface): SessionConfig.Builder

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

addTag

@NonNull open fun addTag(
    @NonNull key: String,
    @NonNull tag: Any
): SessionConfig.Builder

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

build

@NonNull open fun build(): SessionConfig

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

clearSurfaces

@NonNull open fun clearSurfaces(): SessionConfig.Builder

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

createFrom

@NonNull open static fun createFrom(@NonNull config: UseCaseConfig<*>): SessionConfig.Builder

Creates a Builder from a UseCaseConfig.

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

getSingleCameraCaptureCallbacks

@NonNull open fun getSingleCameraCaptureCallbacks(): MutableList<CameraCaptureCallback!>

Obtain all CameraCaptureCallback callbacks for single requests.

removeCameraCaptureCallback

open fun removeCameraCaptureCallback(@NonNull cameraCaptureCallback: CameraCaptureCallback): Boolean

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

Parameters
cameraCaptureCallback CameraCaptureCallback: The callback to remove.
Return
Boolean true if the callback was successfully removed. false if the callback wasn't present in this builder.

removeSurface

@NonNull open fun removeSurface(@NonNull surface: DeferrableSurface): SessionConfig.Builder

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

setImplementationOptions

@NonNull open fun setImplementationOptions(@NonNull config: Config): SessionConfig.Builder

Set the Config for options that are implementation specific.

setInputConfiguration

@NonNull open fun setInputConfiguration(@Nullable inputConfiguration: InputConfiguration?): SessionConfig.Builder

Set the input configuration for reprocessable capture session.

Parameters
inputConfiguration InputConfiguration?: The input configuration.

setTemplateType

@NonNull open fun setTemplateType(templateType: Int): SessionConfig.Builder

Set the template characteristics of the SessionConfig.

Parameters
templateType Int: Template constant that must match those defined by

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