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

class Metadata.Key<T : Any>

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

Public functions

operator T?
<T : Any> get(key: Metadata.Key<T>)

Retrieves the value associated with the specified Metadata.Key.

open T
<T : Any> getOrDefault(key: Metadata.Key<T>, default: T)

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

Public properties

Set<Metadata.Key<*>>

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

Public functions

get

Added in 1.7.0-alpha03
operator fun <T : Any> get(key: Metadata.Key<T>): T?

Retrieves the value associated with the specified Metadata.Key.

Parameters
<T : Any>

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

key: Metadata.Key<T>

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.

getOrDefault

Added in 1.7.0-alpha03
open fun <T : Any> getOrDefault(key: Metadata.Key<T>, default: T): T

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

Parameters
<T : Any>

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

key: Metadata.Key<T>

The custom key to query.

default: T

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

Returns
T

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

Public properties

metadataKeys

Added in 1.7.0-alpha03
val metadataKeysSet<Metadata.Key<*>>

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.