SessionConfiguration

public final class SessionConfiguration
extends Object

java.lang.Object
   ↳ android.hardware.camera2.params.SessionConfiguration


A helper class that aggregates all supported arguments for capture session initialization.

Summary

Constants

int SESSION_HIGH_SPEED

A high speed session type that can only contain instances of OutputConfiguration.

int SESSION_REGULAR

A regular session type containing instances of OutputConfiguration running at regular non high speed FPS ranges and optionally InputConfiguration for reprocessable sessions.

Public constructors

SessionConfiguration(int sessionType, List<OutputConfiguration> outputs, Executor executor, CameraCaptureSession.StateCallback cb)

Create a new SessionConfiguration.

Public methods

Executor getExecutor()

Retrieve the Executor for the capture session.

InputConfiguration getInputConfiguration()

Retrieve the InputConfiguration.

List<OutputConfiguration> getOutputConfigurations()

Retrieve the OutputConfiguration list for the capture session.

CaptureRequest getSessionParameters()

Retrieve the session wide camera parameters (see CaptureRequest).

int getSessionType()

Retrieve the type of the capture session.

CameraCaptureSession.StateCallback getStateCallback()

Retrieve the CameraCaptureSession.StateCallback for the capture session.

void setInputConfiguration(InputConfiguration input)

Sets the InputConfiguration for a reprocessable session.

void setSessionParameters(CaptureRequest params)

Sets the session wide camera parameters (see CaptureRequest).

Inherited methods

Constants

SESSION_HIGH_SPEED

added in API level 28
public static final int SESSION_HIGH_SPEED

A high speed session type that can only contain instances of OutputConfiguration. The outputs can run using high speed FPS ranges. Calls to setInputConfiguration(InputConfiguration) are not supported.

Constant Value: 1 (0x00000001)

SESSION_REGULAR

added in API level 28
public static final int SESSION_REGULAR

A regular session type containing instances of OutputConfiguration running at regular non high speed FPS ranges and optionally InputConfiguration for reprocessable sessions.

Constant Value: 0 (0x00000000)

Public constructors

SessionConfiguration

added in API level 28
public SessionConfiguration (int sessionType, 
                List<OutputConfiguration> outputs, 
                Executor executor, 
                CameraCaptureSession.StateCallback cb)

Create a new SessionConfiguration.

Parameters
sessionType int: The session type.

Value is SESSION_REGULAR or SESSION_HIGH_SPEED.

outputs List: A list of output configurations for the capture session.

This value must never be null.

executor Executor: The executor which should be used to invoke the callback. In general it is recommended that camera operations are not done on the main (UI) thread.

This value must never be null.

Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). To dispatch events through a shared thread pool, you can use AsyncTask.THREAD_POOL_EXECUTOR.

cb CameraCaptureSession.StateCallback: A state callback interface implementation.

This value must never be null.

Public methods

getExecutor

added in API level 28
public Executor getExecutor ()

Retrieve the Executor for the capture session.

Returns
Executor The Executor on which the callback will be invoked.

getInputConfiguration

added in API level 28
public InputConfiguration getInputConfiguration ()

Retrieve the InputConfiguration.

Returns
InputConfiguration The capture session input configuration.

getOutputConfigurations

added in API level 28
public List<OutputConfiguration> getOutputConfigurations ()

Retrieve the OutputConfiguration list for the capture session.

Returns
List<OutputConfiguration> A list of output configurations for the capture session.

getSessionParameters

added in API level 28
public CaptureRequest getSessionParameters ()

Retrieve the session wide camera parameters (see CaptureRequest).

Returns
CaptureRequest A capture request that includes the initial values for any available session wide capture keys.

getSessionType

added in API level 28
public int getSessionType ()

Retrieve the type of the capture session.

Returns
int The capture session type.

Value is SESSION_REGULAR or SESSION_HIGH_SPEED.

getStateCallback

added in API level 28
public CameraCaptureSession.StateCallback getStateCallback ()

Retrieve the CameraCaptureSession.StateCallback for the capture session.

Returns
CameraCaptureSession.StateCallback A state callback interface implementation.

setInputConfiguration

added in API level 28
public void setInputConfiguration (InputConfiguration input)

Sets the InputConfiguration for a reprocessable session. Input configuration are not supported for SESSION_HIGH_SPEED.

Parameters
input InputConfiguration: Input configuration.

This value must never be null.

Throws
UnsupportedOperationException In case it is called for SESSION_HIGH_SPEED type session configuration.

setSessionParameters

added in API level 28
public void setSessionParameters (CaptureRequest params)

Sets the session wide camera parameters (see CaptureRequest). This argument can be set for every supported session type and will be passed to the camera device as part of the capture session initialization. Session parameters are a subset of the available capture request parameters (see CameraCharacteristics.getAvailableSessionKeys()) and their application can introduce internal camera delays. To improve camera performance it is suggested to change them sparingly within the lifetime of the capture session and to pass their initial values as part of this method.

Parameters
params CaptureRequest: A capture request that includes the initial values for any available session wide capture keys. Tags (see CaptureRequest.Builder.setTag(Object)) and output targets (see CaptureRequest.Builder.addTarget(Surface)) are ignored if set. Parameter values not part of CameraCharacteristics.getAvailableSessionKeys() will also be ignored. It is recommended to build the session parameters using the same template type as the initial capture request, so that the session and initial request parameters match as much as possible.