FakeStreamConfigurationMap


class FakeStreamConfigurationMap : StreamConfigurationMapWrapper


A fake implementation of 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

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

Defines a single entry for a valid input format for testing purposes.

Key used to identify an output configuration in FakeStreamConfigurationMap.

Values associated with an output configuration in FakeStreamConfigurationMap.

Public constructors

FakeStreamConfigurationMap(
    outputsTable: LinkedHashMap<FakeStreamConfigurationMap.OutputKeyFakeStreamConfigurationMap.OutputValues>,
    inputTable: List<FakeStreamConfigurationMap.InputTableEntry>,
    outputFormatsForInputFormats: Map<IntList<Int>>,
    outputClassTypes: Set<Class<*>>
)

Public functions

open List<Size>
open List<Range<Int>>
open List<Range<Int>>
open List<Size>
open List<Size>
open List<Int>
open List<Size>
getInputSizes(format: Int)
open List<Int>
open Long
open Long
<T : Any?> getOutputMinFrameDuration(klass: Class<T>, size: Size)
open List<Size>
open List<Size>
<T : Any?> getOutputSizes(klass: Class<T>)
open Long
getOutputStallDuration(format: Int, size: Size)
open Long
<T : Any?> getOutputStallDuration(klass: Class<T>, size: Size)
open List<Int>
open Boolean
open Boolean
<T : Any?> isOutputSupportedFor(klass: Class<T>)

Converting this method to non-static for testability.

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

Attempts to unwrap this object into the specified underlying type.

Public constructors

FakeStreamConfigurationMap

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

The map of supported outputs, mapping OutputKey to OutputValues. Must be a LinkedHashMap to preserve insertion order. Used by output-related queries (e.g., getOutputFormats, getOutputSizes, getOutputMinFrameDuration).

inputTable: List<FakeStreamConfigurationMap.InputTableEntry> = emptyList()

The list of supported inputs. Used by getInputFormats and getInputSizes.

outputFormatsForInputFormats: Map<IntList<Int>> = emptyMap()

Mapping of input formats to their valid output formats. Used by getValidOutputFormatsForInput.

outputClassTypes: Set<Class<*>> = emptySet()

Set of class types that are supported as outputs. Used by isOutputSupportedFor (class-based queries) and getOutputMinFrameDuration (class-based queries). Class-based queries internally map to GraphicsImageFormat.PRIVATE.

Public functions

getHighResolutionOutputSizes

Added in 1.7.0-alpha03
open fun getHighResolutionOutputSizes(format: Int): List<Size>

getHighSpeedVideoFpsRanges

Added in 1.7.0-alpha03
open fun getHighSpeedVideoFpsRanges(): List<Range<Int>>

getHighSpeedVideoFpsRangesFor

Added in 1.7.0-alpha03
open fun getHighSpeedVideoFpsRangesFor(size: Size): List<Range<Int>>

getHighSpeedVideoSizes

Added in 1.7.0-alpha03
open fun getHighSpeedVideoSizes(): List<Size>

getHighSpeedVideoSizesFor

Added in 1.7.0-alpha03
open fun getHighSpeedVideoSizesFor(fpsRange: Range<Int>): List<Size>

getInputFormats

Added in 1.7.0-alpha03
open fun getInputFormats(): List<Int>
See also
getInputFormats

getInputSizes

Added in 1.7.0-alpha03
open fun getInputSizes(format: Int): List<Size>
See also
getInputSizes

getOutputFormats

Added in 1.7.0-alpha03
open fun getOutputFormats(): List<Int>
See also
getOutputFormats

getOutputMinFrameDuration

Added in 1.7.0-alpha03
open fun getOutputMinFrameDuration(format: Int, size: Size): Long

getOutputMinFrameDuration

Added in 1.7.0-alpha03
open fun <T : Any?> getOutputMinFrameDuration(klass: Class<T>, size: Size): Long

getOutputSizes

Added in 1.7.0-alpha03
open fun getOutputSizes(format: Int): List<Size>
See also
getOutputSizes

getOutputSizes

Added in 1.7.0-alpha03
open fun <T : Any?> getOutputSizes(klass: Class<T>): List<Size>
See also
getOutputSizes

getOutputStallDuration

Added in 1.7.0-alpha03
open fun getOutputStallDuration(format: Int, size: Size): Long

getOutputStallDuration

Added in 1.7.0-alpha03
open fun <T : Any?> getOutputStallDuration(klass: Class<T>, size: Size): Long

getValidOutputFormatsForInput

Added in 1.7.0-alpha03
open fun getValidOutputFormatsForInput(inputFormat: Int): List<Int>

isOutputSupportedFor

Added in 1.7.0-alpha03
open fun isOutputSupportedFor(format: Int): Boolean

isOutputSupportedFor

Added in 1.7.0-alpha03
open fun <T : Any?> isOutputSupportedFor(klass: Class<T>): Boolean

Converting this method to non-static for testability.

isOutputSupportedFor

Added in 1.7.0-alpha03
open fun isOutputSupportedFor(surface: Surface): Boolean

unwrapAs

Added in 1.7.0-alpha03
open fun <T : Any> unwrapAs(type: Class<T>): T?

Attempts to unwrap this object into the specified underlying type.

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

Implementation Notes

  • If the requested type 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 : Any>

The expected type of the underlying object.

type: Class<T>

The Class representing the expected type of the underlying object.

Returns
T?

The underlying object cast to T, or null if the object cannot be unwrapped into the requested type.