FakeColorSpaceProfiles


public final class FakeColorSpaceProfiles implements ColorSpaceProfilesWrapper


A fake implementation of ColorSpaceProfilesWrapper for testing.

Allows mock values to be configured for supported color spaces, image formats, and dynamic range profiles.

Summary

Public constructors

FakeColorSpaceProfiles(
    @NonNull Map<@NonNull Integer, @NonNull Set<@NonNull String>> supportedColorSpaces,
    @NonNull Map<@NonNull String, @NonNull Set<@NonNull Integer>> supportedImageFormats,
    @NonNull Map<@NonNull Pair<@NonNull String, @NonNull Integer>, @NonNull Set<@NonNull Long>> supportedDynamicRangeProfiles,
    @NonNull Map<@NonNull Pair<@NonNull Integer, @NonNull Long>, @NonNull Set<@NonNull String>> supportedColorSpacesForDynamicRange
)

Public methods

@NonNull Set<@NonNull String>
getSupportedColorSpaces(int imageFormat)

Get the supported color spaces for a given image format.

@NonNull Set<@NonNull String>
getSupportedColorSpacesForDynamicRange(
    int imageFormat,
    long dynamicRangeProfile
)

Get the supported color spaces for a given image format and dynamic range profile.

@NonNull Set<@NonNull Long>
getSupportedDynamicRangeProfiles(
    @NonNull String cameraColorSpace,
    int imageFormat
)

Get the supported dynamic range profiles for a given color space and image format.

@NonNull Set<@NonNull Integer>

Get the supported image formats for a given color space.

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

Attempts to unwrap this object into the specified underlying type.

Public constructors

FakeColorSpaceProfiles

public FakeColorSpaceProfiles(
    @NonNull Map<@NonNull Integer, @NonNull Set<@NonNull String>> supportedColorSpaces,
    @NonNull Map<@NonNull String, @NonNull Set<@NonNull Integer>> supportedImageFormats,
    @NonNull Map<@NonNull Pair<@NonNull String, @NonNull Integer>, @NonNull Set<@NonNull Long>> supportedDynamicRangeProfiles,
    @NonNull Map<@NonNull Pair<@NonNull Integer, @NonNull Long>, @NonNull Set<@NonNull String>> supportedColorSpacesForDynamicRange
)

Public methods

getSupportedColorSpaces

Added in 1.7.0-alpha03
public @NonNull Set<@NonNull StringgetSupportedColorSpaces(int imageFormat)

Get the supported color spaces for a given image format.

Parameters
int imageFormat

The image format to query.

Returns
@NonNull Set<@NonNull String>

The set of supported CameraColorSpaces.

getSupportedColorSpacesForDynamicRange

Added in 1.7.0-alpha03
public @NonNull Set<@NonNull StringgetSupportedColorSpacesForDynamicRange(
    int imageFormat,
    long dynamicRangeProfile
)

Get the supported color spaces for a given image format and dynamic range profile.

Parameters
int imageFormat

The image format to query.

long dynamicRangeProfile

The dynamic range profile to query.

Returns
@NonNull Set<@NonNull String>

The set of supported CameraColorSpaces.

getSupportedDynamicRangeProfiles

Added in 1.7.0-alpha03
public @NonNull Set<@NonNull LonggetSupportedDynamicRangeProfiles(
    @NonNull String cameraColorSpace,
    int imageFormat
)

Get the supported dynamic range profiles for a given color space and image format.

Parameters
@NonNull String cameraColorSpace

The CameraColorSpace to query.

int imageFormat

The image format to query.

Returns
@NonNull Set<@NonNull Long>

A set of framework dynamic range profiles (e.g., android.hardware.camera2.params.DynamicRangeProfiles.HDR10)

getSupportedImageFormatsForColorSpace

Added in 1.7.0-alpha03
public @NonNull Set<@NonNull IntegergetSupportedImageFormatsForColorSpace(@NonNull String cameraColorSpace)

Get the supported image formats for a given color space.

Parameters
@NonNull String cameraColorSpace

The CameraColorSpace to query.

Returns
@NonNull Set<@NonNull Integer>

The set of supported image formats.

unwrapAs

Added in 1.7.0-alpha03
public T <T extends Object> unwrapAs(@NonNull Class<@NonNull T> type)

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 extends Object>

The expected type of the underlying object.

@NonNull Class<@NonNull T> type

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.