# FakeStreamConfigurationMap

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

*** ** * ** ***


```
class FakeStreamConfigurationMap : StreamConfigurationMapWrapper
```

<br />

*** ** * ** ***

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

This class enables a developer to specify a table of input and output formats, along with the properties associated with them.

### Example

```kotlin
val fakeMap = FakeStreamConfigurationMap(
    outputsTable = linkedMapOf(
        OutputKey(ImageFormat.YUV_420_888, Size(1920, 1080)) to OutputValues(),
        OutputKey(ImageFormat.JPEG, Size(1920, 1080)) to OutputValues(
            stallDuration = 200000000L // 200ms stall duration for JPEG
        )
    )
)
```

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap.InputTableEntry` Defines a single entry for a valid input format for testing purposes. |
| `class https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap.OutputKey` Key used to identify an output configuration in `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap`. |
| `class https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap.OutputValues` Values associated with an output configuration in `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap`. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#FakeStreamConfigurationMap(java.util.LinkedHashMap,kotlin.collections.List,kotlin.collections.Map,kotlin.collections.Set)( outputsTable: https://developer.android.com/reference/java/util/LinkedHashMap.html<https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap.OutputKey, https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap.OutputValues>, inputTable: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap.InputTableEntry>, outputFormatsForInputFormats: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>>, outputClassTypes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://developer.android.com/reference/java/lang/Class.html<*>> )` |

| ### Public functions |
|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/android/util/Size.html>` | `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#getHighResolutionOutputSizes(kotlin.Int)(format: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/android/util/Range.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>>` | `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#getHighSpeedVideoFpsRanges()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/android/util/Range.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>>` | `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#getHighSpeedVideoFpsRangesFor(android.util.Size)(size: https://developer.android.com/reference/android/util/Size.html)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/android/util/Size.html>` | `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#getHighSpeedVideoSizes()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/android/util/Size.html>` | `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#getHighSpeedVideoSizesFor(android.util.Range)(fpsRange: https://developer.android.com/reference/android/util/Range.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>` | `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#getInputFormats()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/android/util/Size.html>` | `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#getInputSizes(kotlin.Int)(format: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>` | `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#getOutputFormats()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#getOutputMinFrameDuration(kotlin.Int,android.util.Size)(format: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, size: https://developer.android.com/reference/android/util/Size.html)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#getOutputMinFrameDuration(java.lang.Class,android.util.Size)(klass: https://developer.android.com/reference/java/lang/Class.html<T>, size: https://developer.android.com/reference/android/util/Size.html)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/android/util/Size.html>` | `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#getOutputSizes(kotlin.Int)(format: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/android/util/Size.html>` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#getOutputSizes(java.lang.Class)(klass: https://developer.android.com/reference/java/lang/Class.html<T>)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#getOutputStallDuration(kotlin.Int,android.util.Size)(format: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, size: https://developer.android.com/reference/android/util/Size.html)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#getOutputStallDuration(java.lang.Class,android.util.Size)(klass: https://developer.android.com/reference/java/lang/Class.html<T>, size: https://developer.android.com/reference/android/util/Size.html)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>` | `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#getValidOutputFormatsForInput(kotlin.Int)(inputFormat: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#isOutputSupportedFor(kotlin.Int)(format: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#isOutputSupportedFor(java.lang.Class)(klass: https://developer.android.com/reference/java/lang/Class.html<T>)` Converting this method to non-static for testability. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#isOutputSupportedFor(android.view.Surface)(surface: https://developer.android.com/reference/android/view/Surface.html)` |
| `open T?` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html> https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#unwrapAs(java.lang.Class)(type: https://developer.android.com/reference/java/lang/Class.html<T>)` Attempts to unwrap this object into the specified underlying `https://developer.android.com/reference/kotlin/androidx/camera/common/UnsafeWrapper#unwrapAs(java.lang.Class)`. |

## Public constructors

### FakeStreamConfigurationMap

```
FakeStreamConfigurationMap(
    outputsTable: LinkedHashMap<FakeStreamConfigurationMap.OutputKey, FakeStreamConfigurationMap.OutputValues>,
    inputTable: List<FakeStreamConfigurationMap.InputTableEntry> = emptyList(),
    outputFormatsForInputFormats: Map<Int, List<Int>> = emptyMap(),
    outputClassTypes: Set<Class<*>> = emptySet()
)
```

| Parameters |
|---|---|
| `outputsTable: https://developer.android.com/reference/java/util/LinkedHashMap.html<https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap.OutputKey, https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap.OutputValues>` | The map of supported outputs, mapping `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap.OutputKey` to `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap.OutputValues`. Must be a `https://developer.android.com/reference/java/util/LinkedHashMap.html` to preserve insertion order. Used by output-related queries (e.g., `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#getOutputFormats()`, `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#getOutputSizes(java.lang.Class)`, `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#getOutputMinFrameDuration(kotlin.Int,android.util.Size)`). |
| `inputTable: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap.InputTableEntry> = emptyList()` | The list of supported inputs. Used by `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#getInputFormats()` and `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#getInputSizes(kotlin.Int)`. |
| `outputFormatsForInputFormats: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>> = emptyMap()` | Mapping of input formats to their valid output formats. Used by `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#getValidOutputFormatsForInput(kotlin.Int)`. |
| `outputClassTypes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://developer.android.com/reference/java/lang/Class.html<*>> = emptySet()` | Set of class types that are supported as outputs. Used by `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#isOutputSupportedFor(kotlin.Int)` (class-based queries) and `https://developer.android.com/reference/kotlin/androidx/camera/common/testing/FakeStreamConfigurationMap#getOutputMinFrameDuration(kotlin.Int,android.util.Size)` (class-based queries). Class-based queries internally map to `https://developer.android.com/reference/android/graphics/ImageFormat.html#PRIVATE`. |

## Public functions

### getHighResolutionOutputSizes

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

```
open fun getHighResolutionOutputSizes(format: Int): List<Size>
```

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

### getHighSpeedVideoFpsRanges

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

```
open fun getHighSpeedVideoFpsRanges(): List<Range<Int>>
```

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

### getHighSpeedVideoFpsRangesFor

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

```
open fun getHighSpeedVideoFpsRangesFor(size: Size): List<Range<Int>>
```

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/params/StreamConfigurationMap.html#getHighSpeedVideoFpsRangesFor(android.util.Size)` |   |

### getHighSpeedVideoSizes

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

```
open fun getHighSpeedVideoSizes(): List<Size>
```

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

### getHighSpeedVideoSizesFor

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

```
open fun getHighSpeedVideoSizesFor(fpsRange: Range<Int>): List<Size>
```

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/params/StreamConfigurationMap.html#getHighSpeedVideoSizesFor(android.util.Range&lt;java.lang.Integer&gt;)` |   |

### getInputFormats

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

```
open fun getInputFormats(): List<Int>
```

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

### getInputSizes

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

```
open fun getInputSizes(format: Int): List<Size>
```

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

### getOutputFormats

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

```
open fun getOutputFormats(): List<Int>
```

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

### getOutputMinFrameDuration

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

```
open fun getOutputMinFrameDuration(format: Int, size: Size): Long
```

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/params/StreamConfigurationMap.html#getOutputMinFrameDuration(int, android.util.Size)` |   |

### getOutputMinFrameDuration

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

```
open fun <T : Any?> getOutputMinFrameDuration(klass: Class<T>, size: Size): Long
```

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/params/StreamConfigurationMap.html#getOutputMinFrameDuration(int, android.util.Size)` |   |

### getOutputSizes

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

```
open fun getOutputSizes(format: Int): List<Size>
```

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

### getOutputSizes

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

```
open fun <T : Any?> getOutputSizes(klass: Class<T>): List<Size>
```

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

### getOutputStallDuration

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

```
open fun getOutputStallDuration(format: Int, size: Size): Long
```

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/params/StreamConfigurationMap.html#getOutputStallDuration(int, android.util.Size)` |   |

### getOutputStallDuration

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

```
open fun <T : Any?> getOutputStallDuration(klass: Class<T>, size: Size): Long
```

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/params/StreamConfigurationMap.html#getOutputStallDuration(int, android.util.Size)` |   |

### getValidOutputFormatsForInput

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

```
open fun getValidOutputFormatsForInput(inputFormat: Int): List<Int>
```

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

### isOutputSupportedFor

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

```
open fun isOutputSupportedFor(format: Int): Boolean
```

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/params/StreamConfigurationMap.html#isOutputSupportedFor(android.view.Surface)` |   |

### isOutputSupportedFor

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

```
open fun <T : Any?> isOutputSupportedFor(klass: Class<T>): Boolean
```

Converting this method to non-static for testability.

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/params/StreamConfigurationMap.html#isOutputSupportedFor(android.view.Surface)` |   |

### isOutputSupportedFor

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

```
open fun isOutputSupportedFor(surface: Surface): Boolean
```

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/params/StreamConfigurationMap.html#isOutputSupportedFor(android.view.Surface)` |   |

### unwrapAs

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

```
open fun <T : Any> unwrapAs(type: Class<T>): T?
```

Attempts to unwrap this object into the specified underlying `https://developer.android.com/reference/kotlin/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/kotlin/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 : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html>` | The expected type of the underlying object. |
| `type: https://developer.android.com/reference/java/lang/Class.html<T>` | 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/kotlin/androidx/camera/common/UnsafeWrapper#unwrapAs(java.lang.Class)`, or `null` if the object cannot be unwrapped into the requested `https://developer.android.com/reference/kotlin/androidx/camera/common/UnsafeWrapper#unwrapAs(java.lang.Class)`. |