Builder

interface Builder<T : UseCase!, C : UseCaseConfig<T>!, B : Any!> : TargetConfig.Builder<T, B>, ExtendableBuilder<T>, UseCaseEventConfig.Builder<B>
androidx.camera.core.impl.UseCaseConfig.Builder

Builder for a UseCase.

Summary

Public methods
abstract C

Retrieves the configuration used by this builder.

abstract B
setCameraSelector(@NonNull cameraSelector: CameraSelector)

Sets the camera selector that this use case requires.

abstract B

Sets the Option Unpacker for translating this configuration into a CaptureConfig

abstract B
setDefaultCaptureConfig(@NonNull captureConfig: CaptureConfig)

Sets the default capture configuration for this use case.

abstract B
setDefaultSessionConfig(@NonNull sessionConfig: SessionConfig)

Sets the default session configuration for this use case.

abstract B

Sets the Option Unpacker for translating this configuration into a SessionConfig

abstract B

Sets the surface occupancy priority of the intended target from this configuration.

Inherited functions

Public methods

getUseCaseConfig

@NonNull abstract fun getUseCaseConfig(): C

Retrieves the configuration used by this builder.

Return
C the configuration used by this builder.

setCameraSelector

@NonNull abstract fun setCameraSelector(@NonNull cameraSelector: CameraSelector): B

Sets the camera selector that this use case requires.

Parameters
cameraSelector CameraSelector: The camera filter appended internally.
Return
B The current Builder.

setCaptureOptionUnpacker

@NonNull abstract fun setCaptureOptionUnpacker(@NonNull optionUnpacker: CaptureConfig.OptionUnpacker): B

Sets the Option Unpacker for translating this configuration into a CaptureConfig

TODO(b/120949879): This may be removed when CaptureConfig removes all camera2 dependencies.

Parameters
optionUnpacker CaptureConfig.OptionUnpacker: The option unpacker for to use for this use case.
Return
B the current Builder.

setDefaultCaptureConfig

@NonNull abstract fun setDefaultCaptureConfig(@NonNull captureConfig: CaptureConfig): B

Sets the default capture configuration for this use case.

Parameters
captureConfig CaptureConfig: The default capture configuration to use for this use case.
Return
B the current Builder.

setDefaultSessionConfig

@NonNull abstract fun setDefaultSessionConfig(@NonNull sessionConfig: SessionConfig): B

Sets the default session configuration for this use case.

Parameters
sessionConfig SessionConfig: The default session configuration to use for this use case.
Return
B the current Builder.

setSessionOptionUnpacker

@NonNull abstract fun setSessionOptionUnpacker(@NonNull optionUnpacker: SessionConfig.OptionUnpacker): B

Sets the Option Unpacker for translating this configuration into a SessionConfig

TODO(b/120949879): This may be removed when SessionConfig removes all camera2 dependencies.

Parameters
optionUnpacker SessionConfig.OptionUnpacker: The option unpacker for to use for this use case.
Return
B the current Builder.

setSurfaceOccupancyPriority

@NonNull abstract fun setSurfaceOccupancyPriority(priority: Int): B

Sets the surface occupancy priority of the intended target from this configuration.

The stream resource of android.hardware.camera2.CameraDevice is limited. When one use case occupies a larger stream resource, it will impact the other use cases to get smaller stream resource. Use this to determine which use case can have higher priority to occupancy stream resource first.

Parameters
priority Int: The priority to occupancy the available stream resource. Higher value will have higher priority.
Return
B The current Builder.