> Documentation index: https://developer.android.com/reference/llms.txt

# SessionConfigScope

Artifact: [androidx.camera:camera-core](https://developer.android.com/jetpack/androidx/releases/camera.md.txt) [View Source](https://cs.android.com/search?q=file:androidx/camera/core/SessionConfig.kt+class:androidx.camera.core.SessionConfigScope) Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/camera.md.txt#1.7.0)

*** ** * ** ***


```
@CameraXDsl
public final class SessionConfigScope
```

<br />

*** ** * ** ***

Scope class for `SessionConfig` configuration DSL.

## Summary

| ### Public methods |
|---|---|
| `final @NonNull List<@NonNull CameraEffect>` | `getEffects()` The list of `CameraEffect` to be applied on the camera session. |
| `final @NonNull Range<@NonNull Integer>` | `getFrameRateRange()` The desired frame rate range for the camera session. |
| `final @NonNull List<@NonNull GroupableFeature>` | `getPreferredFeatureGroup()` The list of preferred `GroupableFeature`, ordered by priority in descending order. |
| `final @NonNull Set<@NonNull GroupableFeature>` | `getRequiredFeatureGroup()` The set of `GroupableFeature` that are mandatory for the camera configuration. |
| `final @Nullable ViewPort` | `getViewPort()` The `ViewPort` to be applied on the camera session. |
| `final boolean` | `isAutoRotationEnabled()` Whether to use auto rotation. |
| `final void` | `setAutoRotationEnabled(boolean value)` Whether to use auto rotation. |
| `final void` | `setEffects(@NonNull List<@NonNull CameraEffect> value)` The list of `CameraEffect` to be applied on the camera session. |
| `final void` | `setFrameRateRange(@NonNull Range<@NonNull Integer> value)` The desired frame rate range for the camera session. |
| `final void` | `setPreferredFeatureGroup(@NonNull List<@NonNull GroupableFeature> value)` The list of preferred `GroupableFeature`, ordered by priority in descending order. |
| `final void` | `setRequiredFeatureGroup(@NonNull Set<@NonNull GroupableFeature> value)` The set of `GroupableFeature` that are mandatory for the camera configuration. |
| `final void` | `setViewPort(ViewPort value)` The `ViewPort` to be applied on the camera session. |

| ### Extension functions |
|---|---|
| `final void` | `Camera2InteropEx.camera2Interop( @NonNull SessionConfigScope receiver, @NonNull Function1<@NonNull SessionConfigCamera2Interop, Unit> block )` Applies Camera2 options inside a `SessionConfigScope` DSL block. |

## Public methods

### getEffects

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

```
public final @NonNull List<@NonNull CameraEffect> getEffects()
```

The list of `CameraEffect` to be applied on the camera session.

### getFrameRateRange

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

```
public final @NonNull Range<@NonNull Integer> getFrameRateRange()
```

The desired frame rate range for the camera session.

### getPreferredFeatureGroup

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

```
public final @NonNull List<@NonNull GroupableFeature> getPreferredFeatureGroup()
```

The list of preferred `GroupableFeature`, ordered by priority in descending order.

### getRequiredFeatureGroup

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

```
public final @NonNull Set<@NonNull GroupableFeature> getRequiredFeatureGroup()
```

The set of `GroupableFeature` that are mandatory for the camera configuration.

### getViewPort

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

```
public final @Nullable ViewPort getViewPort()
```

The `ViewPort` to be applied on the camera session.

Note: Setting this property to `null` is a no-op on the underlying `SessionConfig.Builder` because `SessionConfig.Builder.setViewPort` requires a non-null `ViewPort`.

| See also |
|---|---|
| `setViewPort` |   |

### isAutoRotationEnabled

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

```
public final boolean isAutoRotationEnabled()
```

Whether to use auto rotation.

### setAutoRotationEnabled

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

```
public final void setAutoRotationEnabled(boolean value)
```

Whether to use auto rotation.

### setEffects

```
public final void setEffects(@NonNull List<@NonNull CameraEffect> value)
```

The list of `CameraEffect` to be applied on the camera session.

### setFrameRateRange

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

```
public final void setFrameRateRange(@NonNull Range<@NonNull Integer> value)
```

The desired frame rate range for the camera session.

### setPreferredFeatureGroup

```
public final void setPreferredFeatureGroup(@NonNull List<@NonNull GroupableFeature> value)
```

The list of preferred `GroupableFeature`, ordered by priority in descending order.

### setRequiredFeatureGroup

```
public final void setRequiredFeatureGroup(@NonNull Set<@NonNull GroupableFeature> value)
```

The set of `GroupableFeature` that are mandatory for the camera configuration.

### setViewPort

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

```
public final void setViewPort(ViewPort value)
```

The `ViewPort` to be applied on the camera session.

Note: Setting this property to `null` is a no-op on the underlying `SessionConfig.Builder` because `SessionConfig.Builder.setViewPort` requires a non-null `ViewPort`.

| See also |
|---|---|
| `setViewPort` |   |

## Extension functions

### Camera2InteropEx.camera2Interop

Artifact: [androidx.camera:camera-camera2](https://developer.android.com/jetpack/androidx/releases/camera.md.txt) [View Source](https://cs.android.com/search?q=file:androidx/camera/camera2/interop/Camera2InteropEx.kt+function:camera2Interop)

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

Applies Camera2 options inside a `SessionConfigScope` DSL block.

Configures Camera2 options on the underlying `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 |
|---|---|
| `@NonNull Function1<@NonNull SessionConfigCamera2Interop, Unit> block` | configuration block setting Camera2 options on `SessionConfigCamera2Interop` |