# FakeCameraCharacteristics

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

*** ** * ** ***


```
public final class FakeCameraCharacteristics implements CameraCharacteristicsWrapper
```

<br />

*** ** * ** ***

A fake implementation of `https://developer.android.com/reference/androidx/camera/common/CameraCharacteristicsWrapper` for testing.

Allows mock values to be configured for camera characteristics, custom metadata, supported keys, and physical camera IDs. This class is designed to be used in unit tests to mock camera behavior without needing a physical device or a real camera service.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | If `physicalCameraIds` contains `cameraId`, or if any key in `restrictedKeys` or `sessionKeys` is not present in `cameraCharacteristics`. |

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/camera/common/testing/FakeCameraCharacteristics#FakeCameraCharacteristics(androidx.camera.common.CameraId,kotlin.collections.Map,kotlin.collections.Map,kotlin.collections.Set,kotlin.collections.Set,kotlin.collections.Set,kotlin.collections.Set,kotlin.collections.Set,kotlin.collections.Set,kotlin.Boolean,kotlin.collections.Set,kotlin.collections.Set)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/common/CameraId cameraId, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.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/java/lang/Object.html> cameraCharacteristics, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.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/java/lang/Object.html> cameraMetadata, @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 ?>> captureRequestKeys, @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 ?>> captureResultKeys, @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 ?>> sessionKeys, @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 ?>> sessionCaptureRequestKeys, @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/CameraId> physicalCameraIds, @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 ?>> physicalCaptureRequestKeys, boolean isRestricted, @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 ?>> restrictedKeys, @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 ?>> dynamicKeys )` |

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/common/testing/FakeCameraCharacteristics` | `https://developer.android.com/reference/androidx/camera/common/testing/FakeCameraCharacteristics#create(kotlin.String,kotlin.collections.Map,kotlin.collections.Map,kotlin.collections.Set,kotlin.collections.Set,kotlin.collections.Set,kotlin.collections.Set,kotlin.collections.Set,kotlin.collections.Set,kotlin.Boolean,kotlin.collections.Set,kotlin.collections.Set)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html cameraId, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.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/java/lang/Object.html> cameraCharacteristics, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.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/java/lang/Object.html> cameraMetadata, @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 ?>> captureRequestKeys, @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 ?>> captureResultKeys, @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 ?>> sessionKeys, @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 ?>> sessionCaptureRequestKeys, @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/String.html> physicalCameraIds, @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 ?>> physicalCaptureRequestKeys, boolean isRestricted, @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 ?>> restrictedKeys, @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 ?>> dynamicKeys )` Creates a `https://developer.android.com/reference/androidx/camera/common/testing/FakeCameraCharacteristics` instance for Java compatibility. |
| `T` | `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/camera/common/testing/FakeCameraCharacteristics#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 mock value for the specified `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.Key.html`. |
| `T` | `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/camera/common/testing/FakeCameraCharacteristics#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 mock value for the specified `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/CameraId` | `https://developer.android.com/reference/androidx/camera/common/testing/FakeCameraCharacteristics#getCameraId()()` The `https://developer.android.com/reference/androidx/camera/common/CameraId` identifying this camera device. |
| `@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/testing/FakeCameraCharacteristics#getCaptureRequestKeys()()` The set of `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html`s supported by this camera. |
| `@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/testing/FakeCameraCharacteristics#getCaptureResultKeys()()` The set of `https://developer.android.com/reference/android/hardware/camera2/CaptureResult.Key.html`s supported by this camera. |
| `@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/testing/FakeCameraCharacteristics#getDynamicKeys()()` The set of `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.Key.html`s whose values can change depending on the device state. |
| `@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/testing/FakeCameraCharacteristics#getKeys()()` A `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html` of all `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.Key.html`s supported by this camera device. |
| `@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/testing/FakeCameraCharacteristics#getMetadataKeys()()` The set of all custom `https://developer.android.com/reference/androidx/camera/common/Metadata.Key`s currently available in this container. |
| `@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/CameraId>` | `https://developer.android.com/reference/androidx/camera/common/testing/FakeCameraCharacteristics#getPhysicalCameraIds()()` The set of physical `https://developer.android.com/reference/androidx/camera/common/CameraId`s that this logical camera device is made up of. |
| `@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/testing/FakeCameraCharacteristics#getPhysicalCaptureRequestKeys()()` The set of physical `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html`s. |
| `@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/testing/FakeCameraCharacteristics#getRestrictedKeys()()` The set of `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.Key.html`s that require camera permissions. |
| `@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/testing/FakeCameraCharacteristics#getSessionCaptureRequestKeys()()` The set of `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html`s that the camera device can pass as part of the capture session initialization. |
| `@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/testing/FakeCameraCharacteristics#getSessionKeys()()` The set of `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.Key.html`s whose values are capture session specific. |
| `boolean` | `https://developer.android.com/reference/androidx/camera/common/testing/FakeCameraCharacteristics#isRestricted()()` Indicates whether the wrapper queried camera characteristics without camera permission. |
| `T` | `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/camera/common/testing/FakeCameraCharacteristics#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)` Unwraps this instance to the requested type if compatible. |

### Inherited methods

From [androidx.camera.common.CameraCharacteristicsMetadata](https://developer.android.com/reference/androidx/camera/common/CameraCharacteristicsMetadata) `@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) `@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.

## Public constructors

### FakeCameraCharacteristics

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

```
public FakeCameraCharacteristics(
    @NonNull CameraId cameraId,
    @NonNull Map<@NonNull CameraCharacteristics.Key<@NonNull ?>, Object> cameraCharacteristics,
    @NonNull Map<@NonNull Metadata.Key<@NonNull ?>, Object> cameraMetadata,
    @NonNull Set<@NonNull CaptureRequest.Key<@NonNull ?>> captureRequestKeys,
    @NonNull Set<@NonNull CaptureResult.Key<@NonNull ?>> captureResultKeys,
    @NonNull Set<@NonNull CameraCharacteristics.Key<@NonNull ?>> sessionKeys,
    @NonNull Set<@NonNull CaptureRequest.Key<@NonNull ?>> sessionCaptureRequestKeys,
    @NonNull Set<@NonNull CameraId> physicalCameraIds,
    @NonNull Set<@NonNull CaptureRequest.Key<@NonNull ?>> physicalCaptureRequestKeys,
    boolean isRestricted,
    @NonNull Set<@NonNull CameraCharacteristics.Key<@NonNull ?>> restrictedKeys,
    @NonNull Set<@NonNull CameraCharacteristics.Key<@NonNull ?>> dynamicKeys
)
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/common/CameraId cameraId` | The `https://developer.android.com/reference/androidx/camera/common/CameraId` identifying this camera device. Defaults to `https://developer.android.com/reference/androidx/camera/common/testing/FakeCameraIds#default()`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.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/java/lang/Object.html> cameraCharacteristics` | A map of `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.Key.html` to their mock values. Any key queried via `https://developer.android.com/reference/androidx/camera/common/testing/FakeCameraCharacteristics#get(androidx.camera.common.Metadata.Key)` will return the value from this map. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.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/java/lang/Object.html> cameraMetadata` | A map of custom `https://developer.android.com/reference/androidx/camera/common/Metadata.Key` to their mock values. Any key queried via `https://developer.android.com/reference/androidx/camera/common/testing/FakeCameraCharacteristics#get(androidx.camera.common.Metadata.Key)` will return the value from this map. |
| `@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 ?>> captureRequestKeys` | The set of `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html`s supported by this camera. |
| `@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 ?>> captureResultKeys` | The set of `https://developer.android.com/reference/android/hardware/camera2/CaptureResult.Key.html`s supported by this camera. |
| `@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 ?>> sessionKeys` | The set of `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.Key.html`s whose values are capture session specific. All keys in this set must also be present in `cameraCharacteristics`. |
| `@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 ?>> sessionCaptureRequestKeys` | The set of `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html`s that the camera device can pass as part of the capture session initialization. |
| `@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/CameraId> physicalCameraIds` | The set of physical `https://developer.android.com/reference/androidx/camera/common/CameraId`s that this logical camera device is made up of. Must not contain `cameraId`. |
| `@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 ?>> physicalCaptureRequestKeys` | The set of physical `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html`s. |
| `boolean isRestricted` | Indicates whether the wrapper queried camera characteristics without camera permission. |
| `@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 ?>> restrictedKeys` | The set of `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.Key.html`s that require camera permissions. All keys in this set must also be present in `cameraCharacteristics`. |
| `@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 ?>> dynamicKeys` | The set of `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.Key.html`s whose values can change depending on the device state. |

## Public methods

### create

```
public static final @NonNull FakeCameraCharacteristics create(
    @NonNull String cameraId,
    @NonNull Map<@NonNull CameraCharacteristics.Key<@NonNull ?>, Object> cameraCharacteristics,
    @NonNull Map<@NonNull Metadata.Key<@NonNull ?>, Object> cameraMetadata,
    @NonNull Set<@NonNull CaptureRequest.Key<@NonNull ?>> captureRequestKeys,
    @NonNull Set<@NonNull CaptureResult.Key<@NonNull ?>> captureResultKeys,
    @NonNull Set<@NonNull CameraCharacteristics.Key<@NonNull ?>> sessionKeys,
    @NonNull Set<@NonNull CaptureRequest.Key<@NonNull ?>> sessionCaptureRequestKeys,
    @NonNull Set<@NonNull String> physicalCameraIds,
    @NonNull Set<@NonNull CaptureRequest.Key<@NonNull ?>> physicalCaptureRequestKeys,
    boolean isRestricted,
    @NonNull Set<@NonNull CameraCharacteristics.Key<@NonNull ?>> restrictedKeys,
    @NonNull Set<@NonNull CameraCharacteristics.Key<@NonNull ?>> dynamicKeys
)
```

Creates a `https://developer.android.com/reference/androidx/camera/common/testing/FakeCameraCharacteristics` instance for Java compatibility.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html cameraId` | The camera ID string. Defaults to `https://developer.android.com/reference/androidx/camera/common/testing/FakeCameraIds#default()`'s value. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.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/java/lang/Object.html> cameraCharacteristics` | The map of characteristics keys to their mock values. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.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/java/lang/Object.html> cameraMetadata` | The map of custom metadata keys to their mock values. |
| `@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 ?>> captureRequestKeys` | The set of capture request keys supported by this camera. |
| `@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 ?>> captureResultKeys` | The set of capture result keys supported by this camera. |
| `@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 ?>> sessionKeys` | The set of session characteristics keys. All keys in this set must also be present in `cameraCharacteristics`. |
| `@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 ?>> sessionCaptureRequestKeys` | The set of session keys. |
| `@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/String.html> physicalCameraIds` | The set of physical camera ID strings. Must not contain `cameraId`. |
| `@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 ?>> physicalCaptureRequestKeys` | The set of physical capture request keys. |
| `boolean isRestricted` | True if the camera is operating in a restricted mode. |
| `@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 ?>> restrictedKeys` | The set of keys that require camera permissions. All keys in this set must also be present in `cameraCharacteristics`. |
| `@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 ?>> dynamicKeys` | The set of keys that can change dynamically. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/common/testing/FakeCameraCharacteristics` | A configured `https://developer.android.com/reference/androidx/camera/common/testing/FakeCameraCharacteristics` instance. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | If `physicalCameraIds` contains `cameraId`, or if any key in `restrictedKeys` or `sessionKeys` is not present in `cameraCharacteristics`. |

### get

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

```
public T <T extends Object> get(@NonNull CameraCharacteristics.Key<@NonNull T> key)
```

Retrieves the mock value for the specified `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.Key.html`.

| Parameters |
|---|---|
| `@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` | The native characteristics key to query. |

| Returns |
|---|---|
| `T` | The mock value configured in `https://developer.android.com/reference/androidx/camera/common/testing/FakeCameraCharacteristics#cameraCharacteristics()`, or `null` if not present. |

### get

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

```
public T <T extends Object> get(@NonNull Metadata.Key<@NonNull T> key)
```

Retrieves the mock value for the specified `https://developer.android.com/reference/androidx/camera/common/Metadata.Key`.

| Parameters |
|---|---|
| `@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` | The custom metadata key to query. |

| Returns |
|---|---|
| `T` | The mock value configured in `https://developer.android.com/reference/androidx/camera/common/testing/FakeCameraCharacteristics#cameraMetadata()`, or `null` if not present. |

### getCameraId

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

```
public @NonNull CameraId getCameraId()
```

The `https://developer.android.com/reference/androidx/camera/common/CameraId` identifying this camera device.

This corresponds to the camera ID used to open the camera with `https://developer.android.com/reference/android/hardware/camera2/CameraManager.html#openCamera(java.lang.String, android.hardware.camera2.CameraDevice.StateCallback, android.os.Handler)`.

### getCaptureRequestKeys

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

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

The set of `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html`s supported by this camera.

### getCaptureResultKeys

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

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

The set of `https://developer.android.com/reference/android/hardware/camera2/CaptureResult.Key.html`s supported by this camera.

### getDynamicKeys

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

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

The set of `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.Key.html`s whose values can change depending on the device state.

### getKeys

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

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

A `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html` of all `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.Key.html`s supported by this camera device.

This property is equivalent to calling `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html#getKeys()` on the underlying camera characteristics, but may be cached for efficiency.

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

### getMetadataKeys

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

```
public @NonNull Set<@NonNull Metadata.Key<@NonNull ?>> getMetadataKeys()
```

The set of all custom `https://developer.android.com/reference/androidx/camera/common/Metadata.Key`s currently available in this container.

Note that this set contains *only* custom library-defined keys. It does not include platform-specific keys (such as `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.Key.html` or `https://developer.android.com/reference/android/hardware/camera2/CaptureResult.Key.html`), which are managed separately by the implementing wrappers.

### getPhysicalCameraIds

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

```
public @NonNull Set<@NonNull CameraId> getPhysicalCameraIds()
```

The set of physical `https://developer.android.com/reference/androidx/camera/common/CameraId`s that this logical camera device is made up of. Must not contain `cameraId`.

### getPhysicalCaptureRequestKeys

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

```
public @NonNull Set<@NonNull CaptureRequest.Key<@NonNull ?>> getPhysicalCaptureRequestKeys()
```

The set of physical `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html`s.

### getRestrictedKeys

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

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

The set of `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.Key.html`s that require camera permissions. All keys in this set must also be present in `cameraCharacteristics`.

### getSessionCaptureRequestKeys

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

```
public @NonNull Set<@NonNull CaptureRequest.Key<@NonNull ?>> getSessionCaptureRequestKeys()
```

The set of `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html`s that the camera device can pass as part of the capture session initialization.

### getSessionKeys

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

```
public @NonNull Set<@NonNull CameraCharacteristics.Key<@NonNull ?>> getSessionKeys()
```

The set of `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.Key.html`s whose values are capture session specific. All keys in this set must also be present in `cameraCharacteristics`.

### isRestricted

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

```
public boolean isRestricted()
```

Indicates whether the wrapper queried camera characteristics without camera permission.

### unwrapAs

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

```
public T <T extends Object> unwrapAs(@NonNull Class<@NonNull T> type)
```

Unwraps this instance to the requested type if compatible.

Since this is a fake implementation, it can only be unwrapped to `https://developer.android.com/reference/androidx/camera/common/testing/FakeCameraCharacteristics` itself or its supertypes (e.g., `https://developer.android.com/reference/androidx/camera/common/CameraCharacteristicsWrapper`). It cannot be unwrapped to a native `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.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 T> type` | The class of the type to unwrap to. |

| Returns |
|---|---|
| `T` | This instance cast to `https://developer.android.com/reference/androidx/camera/common/testing/FakeCameraCharacteristics#unwrapAs(java.lang.Class)` if compatible, or `null` otherwise. |