CaptureResultWrapper


interface CaptureResultWrapper : CaptureResultMetadata

Known direct subclasses
FakeCaptureResult

A fake implementation of CaptureResultWrapper for testing.


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

Use this interface to query the results of a single image capture, including sensor exposure, lens status, and 3A states.

Since this interface extends Metadata, it supports querying both standard CaptureResult.Keys and custom Metadata.Keys.

To access the underlying native CaptureResult (if available), use the unwrapAs extension function:

val nativeResult = resultMetadata.unwrapAs<CaptureResult>()

Note: This interface is not stable for inheritance. Implementations should not be created directly by clients. For testing, use the fakes in the androidx.camera.common.testing package, such as FakeCaptureResult.

Example

val resultMetadata: CaptureResultWrapper = ...

// Querying standard CaptureResult keys
val lensState = resultMetadata[CaptureResult.LENS_STATE]

// Querying custom Metadata keys
val customValue = resultMetadata[myCustomMetadataKey]

Summary

Public properties

CameraId

The CameraId of the camera that produced this result.

CaptureRequestWrapper

The CaptureRequestWrapper that generated this capture result.

CameraFrameNumber

The CameraFrameNumber associated with this result.

List<CaptureResult.Key<*>>

List of all CaptureResult.Keys supported by this capture result.

Inherited functions

From androidx.camera.common.CaptureResultMetadata
operator T?
<T : Any> get(key: CaptureResult.Key<T>)

Retrieves the value of the specified CaptureResult.Key.

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

Retrieves the value of the specified CaptureResult.Key, or returns default if the key is not present or its value is null.

From androidx.camera.common.Metadata
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.

From androidx.camera.common.UnsafeWrapper
T?
<T : Any> unwrapAs(type: Class<T>)

Attempts to unwrap this object into the specified underlying type.

Inherited properties

From androidx.camera.common.Metadata
Set<Metadata.Key<*>>

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

Public properties

cameraId

Added in 1.7.0-alpha03
val cameraIdCameraId

The CameraId of the camera that produced this result.

captureRequest

Added in 1.7.0-alpha03
val captureRequestCaptureRequestWrapper

The CaptureRequestWrapper that generated this capture result.

This represents the request settings that were active when this result was produced.

frameNumber

Added in 1.7.0-alpha03
val frameNumberCameraFrameNumber

The CameraFrameNumber associated with this result.

The frame number is a unique, monotonically increasing identifier for the frame.

keys

Added in 1.7.0-alpha03
val keysList<CaptureResult.Key<*>>

List of all CaptureResult.Keys supported by this capture result.

The list of all CaptureResult.Keys that are supported and can be queried from this result.

See also
getKeys