# 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)

*** ** * ** ***


```
interface SessionConfigurationInterop
```

<br />

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

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

*** ** * ** ***

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

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 28) <V : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/SessionConfigurationInterop#setSessionParameter(android.hardware.camera2.CaptureRequest.Key,kotlin.Any)(key: https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html<V>, value: V)` Sets a session parameter used during session creation. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/SessionConfigurationInterop#setSessionStateCallback(java.util.concurrent.Executor,android.hardware.camera2.CameraCaptureSession.StateCallback)( executor: https://developer.android.com/reference/java/util/concurrent/Executor.html, callback: https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.StateCallback.html )` Sets the callback to receive session state updates with an executor. |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/android/graphics/ColorSpace.Named.html?` | `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/SessionConfigurationInterop#colorSpace()` The session color space. |
| `open https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/SessionParameterTarget` | `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/SessionConfigurationInterop#sessionParameter()` Helper target property supporting `sessionParameter[key] = value` indexing operator syntax. |
| `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.StateCallback.html?` | `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/SessionConfigurationInterop#sessionStateCallback()` The callback to receive session state updates on a direct executor. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/SessionConfigurationInterop#sessionType()` The operating mode session type. |

## Public functions

### setSessionParameter

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

```
@RequiresApi(value = 28)
fun <V : Any?> setSessionParameter(key: CaptureRequest.Key<V>, value: V): Unit
```

Sets a session parameter used during session creation.

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

### setSessionStateCallback

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

```
fun setSessionStateCallback(
    executor: Executor,
    callback: CameraCaptureSession.StateCallback
): Unit
```

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

**Warning:** The `https://developer.android.com/reference/kotlin/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 |
|---|---|
| `executor: https://developer.android.com/reference/java/util/concurrent/Executor.html` | executor to run the callback on |
| `callback: https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.StateCallback.html` | session state callback |

## Public properties

### colorSpace

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

```
var colorSpace: ColorSpace.Named?
```

The session color space.

### sessionParameter

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

```
open val sessionParameter: SessionParameterTarget
```

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

### sessionStateCallback

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

```
var sessionStateCallback: CameraCaptureSession.StateCallback?
```

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)`

### sessionType

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

```
var sessionType: Int
```

The operating mode session type.