public interface Metadata

Known direct subclasses
CameraCharacteristicsMetadata

An interface that provides compatibility-focused, read-only query access to CameraCharacteristics.

CaptureRequestMetadata

An interface that provides compatibility-focused, read-only query access to the settings applied to a camera capture request.

CaptureResultMetadata

An interface that provides compatibility-focused, read-only query access to the results of a single image capture.

Known indirect subclasses
CameraCharacteristicsWrapper

Wrapper interface providing compatibility-focused access to CameraCharacteristics.

CameraExtensionCharacteristicsWrapper

Compatibility wrapper around CameraExtensionCharacteristics.

CaptureRequestWrapper

A wrapper interface representing the settings applied to a specific camera capture request.

CaptureResultWrapper

A wrapper interface providing compatibility-focused access to CaptureResult and custom metadata.

FakeCameraCharacteristics

A fake implementation of CameraCharacteristicsWrapper for testing.

FakeCameraExtensionCharacteristics

A fake implementation of CameraExtensionCharacteristicsWrapper for testing.

FakeCaptureRequest

A fake implementation of CaptureRequestWrapper designed for unit testing.

FakeCaptureResult

A fake implementation of CaptureResultWrapper for testing.


A read-only, map-like interface for accessing unified camera metadata.

This interface serves as the common base for metadata containers in the Camera common library, such as CameraCharacteristicsWrapper, CaptureRequestWrapper, and CaptureResultWrapper.

It provides type-safe access to library-defined custom keys (Metadata.Key) in addition to the platform-specific keys supported by its sub-interfaces.

Key Concepts

  • Unified Access: Allows combining native camera metadata (from the Android Camera2 API) with custom, internally-computed, or version-compatibility properties.

  • Read-Only: The container's contents cannot be modified through this interface.

  • Type-Safety: Values are retrieved using strongly-typed Key instances.

Summary

Nested types

public final class Metadata.Key<T extends Object>

A type-safe key used to identify and retrieve values from a Metadata container.

Public methods

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

Retrieves the value associated with the specified Metadata.Key.

abstract @NonNull Set<@NonNull Metadata.Key<@NonNull ?>>

The set of all custom Metadata.Keys currently available in this container.

default @NonNull T
<T extends Object> getOrDefault(
    @NonNull Metadata.Key<@NonNull T> key,
    @NonNull T default
)

Retrieves the value associated with the specified Metadata.Key, or returns default if the key is not present.

Public methods

get

Added in 1.7.0-alpha03
abstract T <T extends Object> get(@NonNull Metadata.Key<@NonNull T> key)

Retrieves the value associated with the specified Metadata.Key.

Parameters
<T extends Object>

The type of the value (must be non-nullable).

@NonNull Metadata.Key<@NonNull T> key

The custom key to query.

Returns
T

The value associated with the key, or null if the key is not present in this container or if its value is not set.

getMetadataKeys

Added in 1.7.0-alpha03
abstract @NonNull Set<@NonNull Metadata.Key<@NonNull ?>> getMetadataKeys()

The set of all custom Metadata.Keys currently available in this container.

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

getOrDefault

Added in 1.7.0-alpha03
default @NonNull T <T extends Object> getOrDefault(
    @NonNull Metadata.Key<@NonNull T> key,
    @NonNull T default
)

Retrieves the value associated with the specified Metadata.Key, or returns default if the key is not present.

Parameters
<T extends Object>

The type of the value (must be non-nullable).

@NonNull Metadata.Key<@NonNull T> key

The custom key to query.

@NonNull T default

The value to return if the key is not present or if its value is null.

Returns
@NonNull T

The value associated with the key, or default if the value is not present.