# SessionConfigurationInterop

Artifact: [androidx.camera:camera-camera2](https://developer.android.com/jetpack/androidx/releases/camera) [View Source](https://cs.android.com/search?q=file:androidx/camera/camera2/interop/InteropBaseInterfaces.kt+class:androidx.camera.camera2.interop.SessionConfigurationInterop) Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

*** ** * ** ***


```
public interface SessionConfigurationInterop
```

<br />

Known direct subclasses [SessionConfigCamera2Interop](https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigCamera2Interop)

|---|---|
| `https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigCamera2Interop` | Configures Camera2 options on a `https://developer.android.com/reference/androidx/camera/core/SessionConfig`. |

*** ** * ** ***

Configures Camera2 `https://developer.android.com/reference/android/hardware/camera2/params/SessionConfiguration.html` options.

## Summary

| ### Public methods |
|---|---|
| `abstract https://developer.android.com/reference/android/graphics/ColorSpace.Named.html` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 34) https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigurationInterop#getColorSpace()()` The session color space. |
| `default @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/camera2/interop/SessionParameterTarget` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 28) https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigurationInterop#getSessionParameter()()` Helper target property supporting `sessionParameter[key] = value` indexing operator syntax. |
| `abstract https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.StateCallback.html` | `https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigurationInterop#getSessionStateCallback()()` The callback to receive session state updates on a direct executor. |
| `abstract int` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 28) https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigurationInterop#getSessionType()()` The operating mode session type. |
| `abstract void` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 34) https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigurationInterop#setColorSpace(android.graphics.ColorSpace.Named)(https://developer.android.com/reference/android/graphics/ColorSpace.Named.html value)` The session color space. |
| `abstract void` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 28) <V extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigurationInterop#setSessionParameter(android.hardware.camera2.CaptureRequest.Key,kotlin.Any)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html<@https://developer.android.com/reference/androidx/annotation/NonNull V> key, @https://developer.android.com/reference/androidx/annotation/NonNull V value )` Sets a session parameter used during session creation. |
| `abstract void` | `https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigurationInterop#setSessionStateCallback(android.hardware.camera2.CameraCaptureSession.StateCallback)(https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.StateCallback.html value)` The callback to receive session state updates on a direct executor. |
| `abstract void` | `https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigurationInterop#setSessionStateCallback(java.util.concurrent.Executor,android.hardware.camera2.CameraCaptureSession.StateCallback)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/concurrent/Executor.html executor, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.StateCallback.html callback )` Sets the callback to receive session state updates with an executor. |
| `abstract void` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 28) https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigurationInterop#setSessionType(kotlin.Int)(int value)` The operating mode session type. |

## Public methods

### getColorSpace

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
@RequiresApi(value = 34)
abstract ColorSpace.Named getColorSpace()
```

The session color space.

### getSessionParameter

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
@RequiresApi(value = 28)
default @NonNull SessionParameterTarget getSessionParameter()
```

Helper target property supporting `sessionParameter[key] = value` indexing operator syntax.

### getSessionStateCallback

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
abstract CameraCaptureSession.StateCallback getSessionStateCallback()
```

The callback to receive session state updates on a direct executor.

**Warning:** The callback receives raw `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html` instances. Directly invoking state-altering, lifecycle, or request-submitting methods on these raw objects bypasses CameraX pipeline management and causes state desynchronization, stream freezing, or crashes. Do not invoke:

- Session lifecycle methods: `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#close()`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#abortCaptures()`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#stopRepeating()`

- Request submission methods: `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#setRepeatingRequest(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#setRepeatingBurst(java.util.List&lt;android.hardware.camera2.CaptureRequest&gt;, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#capture(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler)`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#captureBurst(java.util.List&lt;android.hardware.camera2.CaptureRequest&gt;, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler)`

- Surface / output configuration methods: `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#updateOutputConfiguration(android.hardware.camera2.params.OutputConfiguration)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#finalizeOutputConfigurations(java.util.List&lt;android.hardware.camera2.params.OutputConfiguration&gt;)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#prepare(android.view.Surface)`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#switchToOffline(java.util.Collection&lt;android.view.Surface&gt;, java.util.concurrent.Executor, android.hardware.camera2.CameraOfflineSession.CameraOfflineSessionCallback)`

### getSessionType

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
@RequiresApi(value = 28)
abstract int getSessionType()
```

The operating mode session type.

### setColorSpace

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
@RequiresApi(value = 34)
abstract void setColorSpace(ColorSpace.Named value)
```

The session color space.

### setSessionParameter

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
@RequiresApi(value = 28)
abstract void <V extends Object> setSessionParameter(
    @NonNull CaptureRequest.Key<@NonNull V> key,
    @NonNull V value
)
```

Sets a session parameter used during session creation.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html<@https://developer.android.com/reference/androidx/annotation/NonNull V> key` | session parameter key |
| `@https://developer.android.com/reference/androidx/annotation/NonNull V value` | parameter value |

### setSessionStateCallback

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
abstract void setSessionStateCallback(CameraCaptureSession.StateCallback value)
```

The callback to receive session state updates on a direct executor.

**Warning:** The callback receives raw `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html` instances. Directly invoking state-altering, lifecycle, or request-submitting methods on these raw objects bypasses CameraX pipeline management and causes state desynchronization, stream freezing, or crashes. Do not invoke:

- Session lifecycle methods: `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#close()`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#abortCaptures()`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#stopRepeating()`

- Request submission methods: `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#setRepeatingRequest(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#setRepeatingBurst(java.util.List&lt;android.hardware.camera2.CaptureRequest&gt;, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#capture(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler)`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#captureBurst(java.util.List&lt;android.hardware.camera2.CaptureRequest&gt;, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler)`

- Surface / output configuration methods: `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#updateOutputConfiguration(android.hardware.camera2.params.OutputConfiguration)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#finalizeOutputConfigurations(java.util.List&lt;android.hardware.camera2.params.OutputConfiguration&gt;)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#prepare(android.view.Surface)`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#switchToOffline(java.util.Collection&lt;android.view.Surface&gt;, java.util.concurrent.Executor, android.hardware.camera2.CameraOfflineSession.CameraOfflineSessionCallback)`

### setSessionStateCallback

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
abstract void setSessionStateCallback(
    @NonNull Executor executor,
    @NonNull CameraCaptureSession.StateCallback callback
)
```

Sets the callback to receive session state updates with an executor.

**Warning:** The `https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigurationInterop#setSessionStateCallback(java.util.concurrent.Executor,android.hardware.camera2.CameraCaptureSession.StateCallback)` receives raw `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html` instances. Directly invoking state-altering, lifecycle, or request-submitting methods on these raw objects bypasses CameraX pipeline management and causes state desynchronization, stream freezing, or crashes. Do not invoke:

- Session lifecycle methods: `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#close()`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#abortCaptures()`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#stopRepeating()`

- Request submission methods: `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#setRepeatingRequest(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#setRepeatingBurst(java.util.List&lt;android.hardware.camera2.CaptureRequest&gt;, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#capture(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler)`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#captureBurst(java.util.List&lt;android.hardware.camera2.CaptureRequest&gt;, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler)`

- Surface / output configuration methods: `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#updateOutputConfiguration(android.hardware.camera2.params.OutputConfiguration)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#finalizeOutputConfigurations(java.util.List&lt;android.hardware.camera2.params.OutputConfiguration&gt;)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#prepare(android.view.Surface)`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#switchToOffline(java.util.Collection&lt;android.view.Surface&gt;, java.util.concurrent.Executor, android.hardware.camera2.CameraOfflineSession.CameraOfflineSessionCallback)`

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/concurrent/Executor.html executor` | executor to run the callback on |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.StateCallback.html callback` | session state callback |

### setSessionType

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
@RequiresApi(value = 28)
abstract void setSessionType(int value)
```

The operating mode session type.