CaptureResultWrapper


public interface CaptureResultWrapper extends 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 methods

abstract @NonNull CameraId

The CameraId of the camera that produced this result.

abstract @NonNull CaptureRequestWrapper

The CaptureRequestWrapper that generated this capture result.

abstract @NonNull CameraFrameNumber

The CameraFrameNumber associated with this result.

abstract @NonNull List<@NonNull CaptureResult.Key<@NonNull ?>>

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

Inherited methods

From androidx.camera.common.CaptureResultMetadata
abstract T
<T extends Object> get(@NonNull CaptureResult.Key<@NonNull T> key)

Retrieves the value of the specified CaptureResult.Key.

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

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
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.

From androidx.camera.common.UnsafeWrapper
abstract T
<T extends Object> unwrapAs(@NonNull Class<@NonNull T> type)

Attempts to unwrap this object into the specified underlying type.

Public methods

getCameraId

Added in 1.7.0-alpha03
abstract @NonNull CameraId getCameraId()

The CameraId of the camera that produced this result.

getCaptureRequest

Added in 1.7.0-alpha03
abstract @NonNull CaptureRequestWrapper getCaptureRequest()

The CaptureRequestWrapper that generated this capture result.

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

getFrameNumber

Added in 1.7.0-alpha03
abstract @NonNull CameraFrameNumber getFrameNumber()

The CameraFrameNumber associated with this result.

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

getKeys

Added in 1.7.0-alpha03
abstract @NonNull List<@NonNull CaptureResult.Key<@NonNull ?>> getKeys()

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