# CameraExtensionCharacteristicsWrapper

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

*** ** * ** ***


```
public interface CameraExtensionCharacteristicsWrapper extends CameraCharacteristicsMetadata, UnsafeWrapper
```

<br />

Known direct subclasses [FakeCameraExtensionCharacteristics](https://developer.android.com/reference/androidx/camera/common/testing/FakeCameraExtensionCharacteristics)

|---|---|
| `https://developer.android.com/reference/androidx/camera/common/testing/FakeCameraExtensionCharacteristics` | A fake implementation of `https://developer.android.com/reference/androidx/camera/common/CameraExtensionCharacteristicsWrapper` for testing. |

*** ** * ** ***

Compatibility wrapper around `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionCharacteristics.html`.

This wrapper provides type-safe, version-compatible access to the characteristics and capabilities of camera extension modes on a device. It extends `https://developer.android.com/reference/androidx/camera/common/CameraCharacteristicsMetadata` to support querying characteristics keys and `https://developer.android.com/reference/androidx/camera/common/UnsafeWrapper` to allow accessing the underlying native characteristics object.

## Summary

| ### Public methods |
|---|---|
| `abstract int` | `https://developer.android.com/reference/androidx/camera/common/CameraExtensionCharacteristicsWrapper#getCameraExtension()()` The camera extension mode represented by this characteristics instance. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/common/CameraId` | `https://developer.android.com/reference/androidx/camera/common/CameraExtensionCharacteristicsWrapper#getCameraId()()` The ID of the camera device associated with these extension characteristics. |
| `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/android/hardware/camera2/CaptureRequest.Key.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?>>` | `https://developer.android.com/reference/androidx/camera/common/CameraExtensionCharacteristicsWrapper#getCaptureRequestKeys()()` The set of capture request keys supported by this camera extension. |
| `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/android/hardware/camera2/CaptureResult.Key.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?>>` | `https://developer.android.com/reference/androidx/camera/common/CameraExtensionCharacteristicsWrapper#getCaptureResultKeys()()` The set of capture result keys supported by this camera extension. |
| `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/android/hardware/camera2/CameraCharacteristics.Key.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?>>` | `https://developer.android.com/reference/androidx/camera/common/CameraExtensionCharacteristicsWrapper#getDynamicKeys()()` The set of camera characteristics keys that are dynamically updated for this extension. |
| `abstract https://developer.android.com/reference/android/util/Range.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Long.html>` | `https://developer.android.com/reference/androidx/camera/common/CameraExtensionCharacteristicsWrapper#getEstimatedCaptureLatencyRangeMillis(android.util.Size,kotlin.Int)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/Size.html captureSize, int imageFormat )` Returns the estimated capture latency range in milliseconds for the given capture size and format. |
| `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/android/hardware/camera2/CameraCharacteristics.Key.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?>>` | `https://developer.android.com/reference/androidx/camera/common/CameraExtensionCharacteristicsWrapper#getKeys()()` The set of camera characteristics keys supported by this camera extension. |
| `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/android/util/Size.html>` | `https://developer.android.com/reference/androidx/camera/common/CameraExtensionCharacteristicsWrapper#getOutputSizes(kotlin.Int)(int imageFormat)` Returns the output sizes supported for the given image format. |
| `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/android/util/Size.html>` | `https://developer.android.com/reference/androidx/camera/common/CameraExtensionCharacteristicsWrapper#getOutputSizes(java.lang.Class)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> klass)` Returns the output sizes supported for the given class (e.g., `https://developer.android.com/reference/android/graphics/SurfaceTexture.html`). |
| `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/android/util/Size.html>` | `https://developer.android.com/reference/androidx/camera/common/CameraExtensionCharacteristicsWrapper#getPostviewSizes(android.util.Size,kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/Size.html captureSize, int format)` Returns the supported postview sizes for a given capture size and format. |
| `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/android/hardware/camera2/CameraCharacteristics.Key.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?>>` | `https://developer.android.com/reference/androidx/camera/common/CameraExtensionCharacteristicsWrapper#getRestrictedKeys()()` The set of camera characteristics keys that require specific permissions to be accessed. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/camera/common/CameraExtensionCharacteristicsWrapper#isCaptureProgressSupported()()` Whether capture progress callbacks are supported for this extension mode. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/camera/common/CameraExtensionCharacteristicsWrapper#isPostviewSupported()()` Whether postview is supported for this extension mode. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/camera/common/CameraExtensionCharacteristicsWrapper#isRestricted()()` Whether access to some camera characteristics keys is restricted due to camera permissions. |

### Inherited methods

From [androidx.camera.common.CameraCharacteristicsMetadata](https://developer.android.com/reference/androidx/camera/common/CameraCharacteristicsMetadata) `abstract T` `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/camera/common/CameraCharacteristicsMetadata#get(android.hardware.camera2.CameraCharacteristics.Key)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.Key.html<@https://developer.android.com/reference/androidx/annotation/NonNull T> key)`

Retrieves the value of the specified `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.Key.html`.
`default @https://developer.android.com/reference/androidx/annotation/NonNull T` `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/camera/common/CameraCharacteristicsMetadata#getOrDefault(android.hardware.camera2.CameraCharacteristics.Key,kotlin.Any)(
@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.Key.html<@https://developer.android.com/reference/androidx/annotation/NonNull T> key,
@https://developer.android.com/reference/androidx/annotation/NonNull T default
)`

Retrieves the value of the specified `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.Key.html`, or returns `https://developer.android.com/reference/androidx/camera/common/CameraCharacteristicsMetadata#getOrDefault(android.hardware.camera2.CameraCharacteristics.Key,kotlin.Any)` if the value is `null` or the key is unsupported.
From [androidx.camera.common.Metadata](https://developer.android.com/reference/androidx/camera/common/Metadata) `abstract T` `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/camera/common/Metadata#get(androidx.camera.common.Metadata.Key)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/common/Metadata.Key<@https://developer.android.com/reference/androidx/annotation/NonNull T> key)`

Retrieves the value associated with the specified `https://developer.android.com/reference/androidx/camera/common/Metadata.Key`.
`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/androidx/camera/common/Metadata.Key<@https://developer.android.com/reference/androidx/annotation/NonNull ?>>` `https://developer.android.com/reference/androidx/camera/common/Metadata#getMetadataKeys()()`

The set of all custom `https://developer.android.com/reference/androidx/camera/common/Metadata.Key`s currently available in this container.
`default @https://developer.android.com/reference/androidx/annotation/NonNull T` `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/camera/common/Metadata#getOrDefault(androidx.camera.common.Metadata.Key,kotlin.Any)(
@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/common/Metadata.Key<@https://developer.android.com/reference/androidx/annotation/NonNull T> key,
@https://developer.android.com/reference/androidx/annotation/NonNull T default
)`

Retrieves the value associated with the specified `https://developer.android.com/reference/androidx/camera/common/Metadata.Key`, or returns `https://developer.android.com/reference/androidx/camera/common/Metadata#getOrDefault(androidx.camera.common.Metadata.Key,kotlin.Any)` if the key is not present.
From [androidx.camera.common.UnsafeWrapper](https://developer.android.com/reference/androidx/camera/common/UnsafeWrapper) `abstract T` `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/camera/common/UnsafeWrapper#unwrapAs(java.lang.Class)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull T> type)`

Attempts to unwrap this object into the specified underlying `https://developer.android.com/reference/androidx/camera/common/UnsafeWrapper#unwrapAs(java.lang.Class)`.

## Public methods

### getCameraExtension

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

```
abstract int getCameraExtension()
```

The camera extension mode represented by this characteristics instance.

Value is one of the native camera extension constants defined in `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionCharacteristics.html` (e.g., `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionCharacteristics.html#EXTENSION_BOKEH`, `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionCharacteristics.html#EXTENSION_HDR`, `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionCharacteristics.html#EXTENSION_NIGHT`, `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionCharacteristics.html#EXTENSION_FACE_RETOUCH`, or `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionCharacteristics.html#EXTENSION_AUTOMATIC`).

Value is one of the following:

- `2`
- `3`
- `4`
- `1`
- `0`

<br />

### getCameraId

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

```
abstract @NonNull CameraId getCameraId()
```

The ID of the camera device associated with these extension characteristics.

### getCaptureRequestKeys

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

```
abstract @NonNull Set<@NonNull CaptureRequest.Key<@NonNull ?>> getCaptureRequestKeys()
```

The set of capture request keys supported by this camera extension.

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionCharacteristics.html` | #getAvailableCaptureRequestKeys |

### getCaptureResultKeys

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

```
abstract @NonNull Set<@NonNull CaptureResult.Key<@NonNull ?>> getCaptureResultKeys()
```

The set of capture result keys supported by this camera extension.

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionCharacteristics.html` | #getAvailableCaptureResultKeys |

### getDynamicKeys

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

```
abstract @NonNull Set<@NonNull CameraCharacteristics.Key<@NonNull ?>> getDynamicKeys()
```

The set of camera characteristics keys that are dynamically updated for this extension.

### getEstimatedCaptureLatencyRangeMillis

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

```
abstract Range<@NonNull Long> getEstimatedCaptureLatencyRangeMillis(
    @NonNull Size captureSize,
    int imageFormat
)
```

Returns the estimated capture latency range in milliseconds for the given capture size and format.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/Size.html captureSize` | the size of the capture. |
| `int imageFormat` | the format of the captured image. Value is one of the following: - `0` - `4` - `842094169` - `538982489` - `16` - `17` - `20` - `256` - `1768253795` - `35` - `39` - `40` - `41` - `42` - `32` - `36` - `37` - `38` - `1144402265` - `257` - `34` - `1212500294` - `54` - `4101` - `4098` - `4099` - `540422489` - `60` - `4102` - `56` - `55` - `57` - `58` - `59` - `-3` - `-2` - `-1` - `1` - `2` - `3` - `22` - `43` - `33` - `48` - `49` - `50` - `51` - `52` - `53` <br /> |

| Returns |
|---|---|
| `https://developer.android.com/reference/android/util/Range.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Long.html>` | the range of estimated capture latency, or null if the latency is not available. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionCharacteristics.html` | #getEstimatedCaptureLatencyRangeMillis |

### getKeys

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

```
abstract @NonNull Set<@NonNull CameraCharacteristics.Key<@NonNull ?>> getKeys()
```

The set of camera characteristics keys supported by this camera extension.

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionCharacteristics.html` | #getKeys |

### getOutputSizes

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

```
abstract @NonNull Set<@NonNull Size> getOutputSizes(int imageFormat)
```

Returns the output sizes supported for the given image format.

| Parameters |
|---|---|
| `int imageFormat` | the image format (e.g., `https://developer.android.com/reference/android/graphics/ImageFormat.html#JPEG`, `https://developer.android.com/reference/android/graphics/ImageFormat.html#YUV_420_888`). Value is one of the following: - `0` - `4` - `842094169` - `538982489` - `16` - `17` - `20` - `256` - `1768253795` - `35` - `39` - `40` - `41` - `42` - `32` - `36` - `37` - `38` - `1144402265` - `257` - `34` - `1212500294` - `54` - `4101` - `4098` - `4099` - `540422489` - `60` - `4102` - `56` - `55` - `57` - `58` - `59` - `-3` - `-2` - `-1` - `1` - `2` - `3` - `22` - `43` - `33` - `48` - `49` - `50` - `51` - `52` - `53` <br /> |

| Returns |
|---|---|
| `@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/android/util/Size.html>` | the set of supported sizes for the image format. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionCharacteristics.html` | #getExtensionSupportedSizes |

### getOutputSizes

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

```
abstract @NonNull Set<@NonNull Size> getOutputSizes(@NonNull Class<@NonNull ?> klass)
```

Returns the output sizes supported for the given class (e.g., `https://developer.android.com/reference/android/graphics/SurfaceTexture.html`).

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> klass` | the class of the output target. |

| Returns |
|---|---|
| `@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/android/util/Size.html>` | the set of supported sizes for the output class. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionCharacteristics.html` | #getExtensionSupportedSizes |

### getPostviewSizes

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

```
abstract @NonNull Set<@NonNull Size> getPostviewSizes(@NonNull Size captureSize, int format)
```

Returns the supported postview sizes for a given capture size and format.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/Size.html captureSize` | the size of the final high-quality capture. |
| `int format` | the image format of the postview. Value is one of the following: - `0` - `4` - `842094169` - `538982489` - `16` - `17` - `20` - `256` - `1768253795` - `35` - `39` - `40` - `41` - `42` - `32` - `36` - `37` - `38` - `1144402265` - `257` - `34` - `1212500294` - `54` - `4101` - `4098` - `4099` - `540422489` - `60` - `4102` - `56` - `55` - `57` - `58` - `59` - `-3` - `-2` - `-1` - `1` - `2` - `3` - `22` - `43` - `33` - `48` - `49` - `50` - `51` - `52` - `53` <br /> |

| Returns |
|---|---|
| `@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/android/util/Size.html>` | the set of supported postview sizes, or an empty set if postview is not supported. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionCharacteristics.html` | #getPostviewSupportedSizes |

### getRestrictedKeys

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

```
abstract @NonNull Set<@NonNull CameraCharacteristics.Key<@NonNull ?>> getRestrictedKeys()
```

The set of camera characteristics keys that require specific permissions to be accessed.

### isCaptureProgressSupported

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

```
abstract boolean isCaptureProgressSupported()
```

Whether capture progress callbacks are supported for this extension mode.

If true, capture requests can report progress updates during the extension processing.

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionCharacteristics.html` | #isCaptureProcessProgressSupported |

### isPostviewSupported

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

```
abstract boolean isPostviewSupported()
```

Whether postview is supported for this extension mode.

A postview is a quickly available, lower-resolution preview of the captured image that can be displayed while the final high-quality capture is processing.

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionCharacteristics.html` | #isPostviewSupported |

### isRestricted

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

```
abstract boolean isRestricted()
```

Whether access to some camera characteristics keys is restricted due to camera permissions.

If true, querying restricted keys via `https://developer.android.com/reference/androidx/camera/common/CameraCharacteristicsMetadata#get(android.hardware.camera2.CameraCharacteristics.Key)` or `https://developer.android.com/reference/androidx/camera/common/CameraCharacteristicsMetadata#getOrDefault(android.hardware.camera2.CameraCharacteristics.Key,kotlin.Any)` may return null or default values, matching the behavior of restricted extension modes when CAMERA permission is not granted.