# UseCase.InteropConfigurable

Artifact: [androidx.camera:camera-core](https://developer.android.com/jetpack/androidx/releases/camera) [View Source](https://cs.android.com/search?q=file:androidx/camera/core/UseCase.java+class:androidx.camera.core.UseCase.InteropConfigurable) Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

*** ** * ** ***


```
public interface UseCase.InteropConfigurable<B extends UseCase.InteropConfigurable<B>>
```

<br />

Known direct subclasses [ImageAnalysis.Builder](https://developer.android.com/reference/androidx/camera/core/ImageAnalysis.Builder), [Preview.Builder](https://developer.android.com/reference/androidx/camera/core/Preview.Builder), [VideoCapture.Builder](https://developer.android.com/reference/androidx/camera/video/VideoCapture.Builder)

|---|---|
| `https://developer.android.com/reference/androidx/camera/core/ImageAnalysis.Builder` | Builder for a `https://developer.android.com/reference/androidx/camera/core/ImageAnalysis`. |
| `https://developer.android.com/reference/androidx/camera/core/Preview.Builder` | Builder for a `https://developer.android.com/reference/androidx/camera/core/Preview`. |
| `https://developer.android.com/reference/androidx/camera/video/VideoCapture.Builder` | Builder for a `https://developer.android.com/reference/androidx/camera/video/VideoCapture`. |

*** ** * ** ***

Applies camera-backend-specific options.

Implementations (such as `https://developer.android.com/reference/androidx/camera/core/UseCase` builders) support applying backend-specific configurations, such as Camera2 capture request options.

| Parameters |
|---|---|
| `<B extends https://developer.android.com/reference/androidx/camera/core/UseCase.InteropConfigurable<B>>` | the type of the builder implementing this interface |

## Summary

| ### Public methods |
|---|---|
| `default @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html B` | `https://developer.android.com/reference/androidx/camera/core/UseCase.InteropConfigurable#setInterop(androidx.camera.core.InteropConfigurator<? super B>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/InteropConfigurator<B> configurator)` Applies interoperability configuration to this builder. |

| ### Extension functions |
|---|---|
| `default 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/core/Camera2InteropEx.https://developer.android.com/reference/androidx/camera/core/UseCase.InteropConfigurable#(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. |

## Public methods

### setInterop

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

```
default @NonNull B setInterop(@NonNull InteropConfigurator<B> configurator)
```

Applies interoperability configuration to this builder.

To configure Camera2 options, use `Camera2Interop.forUseCase(configurator)` (from the `camera-camera2` artifact) to create a configurator, then pass it to this method.

**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.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/InteropConfigurator<B> configurator` | the configurator that sets the interoperability options |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html B` | this builder |

## Extension functions

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

```
default final @NonNull B <B extends UseCase.InteropConfigurable<@NonNull B>> Camera2InteropEx.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 |