# Camera2InteropEx

Added in 1.7.0-rc02

*** ** * ** ***


```
public final class Camera2InteropEx
```

<br />

*** ** * ** ***

## Summary

| ### Public methods |
|---|---|
| `static final void` | `https://developer.android.com/reference/androidx/camera/camera2/interop/Camera2InteropEx#(androidx.camera.core.CameraControl).applyCamera2Interop(kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/core/CameraControl receiver, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/camera2/interop/CameraControlCamera2Interop, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block )` Applies Camera2 options to a `https://developer.android.com/reference/androidx/camera/core/CameraControl` asynchronously within a coroutine. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Void.html>` | `https://developer.android.com/reference/androidx/camera/camera2/interop/Camera2InteropEx#(androidx.camera.core.CameraControl).applyCamera2InteropAsync(kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/core/CameraControl receiver, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/camera2/interop/CameraControlCamera2Interop, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block )` Applies Camera2 options to a `https://developer.android.com/reference/androidx/camera/core/CameraControl` asynchronously. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/core/ImageCapture.Builder` | `https://developer.android.com/reference/androidx/camera/camera2/interop/Camera2InteropEx#(androidx.camera.core.ImageCapture.Builder).camera2Interop(kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/core/ImageCapture.Builder receiver, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/camera2/interop/ImageCaptureCamera2Interop, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block )` Applies Camera2 options to an `https://developer.android.com/reference/androidx/camera/core/ImageCapture.Builder`. |
| `static final void` | `https://developer.android.com/reference/androidx/camera/camera2/interop/Camera2InteropEx#(androidx.camera.core.ImageCaptureScope).camera2Interop(kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/core/ImageCaptureScope receiver, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/camera2/interop/ImageCaptureCamera2Interop, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block )` Applies Camera2 options inside an `https://developer.android.com/reference/androidx/camera/core/ImageCaptureScope` DSL block. |
| `static final void` | `<B extends https://developer.android.com/reference/androidx/camera/core/UseCase.InteropConfigurable<@https://developer.android.com/reference/androidx/annotation/NonNull B>> https://developer.android.com/reference/androidx/camera/camera2/interop/Camera2InteropEx#(androidx.camera.core.InteropConfigurableScope).camera2Interop(kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/core/InteropConfigurableScope<@https://developer.android.com/reference/androidx/annotation/NonNull B> receiver, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/camera2/interop/UseCaseCamera2Interop, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block )` Applies Camera2 options inside an `https://developer.android.com/reference/androidx/camera/core/InteropConfigurableScope` DSL block. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/core/SessionConfig.Builder` | `https://developer.android.com/reference/androidx/camera/camera2/interop/Camera2InteropEx#(androidx.camera.core.SessionConfig.Builder).camera2Interop(kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/core/SessionConfig.Builder receiver, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigCamera2Interop, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block )` Applies Camera2 options to a `https://developer.android.com/reference/androidx/camera/core/SessionConfig.Builder`. |
| `static final void` | `https://developer.android.com/reference/androidx/camera/camera2/interop/Camera2InteropEx#(androidx.camera.core.SessionConfigScope).camera2Interop(kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/core/SessionConfigScope receiver, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigCamera2Interop, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block )` Applies Camera2 options inside a `https://developer.android.com/reference/androidx/camera/core/SessionConfigScope` DSL block. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull B` | `<B extends https://developer.android.com/reference/androidx/camera/core/UseCase.InteropConfigurable<@https://developer.android.com/reference/androidx/annotation/NonNull B>> https://developer.android.com/reference/androidx/camera/camera2/interop/Camera2InteropEx#(androidx.camera.core.UseCase.InteropConfigurable).camera2Interop(kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull B receiver, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/camera2/interop/UseCaseCamera2Interop, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block )` Applies Camera2 options to a UseCase builder. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html` | `https://developer.android.com/reference/androidx/camera/camera2/interop/Camera2InteropEx#(androidx.camera.core.CameraInfo).getCameraCharacteristics()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/core/CameraInfo receiver)` Returns the `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html` from this `https://developer.android.com/reference/androidx/camera/core/CameraInfo`. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/camera/camera2/interop/Camera2InteropEx#(androidx.camera.core.CameraInfo).getCameraId()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/core/CameraInfo receiver)` Returns the Camera2 camera ID from this `https://developer.android.com/reference/androidx/camera/core/CameraInfo`. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/core/CameraSelector` | `https://developer.android.com/reference/androidx/camera/camera2/interop/Camera2InteropEx#(kotlin.String).toCameraSelector()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html receiver)` Creates a `https://developer.android.com/reference/androidx/camera/core/CameraSelector` targeting this camera ID string. |

## Public methods

### applyCamera2Interop

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

```
public static final void applyCamera2Interop(
    @NonNull CameraControl receiver,
    @NonNull Function1<@NonNull CameraControlCamera2Interop, Unit> block
)
```

Applies Camera2 options to a `https://developer.android.com/reference/androidx/camera/core/CameraControl` asynchronously within a coroutine.

Dynamically updates repeating capture request parameters or capture request keys on an active camera session. Options configured within a single `https://developer.android.com/reference/androidx/camera/camera2/interop/package-summary#(androidx.camera.core.CameraControl).applyCamera2Interop(kotlin.Function1)` are applied atomically in a single repeating capture request update. Subsequent calls to `https://developer.android.com/reference/androidx/camera/camera2/interop/package-summary#(androidx.camera.core.CameraControl).applyCamera2Interop(kotlin.Function1)` update parameters incrementally without clearing previously set keys, unless explicitly cleared using `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#clearCaptureRequestOption(android.hardware.camera2.CaptureRequest.Key)` or `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#clearAllCaptureRequestOptions()`. This overwrites options set with `https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigCamera2Interop` via `https://developer.android.com/reference/androidx/camera/core/SessionConfig.Builder#setInterop(androidx.camera.core.InteropConfigurator)` (or `https://developer.android.com/reference/androidx/camera/camera2/interop/package-summary#(androidx.camera.core.SessionConfig.Builder).camera2Interop(kotlin.Function1)`).

This function suspends until all specified interoperability options have been successfully updated in the underlying repeating capture request. Throws `https://developer.android.com/reference/androidx/camera/core/CameraControl.OperationCanceledException` if a newer configuration is applied before this operation takes effect or if the camera is closed.

Options configured via `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraControlCamera2Interop` include:

- Capture request key-value pairs (`https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#captureRequest()` via `captureRequest[...]` or `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#setCaptureRequestOption(android.hardware.camera2.CaptureRequest.Key,kotlin.Any)`)

- Clearing specific capture request keys (`https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#clearCaptureRequestOption(android.hardware.camera2.CaptureRequest.Key)`)

- Clearing all capture request keys (`https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#clearAllCaptureRequestOptions()`)

- Capture request template type (`https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#repeatingCaptureRequestTemplate()`)

- Repeating capture callbacks (`https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#setRepeatingCaptureCallback(java.util.concurrent.Executor,android.hardware.camera2.CameraCaptureSession.CaptureCallback)` or `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#repeatingCaptureCallback()`)

**Note:** Using Camera2 interop options can override internal CameraX configurations. If an option configured via interop conflicts with options required by CameraX internally, the option from Camera2Interop will override, which may result in unexpected behavior or interfere with 3A routines and camera control APIs.

**Warning:** Callbacks configured via interop receive 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)`

```kotlin
import androidx.camera.camera2.interop.applyCamera2Interop

cameraControl.applyCamera2Interop {
    captureRequest[CaptureRequest.CONTROL_AE_MODE] = CaptureRequest.CONTROL_AE_MODE_OFF
    repeatingCaptureCallback = object : CameraCaptureSession.CaptureCallback() {}
}
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/camera2/interop/CameraControlCamera2Interop, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block` | configuration block setting Camera2 options on `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraControlCamera2Interop` |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/camera/core/CameraControl.OperationCanceledException` | if a newer configuration is applied before this operation takes effect or if the camera is closed |

### applyCamera2InteropAsync

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

```
public static final @NonNull ListenableFuture<@NonNull Void> applyCamera2InteropAsync(
    @NonNull CameraControl receiver,
    @NonNull Function1<@NonNull CameraControlCamera2Interop, Unit> block
)
```

Applies Camera2 options to a `https://developer.android.com/reference/androidx/camera/core/CameraControl` asynchronously.

Dynamically updates repeating capture request parameters or capture request keys on an active camera session. Options configured within a single `https://developer.android.com/reference/androidx/camera/camera2/interop/package-summary#(androidx.camera.core.CameraControl).applyCamera2InteropAsync(kotlin.Function1)` are applied atomically in a single repeating capture request update. Subsequent calls to `https://developer.android.com/reference/androidx/camera/camera2/interop/package-summary#(androidx.camera.core.CameraControl).applyCamera2InteropAsync(kotlin.Function1)` update parameters incrementally without clearing previously set keys, unless explicitly cleared using `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#clearCaptureRequestOption(android.hardware.camera2.CaptureRequest.Key)` or `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#clearAllCaptureRequestOptions()`. This overwrites options set with `https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigCamera2Interop` via `https://developer.android.com/reference/androidx/camera/core/SessionConfig.Builder#setInterop(androidx.camera.core.InteropConfigurator)` (or `https://developer.android.com/reference/androidx/camera/camera2/interop/package-summary#(androidx.camera.core.SessionConfig.Builder).camera2Interop(kotlin.Function1)`).

Options configured via `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraControlCamera2Interop` include:

- Capture request key-value pairs (`https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#captureRequest()` via `captureRequest[...]` or `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#setCaptureRequestOption(android.hardware.camera2.CaptureRequest.Key,kotlin.Any)`)

- Clearing specific capture request keys (`https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#clearCaptureRequestOption(android.hardware.camera2.CaptureRequest.Key)`)

- Clearing all capture request keys (`https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#clearAllCaptureRequestOptions()`)

- Capture request template type (`https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#repeatingCaptureRequestTemplate()`)

- Repeating capture callbacks (`https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#setRepeatingCaptureCallback(java.util.concurrent.Executor,android.hardware.camera2.CameraCaptureSession.CaptureCallback)` or `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#repeatingCaptureCallback()`)

**Note:** Using Camera2 interop options can override internal CameraX configurations. If an option configured via interop conflicts with options required by CameraX internally, the option from Camera2Interop will override, which may result in unexpected behavior or interfere with 3A routines and camera control APIs.

**Warning:** Callbacks configured via interop receive 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)`

```kotlin
import androidx.camera.camera2.interop.applyCamera2Interop
import androidx.camera.camera2.interop.applyCamera2InteropAsync

cameraControl.applyCamera2InteropAsync {
    captureRequest[CaptureRequest.CONTROL_AE_MODE] = CaptureRequest.CONTROL_AE_MODE_OFF
    repeatingCaptureCallback = object : CameraCaptureSession.CaptureCallback() {}
}
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/camera2/interop/CameraControlCamera2Interop, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block` | configuration block setting Camera2 options on `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraControlCamera2Interop` |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Void.html>` | `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html` completing with `null` when all specified interoperability options have been successfully updated in the underlying repeating capture request. The future fails with `https://developer.android.com/reference/androidx/camera/core/CameraControl.OperationCanceledException` if a newer configuration is applied before this operation takes effect or if the camera is closed. Cancelling the future is a no-op. |

### camera2Interop

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

```
public static final @NonNull ImageCapture.Builder camera2Interop(
    @NonNull ImageCapture.Builder receiver,
    @NonNull Function1<@NonNull ImageCaptureCamera2Interop, Unit> block
)
```

Applies Camera2 options to an `https://developer.android.com/reference/androidx/camera/core/ImageCapture.Builder`.

Configures Camera2 options specific to `https://developer.android.com/reference/androidx/camera/core/ImageCapture.Builder`.

Options configured via `https://developer.android.com/reference/androidx/camera/camera2/interop/ImageCaptureCamera2Interop` include:

- Physical camera ID (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#physicalCameraId()`)

- Stream use case (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#streamUseCase()`)

- Mirror mode (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#mirrorMode()`)

- Timestamp base (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#timestampBase()`)

- Dynamic range profile (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#dynamicRangeProfile()`)

- Surface group ID (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#surfaceGroupId()`)

- Still capture request key-value pairs (`https://developer.android.com/reference/androidx/camera/camera2/interop/StillCaptureInterop#stillCaptureRequest()` via `stillCaptureRequest[...]` or `https://developer.android.com/reference/androidx/camera/camera2/interop/StillCaptureInterop#setStillCaptureRequestOption(android.hardware.camera2.CaptureRequest.Key,kotlin.Any)`)

- Still capture request template type (`https://developer.android.com/reference/androidx/camera/camera2/interop/StillCaptureInterop#stillCaptureRequestTemplateType()`)

- Still capture callbacks (`https://developer.android.com/reference/androidx/camera/camera2/interop/StillCaptureInterop#setStillCaptureCallback(java.util.concurrent.Executor,android.hardware.camera2.CameraCaptureSession.CaptureCallback)` or `https://developer.android.com/reference/androidx/camera/camera2/interop/StillCaptureInterop#stillCaptureCallback()`)

**Note:** Using Camera2 interop options can override internal CameraX configurations. The capture request keys for one-shot still captures (such as `https://developer.android.com/reference/androidx/camera/core/ImageCapture#takePicture(java.util.concurrent.Executor,androidx.camera.core.ImageCapture.OnImageCapturedCallback)`) are determined by copying all repeating request keys (which may include keys added via `https://developer.android.com/reference/androidx/camera/core/SessionConfig.Builder#setInterop(androidx.camera.core.InteropConfigurator)` or `https://developer.android.com/reference/androidx/camera/core/CameraControl#applyInteropAsync(androidx.camera.core.InteropConfigurator<? super androidx.camera.core.CameraControl>)`) and then overriding them with the still capture request keys configured here. If an option configured via interop conflicts with options required by CameraX internally, the option from Camera2Interop will override, which may result in unexpected behavior.

**Warning:** Callbacks configured via interop receive 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)`

```kotlin
import androidx.camera.camera2.interop.camera2Interop
import androidx.camera.core.ImageCapture
import androidx.camera.core.imageCapture

val imageCapture =
    ImageCapture.Builder()
        .camera2Interop {
            stillCaptureRequestTemplateType = CameraDevice.TEMPLATE_STILL_CAPTURE
            stillCaptureRequest[CaptureRequest.CONTROL_AF_MODE] =
                CaptureRequest.CONTROL_AF_MODE_OFF
            stillCaptureCallback =
                object : CameraCaptureSession.CaptureCallback() {
                    override fun onCaptureCompleted(
                        session: CameraCaptureSession,
                        request: CaptureRequest,
                        result: TotalCaptureResult,
                    ) {}
                }
            physicalCameraId = "5"
        }
        .build()
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/camera2/interop/ImageCaptureCamera2Interop, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block` | configuration block setting Camera2 options on `https://developer.android.com/reference/androidx/camera/camera2/interop/ImageCaptureCamera2Interop` |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/core/ImageCapture.Builder` | this builder |

### camera2Interop

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

```
public static final void camera2Interop(
    @NonNull ImageCaptureScope receiver,
    @NonNull Function1<@NonNull ImageCaptureCamera2Interop, Unit> block
)
```

Applies Camera2 options inside an `https://developer.android.com/reference/androidx/camera/core/ImageCaptureScope` DSL block.

Configures Camera2 options on the underlying `https://developer.android.com/reference/androidx/camera/core/ImageCapture.Builder` within an `imageCapture { ... }` DSL block.

Options configured via `https://developer.android.com/reference/androidx/camera/camera2/interop/ImageCaptureCamera2Interop` include:

- Physical camera ID (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#physicalCameraId()`)

- Stream use case (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#streamUseCase()`)

- Mirror mode (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#mirrorMode()`)

- Timestamp base (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#timestampBase()`)

- Dynamic range profile (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#dynamicRangeProfile()`)

- Surface group ID (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#surfaceGroupId()`)

- Still capture request key-value pairs (`https://developer.android.com/reference/androidx/camera/camera2/interop/StillCaptureInterop#stillCaptureRequest()` via `stillCaptureRequest[...]` or `https://developer.android.com/reference/androidx/camera/camera2/interop/StillCaptureInterop#setStillCaptureRequestOption(android.hardware.camera2.CaptureRequest.Key,kotlin.Any)`)

- Still capture request template type (`https://developer.android.com/reference/androidx/camera/camera2/interop/StillCaptureInterop#stillCaptureRequestTemplateType()`)

- Still capture callbacks (`https://developer.android.com/reference/androidx/camera/camera2/interop/StillCaptureInterop#setStillCaptureCallback(java.util.concurrent.Executor,android.hardware.camera2.CameraCaptureSession.CaptureCallback)` or `https://developer.android.com/reference/androidx/camera/camera2/interop/StillCaptureInterop#stillCaptureCallback()`)

**Note:** Using Camera2 interop options can override internal CameraX configurations. The capture request keys for one-shot still captures (such as `https://developer.android.com/reference/androidx/camera/core/ImageCapture#takePicture(java.util.concurrent.Executor,androidx.camera.core.ImageCapture.OnImageCapturedCallback)`) are determined by copying all repeating request keys (which may include keys added via `https://developer.android.com/reference/androidx/camera/core/SessionConfig.Builder#setInterop(androidx.camera.core.InteropConfigurator)` or `https://developer.android.com/reference/androidx/camera/core/CameraControl#applyInteropAsync(androidx.camera.core.InteropConfigurator<? super androidx.camera.core.CameraControl>)`) and then overriding them with the still capture request keys configured here. If an option configured via interop conflicts with options required by CameraX internally, the option from Camera2Interop will override, which may result in unexpected behavior.

**Warning:** Callbacks configured via interop receive 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)`

```kotlin
import androidx.camera.camera2.interop.camera2Interop
import androidx.camera.core.imageCapture

val imageCapture = imageCapture {
    camera2Interop {
        stillCaptureRequestTemplateType = CameraDevice.TEMPLATE_PREVIEW
        stillCaptureRequest[CaptureRequest.CONTROL_AF_MODE] = CaptureRequest.CONTROL_AF_MODE_OFF
        stillCaptureCallback =
            object : CameraCaptureSession.CaptureCallback() {
                override fun onCaptureCompleted(
                    session: CameraCaptureSession,
                    request: CaptureRequest,
                    result: TotalCaptureResult,
                ) {}
            }
        physicalCameraId = "5"
    }
}
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/camera2/interop/ImageCaptureCamera2Interop, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block` | configuration block setting Camera2 options on `https://developer.android.com/reference/androidx/camera/camera2/interop/ImageCaptureCamera2Interop` |

### camera2Interop

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/Camera2InteropEx.kt+function:camera2Interop)

```
public static final void <B extends UseCase.InteropConfigurable<@NonNull B>> camera2Interop(
    @NonNull InteropConfigurableScope<@NonNull B> receiver,
    @NonNull Function1<@NonNull UseCaseCamera2Interop, Unit> block
)
```

Applies Camera2 options inside an `https://developer.android.com/reference/androidx/camera/core/InteropConfigurableScope` DSL block.

Configures Camera2 options on the underlying UseCase builder within Kotlin DSL blocks such as `preview { ... }`, `imageAnalysis { ... }`, or `videoCapture { ... }`. For `imageCapture { ... }`, use the dedicated `https://developer.android.com/reference/androidx/camera/camera2/interop/package-summary#(androidx.camera.core.ImageCaptureScope).camera2Interop(kotlin.Function1)` extension function.

Options configured via `https://developer.android.com/reference/androidx/camera/camera2/interop/UseCaseCamera2Interop` include:

- Physical camera ID (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#physicalCameraId()`)

- Stream use case (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#streamUseCase()`)

- Mirror mode (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#mirrorMode()`)

- Timestamp base (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#timestampBase()`)

- Dynamic range profile (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#dynamicRangeProfile()`)

- Surface group ID (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#surfaceGroupId()`)

**Note:** Using Camera2 interop options can override internal CameraX configurations. If an option configured via interop conflicts with options required by CameraX internally, the option from Camera2Interop will override, which may result in unexpected behavior.

```kotlin
import androidx.camera.camera2.interop.camera2Interop
import androidx.camera.core.preview

val preview = preview {
    camera2Interop {
        physicalCameraId = "0"
        mirrorMode = OutputConfiguration.MIRROR_MODE_H
    }
}
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/camera2/interop/UseCaseCamera2Interop, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block` | configuration block setting Camera2 options on `https://developer.android.com/reference/androidx/camera/camera2/interop/UseCaseCamera2Interop` |

### camera2Interop

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

```
public static final @NonNull SessionConfig.Builder camera2Interop(
    @NonNull SessionConfig.Builder receiver,
    @NonNull Function1<@NonNull SessionConfigCamera2Interop, Unit> block
)
```

Applies Camera2 options to a `https://developer.android.com/reference/androidx/camera/core/SessionConfig.Builder`.

Configures Camera2 options for a capture session builder. Can be called on a `https://developer.android.com/reference/androidx/camera/core/SessionConfig.Builder` directly or within a `https://developer.android.com/reference/androidx/camera/core/package-summary#sessionConfig(kotlin.collections.List,kotlin.Function1)` DSL block.

Options configured via `https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigCamera2Interop` include:

- Session parameters (`https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigurationInterop#sessionParameter()` via `sessionParameter[...]` or `https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigurationInterop#setSessionParameter(android.hardware.camera2.CaptureRequest.Key,kotlin.Any)`)

- Session type (`https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigurationInterop#sessionType()`)

- Color space (`https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigurationInterop#colorSpace()`)

- Session state callbacks (`https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigurationInterop#setSessionStateCallback(java.util.concurrent.Executor,android.hardware.camera2.CameraCaptureSession.StateCallback)` or `https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigurationInterop#sessionStateCallback()`)

- Device state callbacks (`https://developer.android.com/reference/androidx/camera/camera2/interop/CameraDeviceInterop#setDeviceStateCallback(java.util.concurrent.Executor,android.hardware.camera2.CameraDevice.StateCallback)` or `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraDeviceInterop#deviceStateCallback()`)

- Capture request key-value pairs (`https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#captureRequest()` via `captureRequest[...]` or `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#setCaptureRequestOption(android.hardware.camera2.CaptureRequest.Key,kotlin.Any)`)

- Clearing specific capture request keys (`https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#clearCaptureRequestOption(android.hardware.camera2.CaptureRequest.Key)`)

- Clearing all capture request keys (`https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#clearAllCaptureRequestOptions()`)

- Capture request template type (`https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#repeatingCaptureRequestTemplate()`)

- Repeating capture callbacks (`https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#setRepeatingCaptureCallback(java.util.concurrent.Executor,android.hardware.camera2.CameraCaptureSession.CaptureCallback)` or `https://developer.android.com/reference/androidx/camera/camera2/interop/CameraCaptureSessionInterop#repeatingCaptureCallback()`)

**Note:** Using Camera2 interop options can override internal CameraX configurations. If an option configured via interop conflicts with options required by CameraX internally, the option from Camera2Interop will override, which may result in unexpected behavior.

**Warning:** Callbacks configured via interop receive raw `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.html` and `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:

- On `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.html`: `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.html#close()` or session creation methods (`https://developer.android.com/reference/android/hardware/camera2/CameraDevice.html#createCaptureSession(android.hardware.camera2.params.SessionConfiguration)`, `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.html#createCaptureSessionByOutputConfigurations(java.util.List&lt;android.hardware.camera2.params.OutputConfiguration&gt;, android.hardware.camera2.CameraCaptureSession.StateCallback, android.os.Handler)`, `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.html#createReprocessableCaptureSession(android.hardware.camera2.params.InputConfiguration, java.util.List&lt;android.view.Surface&gt;, android.hardware.camera2.CameraCaptureSession.StateCallback, android.os.Handler)`, `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.html#createExtensionSession(android.hardware.camera2.params.ExtensionSessionConfiguration)`)

- On `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html`: lifecycle methods (`https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#close()`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#abortCaptures()`, `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)`, `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)`), or surface 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)`, `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)`)

```kotlin
import androidx.camera.camera2.interop.camera2Interop
import androidx.camera.core.SessionConfig
import androidx.camera.core.preview
import androidx.camera.core.sessionConfig

val sessionConfig =
    SessionConfig.Builder(preview)
        .camera2Interop {
            colorSpace = ColorSpace.Named.DISPLAY_P3
            sessionParameter[CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE] = Range(60, 60)
            captureRequest[CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE] = Range(60, 60)
            repeatingCaptureRequestTemplate = CameraDevice.TEMPLATE_PREVIEW
            repeatingCaptureCallback = object : CameraCaptureSession.CaptureCallback() {}
        }
        .build()
```

```kotlin
import androidx.camera.camera2.interop.camera2Interop
import androidx.camera.core.preview
import androidx.camera.core.sessionConfig

val sessionConfig =
    sessionConfig(listOf(preview)) {
        camera2Interop {
            colorSpace = ColorSpace.Named.DISPLAY_P3
            sessionParameter[CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE] = Range(60, 60)
            captureRequest[CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE] = Range(60, 60)
            repeatingCaptureRequestTemplate = CameraDevice.TEMPLATE_PREVIEW
            repeatingCaptureCallback = object : CameraCaptureSession.CaptureCallback() {}
        }
    }
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigCamera2Interop, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block` | configuration block setting Camera2 options on `https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigCamera2Interop` |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/core/SessionConfig.Builder` | this builder |

### camera2Interop

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

```
public static final void camera2Interop(
    @NonNull SessionConfigScope receiver,
    @NonNull Function1<@NonNull SessionConfigCamera2Interop, Unit> block
)
```

Applies Camera2 options inside a `https://developer.android.com/reference/androidx/camera/core/SessionConfigScope` DSL block.

Configures Camera2 options on the underlying `https://developer.android.com/reference/androidx/camera/core/SessionConfig.Builder` within a `sessionConfig { ... }` DSL block.

```kotlin
import androidx.camera.camera2.interop.camera2Interop
import androidx.camera.core.preview
import androidx.camera.core.sessionConfig

val sessionConfig =
    sessionConfig(listOf(preview)) {
        camera2Interop {
            colorSpace = ColorSpace.Named.DISPLAY_P3
            sessionParameter[CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE] = Range(60, 60)
            captureRequest[CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE] = Range(60, 60)
            repeatingCaptureRequestTemplate = CameraDevice.TEMPLATE_PREVIEW
            repeatingCaptureCallback = object : CameraCaptureSession.CaptureCallback() {}
        }
    }
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigCamera2Interop, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block` | configuration block setting Camera2 options on `https://developer.android.com/reference/androidx/camera/camera2/interop/SessionConfigCamera2Interop` |

### camera2Interop

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

```
public static final @NonNull B <B extends UseCase.InteropConfigurable<@NonNull B>> camera2Interop(
    @NonNull B receiver,
    @NonNull Function1<@NonNull UseCaseCamera2Interop, Unit> block
)
```

Applies Camera2 options to a UseCase builder.

Configures Camera2 options on builders implementing `https://developer.android.com/reference/androidx/camera/core/UseCase.InteropConfigurable` (such as `https://developer.android.com/reference/androidx/camera/core/Preview.Builder`, `https://developer.android.com/reference/androidx/camera/core/ImageAnalysis.Builder`, or `https://developer.android.com/reference/androidx/camera/video/VideoCapture.Builder`). For `https://developer.android.com/reference/androidx/camera/core/ImageCapture.Builder`, use the dedicated `https://developer.android.com/reference/androidx/camera/camera2/interop/package-summary#(androidx.camera.core.ImageCapture.Builder).camera2Interop(kotlin.Function1)` extension function.

Options configured via `https://developer.android.com/reference/androidx/camera/camera2/interop/UseCaseCamera2Interop` include:

- Physical camera ID (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#physicalCameraId()`)

- Stream use case (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#streamUseCase()`)

- Mirror mode (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#mirrorMode()`)

- Timestamp base (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#timestampBase()`)

- Dynamic range profile (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#dynamicRangeProfile()`)

- Surface group ID (`https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#surfaceGroupId()`)

**Note:** Using Camera2 interop options can override internal CameraX configurations. If an option configured via interop conflicts with options required by CameraX internally, the option from Camera2Interop will override, which may result in unexpected behavior.

```kotlin
import androidx.camera.camera2.interop.camera2Interop
import androidx.camera.core.Preview
import androidx.camera.core.preview

val preview =
    Preview.Builder()
        .camera2Interop {
            physicalCameraId = "5"
            mirrorMode = OutputConfiguration.MIRROR_MODE_H
        }
        .build()
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/camera2/interop/UseCaseCamera2Interop, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block` | configuration block setting Camera2 options on `https://developer.android.com/reference/androidx/camera/camera2/interop/UseCaseCamera2Interop` |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull B` | this builder |

### getCameraCharacteristics

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

```
public static final @NonNull CameraCharacteristics getCameraCharacteristics(@NonNull CameraInfo receiver)
```

Returns the `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html` from this `https://developer.android.com/reference/androidx/camera/core/CameraInfo`.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if this `https://developer.android.com/reference/androidx/camera/core/CameraInfo` does not contain Camera2 information |

### getCameraId

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

```
public static final @NonNull String getCameraId(@NonNull CameraInfo receiver)
```

Returns the Camera2 camera ID from this `https://developer.android.com/reference/androidx/camera/core/CameraInfo`.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if this `https://developer.android.com/reference/androidx/camera/core/CameraInfo` does not contain Camera2 information |

### toCameraSelector

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

```
public static final @NonNull CameraSelector toCameraSelector(@NonNull String receiver)
```

Creates a `https://developer.android.com/reference/androidx/camera/core/CameraSelector` targeting this camera ID string.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/core/CameraSelector` | `https://developer.android.com/reference/androidx/camera/core/CameraSelector` matching this camera ID |