# 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
public abstract class ImageCaptureCamera2Interop implements OutputConfigurationInterop, StillCaptureInterop
```

<br />

*** ** * ** ***

Configures Camera2 options on an `https://developer.android.com/reference/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/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.

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

From [androidx.camera.camera2.interop.OutputConfigurationInterop](https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop) `abstract void` `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 31)
https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#addSensorPixelModeUsed(kotlin.Int)(int sensorPixelMode)`

Adds a sensor pixel mode that this output configuration will be used in.
`abstract long` `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 33)
https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#getDynamicRangeProfile()()`

The dynamic range profile.
`abstract int` `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 33)
https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#getMirrorMode()()`

The mirror mode.
`abstract https://developer.android.com/reference/java/lang/String.html` `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 28)
https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#getPhysicalCameraId()()`

The physical camera ID.
`abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html>` `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 31)
https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#getSensorPixelModesUsed()()`

The sensor pixel modes that this output configuration will be used in.
`abstract long` `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 33)
https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#getStreamUseCase()()`

The stream use case.
`abstract int` `https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#getSurfaceGroupId()()`

The surface group ID.
`abstract int` `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 33)
https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#getTimestampBase()()`

The timestamp base.
`abstract void` `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 33)
https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#setDynamicRangeProfile(kotlin.Long)(long value)`

The dynamic range profile.
`abstract void` `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 33)
https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#setMirrorMode(kotlin.Int)(int value)`

The mirror mode.
`abstract void` `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 28)
https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#setPhysicalCameraId(kotlin.String)(https://developer.android.com/reference/java/lang/String.html value)`

The physical camera ID.
`abstract void` `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 31)
https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#setSensorPixelModesUsed(kotlin.collections.Set)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html> value)`

The sensor pixel modes that this output configuration will be used in.
`abstract void` `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 33)
https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#setStreamUseCase(kotlin.Long)(long value)`

The stream use case.
`abstract void` `https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#setSurfaceGroupId(kotlin.Int)(int value)`

The surface group ID.
`abstract void` `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 33)
https://developer.android.com/reference/androidx/camera/camera2/interop/OutputConfigurationInterop#setTimestampBase(kotlin.Int)(int value)`

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

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

Helper target property supporting `stillCaptureRequest[key] = value` indexing operator syntax.
`abstract int` `https://developer.android.com/reference/androidx/camera/camera2/interop/StillCaptureInterop#getStillCaptureRequestTemplateType()()`

The template type for still capture requests.
`abstract void` `https://developer.android.com/reference/androidx/camera/camera2/interop/StillCaptureInterop#setStillCaptureCallback(android.hardware.camera2.CameraCaptureSession.CaptureCallback)(https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback.html value)`

The callback to receive still capture updates on a direct executor.
`abstract void` `https://developer.android.com/reference/androidx/camera/camera2/interop/StillCaptureInterop#setStillCaptureCallback(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 still capture updates with an executor.
`abstract void` `<V extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/camera/camera2/interop/StillCaptureInterop#setStillCaptureRequestOption(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 for still capture requests.
`abstract void` `https://developer.android.com/reference/androidx/camera/camera2/interop/StillCaptureInterop#setStillCaptureRequestTemplateType(kotlin.Int)(int value)`

The template type for still capture requests.