LowLightBoostSession

@RequiresApi(value = 30)
interface LowLightBoostSession


A low light boost session.

Manages the necessary surfaces to provide to the camera capture session and outputs the brightened preview to a Surface provided by the app.

Summary

Public functions

Unit

Enables automatic preview brightening.

Surface

Returns the camera surface.

Boolean

Returns whether low light boost is enabled.

Unit

Provides the latest capture result to the render service.

Unit

Releases this session, freeing up resources.

Unit
setSceneDetectorCallback(
    callback: SceneDetectorCallback?,
    callbackExecutor: Executor?
)

Sets the callback for scene detector.

Public functions

enableLowLightBoost

fun enableLowLightBoost(enable: Boolean): Unit

Enables automatic preview brightening.

Enables low light boost to automatically vary the level of brightening applied based on what's appropriate for the scene's estimated luminance. Disabling low light boost will disable preview brightening.

Parameters
enable: Boolean

True to enable low boost and False to disable.

getCameraSurface

fun getCameraSurface(): Surface

Returns the camera surface.

Returns
Surface

The camera surface with the requested dimensions. To be used as a capture target.

isLowLightBoostEnabled

fun isLowLightBoostEnabled(): Boolean

Returns whether low light boost is enabled.

processCaptureResult

fun processCaptureResult(captureResult: TotalCaptureResult): Unit

Provides the latest capture result to the render service.

This must be called for every call to android.hardware.camera2.CameraCaptureSession.CaptureCallback.onCaptureCompleted in order for automatic adjustment of preview brightening to function.

Parameters
captureResult: TotalCaptureResult

The latest capture result.

release

fun release(): Unit

Releases this session, freeing up resources.

The session should no longer be used once released.

setSceneDetectorCallback

fun setSceneDetectorCallback(
    callback: SceneDetectorCallback?,
    callbackExecutor: Executor?
): Unit

Sets the callback for scene detector.

Parameters
callback: SceneDetectorCallback?

The callback for scene detector.

callbackExecutor: Executor?

The executor to run the callback. If not provided, the callback will be run on the main thread.