# GroupableFeature

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/featuregroup/GroupableFeature.kt+class:androidx.camera.core.featuregroup.GroupableFeature) Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/camera#1.5.0)

*** ** * ** ***

<br />

```
public abstract class GroupableFeature
```

<br />

*** ** * ** ***

Represents distinct, groupable camera functionalities that can be requested for a camera session.

CameraX provides various implementations of this class as objects to denote various groupable features, i.e. `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#HDR_HLG10()`, `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#PREVIEW_STABILIZATION()`, `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#IMAGE_ULTRA_HDR()`. Since features may not be supported together as a combination even if each of them are supported individually, these groupable features can be configured as a group in a `https://developer.android.com/reference/androidx/camera/core/SessionConfig` to ensure compatibility when they are used together. When configuring the camera with a session config containing groups of features, their impact on the camera session as a combination will also be considered and compatibility issue will be reported or handled properly based on the exact API used (i.e. exception will be thrown if `https://developer.android.com/reference/androidx/camera/core/SessionConfig#requiredFeatureGroup()` is not supported, or some/all features from `https://developer.android.com/reference/androidx/camera/core/SessionConfig#preferredFeatureGroup()` will be dropped based on priority).

Additionally, the `https://developer.android.com/reference/androidx/camera/core/CameraInfo#isSessionConfigSupported(androidx.camera.core.SessionConfig)` API can be used to check if a group of features is supported together on a device.

```kotlin
import androidx.camera.core.CameraSelector
import androidx.camera.core.SessionConfig
import androidx.camera.core.featuregroup.GroupableFeature.Companion.FPS_60
import androidx.camera.core.featuregroup.GroupableFeature.Companion.HDR_HLG10
import androidx.camera.core.featuregroup.GroupableFeature.Companion.PREVIEW_STABILIZATION

// Bind a session config with some high quality features configured as per app requirements.

cameraProvider.bindToLifecycle(
    lifecycleOwner,
    CameraSelector.DEFAULT_BACK_CAMERA,
    SessionConfig(
            useCases = useCases,
            requiredFeatureGroup = setOf(HDR_HLG10),
            preferredFeatureGroup = listOf(FPS_60, PREVIEW_STABILIZATION),
            // The preferred features will be set according to device capabilities and priority,
            // FPS_60 will be prioritized higher than PREVIEW_STABILIZATION here as FPS_60 is
            // placed earlier in the list.
        )
        .apply {
            setFeatureSelectionListener { features ->
                // Update app UI based on the features selected if required, e.g. a menu with
                // the options of HDR and SDR can be updated to show that HDR is the current
                // selected option
                updateFeatureMenuUi(selectedFeatures = features)
            }
        },
)
```

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/core/SessionConfig.Builder#setRequiredFeatureGroup(kotlin.Array)` |   |
| `https://developer.android.com/reference/androidx/camera/core/SessionConfig.Builder#setPreferredFeatureGroup(kotlin.Array)` |   |

## Summary

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#FEATURE_TYPE_DYNAMIC_RANGE() = 0` Represents the dynamic range feature that can be used for functionalities like HDR video recording. |
| `static final int` | `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#FEATURE_TYPE_FPS_RANGE() = 1` Represents the FPS range feature that can be used for functionalities like 60 FPS video recording. |
| `static final int` | `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#FEATURE_TYPE_IMAGE_FORMAT() = 3` Represents the image format feature that can be used to capture JPEG Ultra HDR images. |
| `static final int` | `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#FEATURE_TYPE_RECORDING_QUALITY() = 4` Represents the recording quality feature that can be used to select a specific quality for video recording. |
| `static final int` | `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#FEATURE_TYPE_VIDEO_STABILIZATION() = 2` Represents the video stabilization feature that can be used to apply stabilization to the preview and recorded video. |

| ### Public fields |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature` | `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#FPS_60()` A feature object of type `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#FEATURE_TYPE_FPS_RANGE()` representing 60 FPS (i.e. both the lower and upper bound of the FPS range is 60). |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature` | `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#HDR_HLG10()` A feature object of type `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#FEATURE_TYPE_DYNAMIC_RANGE()` representing the 10-bit High Log-Gamma (HLG) HDR. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature` | `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#IMAGE_ULTRA_HDR()` A feature object of type `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#FEATURE_TYPE_IMAGE_FORMAT()` that makes the `https://developer.android.com/reference/androidx/camera/core/ImageCapture` use case capture Ultra HDR JPEG images. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature` | `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#PREVIEW_STABILIZATION()` A feature object of type `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#FEATURE_TYPE_VIDEO_STABILIZATION()` representing a video stabilization mode that applies to the preview as well. |

| ### Public methods |
|---|---|
| `final int` | `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#getFeatureType()()` The type of this feature, which will be one of the following values. |

## Constants

### FEATURE_TYPE_DYNAMIC_RANGE

```
public static final int FEATURE_TYPE_DYNAMIC_RANGE = 0
```

Represents the dynamic range feature that can be used for functionalities like HDR video recording.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#HDR_HLG10()` |   |

### FEATURE_TYPE_FPS_RANGE

```
public static final int FEATURE_TYPE_FPS_RANGE = 1
```

Represents the FPS range feature that can be used for functionalities like 60 FPS video recording.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#FPS_60()` |   |

### FEATURE_TYPE_IMAGE_FORMAT

```
public static final int FEATURE_TYPE_IMAGE_FORMAT = 3
```

Represents the image format feature that can be used to capture JPEG Ultra HDR images.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#IMAGE_ULTRA_HDR()` |   |

### FEATURE_TYPE_RECORDING_QUALITY

```
public static final int FEATURE_TYPE_RECORDING_QUALITY = 4
```

Represents the recording quality feature that can be used to select a specific quality for video recording.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/video/GroupableFeatures#UHD_RECORDING()` |   |
| `https://developer.android.com/reference/androidx/camera/video/GroupableFeatures#FHD_RECORDING()` |   |
| `https://developer.android.com/reference/androidx/camera/video/GroupableFeatures#HD_RECORDING()` |   |
| `https://developer.android.com/reference/androidx/camera/video/GroupableFeatures#SD_RECORDING()` |   |

### FEATURE_TYPE_VIDEO_STABILIZATION

```
public static final int FEATURE_TYPE_VIDEO_STABILIZATION = 2
```

Represents the video stabilization feature that can be used to apply stabilization to the preview and recorded video.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#PREVIEW_STABILIZATION()` |   |

## Public fields

### FPS_60

```
public static final @NonNull GroupableFeature FPS_60
```

A feature object of type `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#FEATURE_TYPE_FPS_RANGE()` representing 60 FPS (i.e. both the lower and upper bound of the FPS range is 60).

When used, this feature ensures the camera always operates at a constant 60 FPS.

### HDR_HLG10

```
public static final @NonNull GroupableFeature HDR_HLG10
```

A feature object of type `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#FEATURE_TYPE_DYNAMIC_RANGE()` representing the 10-bit High Log-Gamma (HLG) HDR.

The dynamic range is applied to both the `https://developer.android.com/reference/androidx/camera/core/Preview` and `VideoCapture` use cases when they are added together with this feature.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/core/DynamicRange#HLG_10_BIT()` |   |

### IMAGE_ULTRA_HDR

```
public static final @NonNull GroupableFeature IMAGE_ULTRA_HDR
```

A feature object of type `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#FEATURE_TYPE_IMAGE_FORMAT()` that makes the `https://developer.android.com/reference/androidx/camera/core/ImageCapture` use case capture Ultra HDR JPEG images.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/core/ImageCapture#OUTPUT_FORMAT_JPEG_ULTRA_HDR()` |   |

### PREVIEW_STABILIZATION

```
public static final @NonNull GroupableFeature PREVIEW_STABILIZATION
```

A feature object of type `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#FEATURE_TYPE_VIDEO_STABILIZATION()` representing a video stabilization mode that applies to the preview as well.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/core/Preview.Builder#setPreviewStabilizationEnabled(boolean)` |   |
| `https://developer.android.com/reference/androidx/camera/video/GroupableFeatures#VIDEO_STABILIZATION()` |   |

## Public methods

### getFeatureType

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

```
public final int getFeatureType()
```

The type of this feature, which will be one of the following values.

- `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#FEATURE_TYPE_DYNAMIC_RANGE()`

- `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#FEATURE_TYPE_FPS_RANGE()`

- `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#FEATURE_TYPE_VIDEO_STABILIZATION()`

- `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#FEATURE_TYPE_IMAGE_FORMAT()`

- `https://developer.android.com/reference/androidx/camera/core/featuregroup/GroupableFeature#FEATURE_TYPE_RECORDING_QUALITY()`