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 Unit

Adds all CameraCaptureCallback callbacks for single and repeating requests.

open Unit

Adds all CameraDevice.StateCallback callbacks.

open Unit

Adds all CameraCaptureCallback callbacks.

open Unit
addAllSessionStateCallbacks(@NonNull sessionStateCallbacks: MutableList<StateCallback!>)

Adds all CameraCaptureSession.StateCallback callbacks.

open Unit
addCameraCaptureCallback(@NonNull cameraCaptureCallback: CameraCaptureCallback)

Adds a CameraCaptureCallback callback for single and repeating requests.

open Unit
addDeviceStateCallback(@NonNull deviceStateCallback: StateCallback)

Adds a CameraDevice.StateCallback callback.

open Unit

Adds all ErrorListener listeners repeating requests.

open Unit
addImplementationOptions(@NonNull config: Config)

Add a set of Config to the implementation specific options.

open Unit

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

open Unit

Adds a CameraCaptureCallback callback for repeating requests.

open Unit
addSessionStateCallback(@NonNull sessionStateCallback: StateCallback)

Adds a CameraCaptureSession.StateCallback callback.

open Unit
addSurface(@NonNull surface: DeferrableSurface)

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

open Unit
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 Unit

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 Unit
removeSurface(@NonNull surface: DeferrableSurface)

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

open Unit
setImplementationOptions(@NonNull config: Config)

Set the Config for options that are implementation specific.

open Unit
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

open fun addAllCameraCaptureCallbacks(@NonNull cameraCaptureCallbacks: MutableCollection<CameraCaptureCallback!>): Unit

Adds all CameraCaptureCallback callbacks for single and repeating requests.

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

addAllDeviceStateCallbacks

open fun addAllDeviceStateCallbacks(@NonNull deviceStateCallbacks: MutableCollection<StateCallback!>): Unit

Adds all CameraDevice.StateCallback callbacks.

addAllRepeatingCameraCaptureCallbacks

open fun addAllRepeatingCameraCaptureCallbacks(@NonNull cameraCaptureCallbacks: MutableCollection<CameraCaptureCallback!>): Unit

Adds all CameraCaptureCallback callbacks.

These callbacks do not call for single requests.

addAllSessionStateCallbacks

open fun addAllSessionStateCallbacks(@NonNull sessionStateCallbacks: MutableList<StateCallback!>): Unit

Adds all CameraCaptureSession.StateCallback callbacks.

addCameraCaptureCallback

open fun addCameraCaptureCallback(@NonNull cameraCaptureCallback: CameraCaptureCallback): Unit

Adds a CameraCaptureCallback callback for single and repeating requests.

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

addDeviceStateCallback

open fun addDeviceStateCallback(@NonNull deviceStateCallback: StateCallback): Unit

Adds a CameraDevice.StateCallback callback.

addErrorListener

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

Adds all ErrorListener listeners repeating requests.

addImplementationOptions

open fun addImplementationOptions(@NonNull config: Config): Unit

Add a set of Config to the implementation specific options.

addNonRepeatingSurface

open fun addNonRepeatingSurface(@NonNull surface: DeferrableSurface): Unit

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

addRepeatingCameraCaptureCallback

open fun addRepeatingCameraCaptureCallback(@NonNull cameraCaptureCallback: CameraCaptureCallback): Unit

Adds a CameraCaptureCallback callback for repeating requests.

This callback does not call for single requests.

addSessionStateCallback

open fun addSessionStateCallback(@NonNull sessionStateCallback: StateCallback): Unit

Adds a CameraCaptureSession.StateCallback callback.

addSurface

open fun addSurface(@NonNull surface: DeferrableSurface): Unit

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

addTag

open fun addTag(
    @NonNull key: String,
    @NonNull tag: Any
): Unit

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

open fun clearSurfaces(): Unit

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.

removeSurface

open fun removeSurface(@NonNull surface: DeferrableSurface): Unit

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

setImplementationOptions

open fun setImplementationOptions(@NonNull config: Config): Unit

Set the Config for options that are implementation specific.

setTemplateType

open fun setTemplateType(templateType: Int): Unit

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