# CameraCaptureSessionInterop

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.CameraCaptureSessionInterop) Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

*** ** * ** ***


```
public interface CameraCaptureSessionInterop
```

<br />

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

|---|---|
| `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraControlCamera2Interop` | Configures Camera2 options on a `https://developer.android.com/reference/androidx/camera/core/CameraControl`. |
| `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/CameraCaptureSession.html` options.

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#clearAllCaptureRequestOptions()()` Clears all `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html`s previously set on this target. |
| `abstract void` | `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#clearCaptureRequestOption(android.hardware.camera2.CaptureRequest.Key)(@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 ?> key)` Clears a `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html` previously set on this target. |
| `default @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/camera2/interop/CaptureRequestOptionTarget` | `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#getCaptureRequest()()` Helper target property supporting `captureRequest[key] = value` indexing operator syntax. |
| `abstract https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback.html` | `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#getRepeatingCaptureCallback()()` The callback to receive repeating capture updates on a direct executor. |
| `abstract int` | `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#getRepeatingCaptureRequestTemplate()()` The repeating capture request template type (e.g., `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.html#TEMPLATE_PREVIEW`). |
| `abstract void` | `<V extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#setCaptureRequestOption(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 `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html` and value on repeating and one-shot requests. |
| `abstract void` | `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#setRepeatingCaptureCallback(android.hardware.camera2.CameraCaptureSession.CaptureCallback)( https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback.html value )` The callback to receive repeating capture updates on a direct executor. |
| `abstract void` | `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#setRepeatingCaptureCallback(java.util.concurrent.Executor,android.hardware.camera2.CameraCaptureSession.CaptureCallback)( @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.CaptureCallback.html callback )` Sets the callback to receive repeating capture updates with an executor. |
| `abstract void` | `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#setRepeatingCaptureRequestTemplate(kotlin.Int)(int value)` The repeating capture request template type (e.g., `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.html#TEMPLATE_PREVIEW`). |

## Public methods

### clearAllCaptureRequestOptions

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

```
abstract void clearAllCaptureRequestOptions()
```

Clears all `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html`s previously set on this target.

### clearCaptureRequestOption

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

```
abstract void clearCaptureRequestOption(@NonNull CaptureRequest.Key<@NonNull ?> key)
```

Clears a `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html` previously set on this target.

| 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 ?> key` | capture request option key |

### getCaptureRequest

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

```
default @NonNull CaptureRequestOptionTarget getCaptureRequest()
```

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

### getRepeatingCaptureCallback

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

```
abstract CameraCaptureSession.CaptureCallback getRepeatingCaptureCallback()
```

The callback to receive repeating capture 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)`

### getRepeatingCaptureRequestTemplate

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

```
abstract int getRepeatingCaptureRequestTemplate()
```

The repeating capture request template type (e.g., `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.html#TEMPLATE_PREVIEW`).

### setCaptureRequestOption

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

```
abstract void <V extends Object> setCaptureRequestOption(
    @NonNull CaptureRequest.Key<@NonNull V> key,
    @NonNull V value
)
```

Sets a `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html` and value on repeating and one-shot requests.

| 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` | capture request option key |
| `@https://developer.android.com/reference/androidx/annotation/NonNull V value` | option value |

### setRepeatingCaptureCallback

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

```
abstract void setRepeatingCaptureCallback(
    CameraCaptureSession.CaptureCallback value
)
```

The callback to receive repeating capture 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)`

### setRepeatingCaptureCallback

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

```
abstract void setRepeatingCaptureCallback(
    @NonNull Executor executor,
    @NonNull CameraCaptureSession.CaptureCallback callback
)
```

Sets the callback to receive repeating capture updates with an executor.

**Warning:** The `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#setRepeatingCaptureCallback(java.util.concurrent.Executor,android.hardware.camera2.CameraCaptureSession.CaptureCallback)` 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.CaptureCallback.html callback` | repeating capture callback |

### setRepeatingCaptureRequestTemplate

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

```
abstract void setRepeatingCaptureRequestTemplate(int value)
```

The repeating capture request template type (e.g., `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.html#TEMPLATE_PREVIEW`).