# ImageCaptureCamera2Interop

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/InteropTargetInterfaces.kt+class:androidx.camera.camera2.interop.ImageCaptureCamera2Interop) Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

*** ** * ** ***


```
@CameraXDsl
abstract class ImageCaptureCamera2Interop : OutputConfigurationInterop, StillCaptureInterop
```

<br />

*** ** * ** ***

Configures Camera2 options on an `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageCapture` use case.

Provides setters for output stream options and still capture request settings (such as still capture request keys, template types, and capture callbacks). The capture request keys for one-shot still captures (such as `https://developer.android.com/reference/kotlin/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/kotlin/androidx/camera/core/SessionConfig.Builder#setInterop(androidx.camera.core.InteropConfigurator)` or `https://developer.android.com/reference/kotlin/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.

**Warning:** Callbacks configured on this target (such as `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback.html`) 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)`

## Summary

### Inherited functions

From [androidx.camera.camera2.interop.OutputConfigurationInterop](https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/OutputConfigurationInterop) `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 31)
https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/OutputConfigurationInterop#addSensorPixelModeUsed(kotlin.Int)(sensorPixelMode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Adds a sensor pixel mode that this output configuration will be used in.
From [androidx.camera.camera2.interop.StillCaptureInterop](https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/StillCaptureInterop) `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/StillCaptureInterop#setStillCaptureCallback(java.util.concurrent.Executor,android.hardware.camera2.CameraCaptureSession.CaptureCallback)(
executor: https://developer.android.com/reference/java/util/concurrent/Executor.html,
callback: https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback.html
)`

Sets the callback to receive still capture updates with an executor.
`abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `<V : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/StillCaptureInterop#setStillCaptureRequestOption(android.hardware.camera2.CaptureRequest.Key,kotlin.Any)(key: https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html<V>, value: V)`

Sets a `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html` and value for still capture requests.

### Inherited properties

From [androidx.camera.camera2.interop.OutputConfigurationInterop](https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/OutputConfigurationInterop) `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/OutputConfigurationInterop#dynamicRangeProfile()`

The dynamic range profile.
`abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/OutputConfigurationInterop#mirrorMode()`

The mirror mode.
`abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/OutputConfigurationInterop#physicalCameraId()`

The physical camera ID.
`abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>` `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/OutputConfigurationInterop#sensorPixelModesUsed()`

The sensor pixel modes that this output configuration will be used in.
`abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/OutputConfigurationInterop#streamUseCase()`

The stream use case.
`abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/OutputConfigurationInterop#surfaceGroupId()`

The surface group ID.
`abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/OutputConfigurationInterop#timestampBase()`

The timestamp base.
From [androidx.camera.camera2.interop.StillCaptureInterop](https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/StillCaptureInterop) `abstract https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback.html?` `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/StillCaptureInterop#stillCaptureCallback()`

The callback to receive still capture updates on a direct executor.
`open https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/StillCaptureRequestOptionTarget` `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/StillCaptureInterop#stillCaptureRequest()`

Helper target property supporting `stillCaptureRequest[key] = value` indexing operator syntax.
`abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/StillCaptureInterop#stillCaptureRequestTemplateType()`

The template type for still capture requests.