# FakeDynamicRangeProfiles

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/FakeDynamicRangeProfiles.kt+class:androidx.camera.common.testing.FakeDynamicRangeProfiles) Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

*** ** * ** ***


```
public final class FakeDynamicRangeProfiles implements DynamicRangeProfilesWrapper
```

<br />

*** ** * ** ***

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

This class allows setting mock values for supported profiles, capture request constraints, and extra latency profiles.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/camera/common/testing/FakeDynamicRangeProfiles#FakeDynamicRangeProfiles(kotlin.collections.Set,kotlin.collections.Map,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/Long.html> supportedProfiles, @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/java/lang/Long.html, @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/Long.html>> compatibleProfiles, @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/Long.html> extraLatencyProfiles )` |

| ### Public methods |
|---|---|
| `@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/Long.html>` | `https://developer.android.com/reference/androidx/camera/common/testing/FakeDynamicRangeProfiles#getCompatibleProfiles(kotlin.Long)(long profile)` Returns a set of supported dynamic range profiles that can be referenced in a single capture request along with the given profile. |
| `@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/Long.html>` | `https://developer.android.com/reference/androidx/camera/common/testing/FakeDynamicRangeProfiles#getSupportedProfiles()()` Returns a set of supported dynamic range profiles. |
| `boolean` | `https://developer.android.com/reference/androidx/camera/common/testing/FakeDynamicRangeProfiles#hasExtraLatency(kotlin.Long)(long profile)` Checks whether a given dynamic range profile incurs extra latency. |
| `T` | `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/camera/common/testing/FakeDynamicRangeProfiles#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 constructors

### FakeDynamicRangeProfiles

```
public FakeDynamicRangeProfiles(
    @NonNull Set<@NonNull Long> supportedProfiles,
    @NonNull Map<@NonNull Long, @NonNull Set<@NonNull Long>> compatibleProfiles,
    @NonNull Set<@NonNull Long> extraLatencyProfiles
)
```

## Public methods

### getCompatibleProfiles

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

```
public @NonNull Set<@NonNull Long> getCompatibleProfiles(long profile)
```

Returns a set of supported dynamic range profiles that can be referenced in a single capture request along with the given profile.

A profile is always compatible with itself, and is included in the returned set.

| Parameters |
|---|---|
| `long profile` | The dynamic range profile to query compatibility for. Value is one of the following: - `1` - `2` - `4` - `8` - `16` - `32` - `64` - `128` - `256` - `512` - `1024` - `2048` - `4096` <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/java/lang/Long.html>` | An unmodifiable set of supported dynamic range profiles. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles.html#getProfileCaptureRequestConstraints(long)` |   |

### getSupportedProfiles

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

```
public @NonNull Set<@NonNull Long> getSupportedProfiles()
```

Returns a set of supported dynamic range profiles.

| 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/java/lang/Long.html>` | An unmodifiable set of supported dynamic range profiles. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles.html#getSupportedProfiles()` |   |

### hasExtraLatency

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

```
public boolean hasExtraLatency(long profile)
```

Checks whether a given dynamic range profile incurs extra latency.

Profiles that incur extra latency may not be suitable for latency-sensitive use cases, such as real-time previews.

| Parameters |
|---|---|
| `long profile` | The dynamic range profile to check. Value is one of the following: - `1` - `2` - `4` - `8` - `16` - `32` - `64` - `128` - `256` - `512` - `1024` - `2048` - `4096` <br /> |

| Returns |
|---|---|
| `boolean` | `true` if the profile incurs extra latency, `false` otherwise. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/params/DynamicRangeProfiles.html#isExtraLatencyPresent(long)` |   |

### 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)
```

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

Callers should use this method to retrieve the wrapped platform object.

### Implementation Notes

- If the requested `https://developer.android.com/reference/androidx/camera/common/UnsafeWrapper#unwrapAs(java.lang.Class)` is not supported by this wrapper, this method must return `null`.

- Implementations designed for testing (e.g., fakes, mocks, or no-op wrappers) should return `null` to signal that no real underlying object is available.

| Parameters |
|---|---|
| `<T extends https://developer.android.com/reference/java/lang/Object.html>` | The expected type of the underlying object. |
| `@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 `https://developer.android.com/reference/java/lang/Class.html` representing the expected type of the underlying object. |

| Returns |
|---|---|
| `T` | The underlying object cast to `https://developer.android.com/reference/androidx/camera/common/UnsafeWrapper#unwrapAs(java.lang.Class)`, or `null` if the object cannot be unwrapped into the requested `https://developer.android.com/reference/androidx/camera/common/UnsafeWrapper#unwrapAs(java.lang.Class)`. |