Added in API level 31

ExtensionCaptureCallback


abstract class ExtensionCaptureCallback
kotlin.Any
   ↳ android.hardware.camera2.CameraExtensionSession.ExtensionCaptureCallback

A callback object for tracking the progress of a CaptureRequest submitted to the camera device.

This callback is invoked when a request triggers a capture to start, and when the device-specific Extension post processing begins. In case of an error capturing an image, the error method is triggered instead of the completion method.

Summary

Public constructors

Public methods
open Unit

This method is called instead of onCaptureProcessStarted when the camera device failed to produce the required input for the device-specific extension.

open Unit
onCaptureFailed(session: CameraExtensionSession, request: CaptureRequest, failure: Int)

This method is called instead of onCaptureProcessStarted when the camera device failed to produce the required input for the device-specific extension.

open Unit

This method is called when image capture processing is ongoing between onCaptureProcessStarted and the processed still capture frame returning to the client surface.

open Unit

This method is called when an image (or images in case of multi-frame capture) is captured and device-specific extension processing is triggered.

open Unit

This method is called when an image capture has fully completed and all the result metadata is available.

open Unit

This method is called when a capture sequence aborts.

open Unit

This method is called independently of the others in ExtensionCaptureCallback, when a capture sequence finishes.

open Unit
onCaptureStarted(session: CameraExtensionSession, request: CaptureRequest, timestamp: Long)

This method is called when the camera device has started capturing the initial input image of the device-specific extension post-process request.

Public constructors

ExtensionCaptureCallback

ExtensionCaptureCallback()

Public methods

onCaptureFailed

Added in API level 31
open fun onCaptureFailed(
    session: CameraExtensionSession,
    request: CaptureRequest
): Unit

This method is called instead of onCaptureProcessStarted when the camera device failed to produce the required input for the device-specific extension. The cause could be a failed camera capture request, a failed capture result or dropped camera frame.

Other requests are unaffected, and some or all image buffers from the capture may have been pushed to their respective output streams.

The default implementation of this method does nothing.

Parameters
session CameraExtensionSession: the session received during StateCallback#onConfigured(CameraExtensionSession) This value cannot be null.
request CaptureRequest: The request that was given to the CameraDevice This value cannot be null.

onCaptureFailed

Added in API level 35
open fun onCaptureFailed(
    session: CameraExtensionSession,
    request: CaptureRequest,
    failure: Int
): Unit

This method is called instead of onCaptureProcessStarted when the camera device failed to produce the required input for the device-specific extension. The cause could be a failed camera capture request, a failed capture result or dropped camera frame. More information about the reason is included in the 'failure' argument.

Other requests are unaffected, and some or all image buffers from the capture may have been pushed to their respective output streams.

The default implementation of this method does nothing.

Parameters
session CameraExtensionSession: the session received during StateCallback#onConfigured(CameraExtensionSession) This value cannot be null.
request CaptureRequest: The request that was given to the CameraDevice This value cannot be null.
failure Int: The capture failure reason Value is android.hardware.camera2.CaptureFailure#REASON_ERROR, or android.hardware.camera2.CaptureFailure#REASON_FLUSHED

onCaptureProcessProgressed

Added in API level 34
open fun onCaptureProcessProgressed(
    session: CameraExtensionSession,
    request: CaptureRequest,
    progress: Int
): Unit

This method is called when image capture processing is ongoing between onCaptureProcessStarted and the processed still capture frame returning to the client surface.

The value included in the arguments provides clients with an estimate of the post-processing progress which could take significantly more time relative to the rest of the capture sequence.

The callback will be triggered only by extensions that return true from calls CameraExtensionCharacteristics#isCaptureProcessProgressAvailable.

If support for this callback is present, then clients will be notified at least once with progress value 100.

The callback will be triggered only for still capture requests capture and is not supported for repeating requests setRepeatingRequest.

The default implementation of this method does nothing.

Parameters
session CameraExtensionSession: The session received during StateCallback#onConfigured(CameraExtensionSession) This value cannot be null.
request CaptureRequest: The request that was given to the CameraDevice This value cannot be null.
progress Int: Value between 0 and 100 (inclusive) indicating the current post-processing progress Value is between 0 and 100 inclusive

onCaptureProcessStarted

Added in API level 31
open fun onCaptureProcessStarted(
    session: CameraExtensionSession,
    request: CaptureRequest
): Unit

This method is called when an image (or images in case of multi-frame capture) is captured and device-specific extension processing is triggered.

Each request will generate at most 1 onCaptureProcessStarted.

The default implementation of this method does nothing.

Parameters
session CameraExtensionSession: the session received during StateCallback#onConfigured(CameraExtensionSession) This value cannot be null.
request CaptureRequest: The request that was given to the CameraExtensionSession This value cannot be null.

onCaptureResultAvailable

Added in API level 33
open fun onCaptureResultAvailable(
    session: CameraExtensionSession,
    request: CaptureRequest,
    result: TotalCaptureResult
): Unit

This method is called when an image capture has fully completed and all the result metadata is available.

This callback will only be called in case CameraExtensionCharacteristics#getAvailableCaptureResultKeys returns a valid non-empty list.

The default implementation of this method does nothing.

Parameters
session CameraExtensionSession: The session received during StateCallback#onConfigured(CameraExtensionSession) This value cannot be null.
request CaptureRequest: The request that was given to the CameraDevice This value cannot be null.
result TotalCaptureResult: The total output metadata from the capture, which only includes the capture result keys advertised as supported in CameraExtensionCharacteristics#getAvailableCaptureResultKeys. This value cannot be null.

onCaptureSequenceAborted

Added in API level 31
open fun onCaptureSequenceAborted(
    session: CameraExtensionSession,
    sequenceId: Int
): Unit

This method is called when a capture sequence aborts.

Due to the asynchronous nature of the camera device, not all submitted captures are immediately processed. It is possible to clear out the pending requests by a variety of operations such as CameraExtensionSession#stopRepeating. When such an event happens, onCaptureProcessStarted will not be called.

The default implementation does nothing.

Parameters
session CameraExtensionSession: the session received during StateCallback#onConfigured(CameraExtensionSession) This value cannot be null.
sequenceId Int: A sequence ID returned by the capture family of functions.

onCaptureSequenceCompleted

Added in API level 31
open fun onCaptureSequenceCompleted(
    session: CameraExtensionSession,
    sequenceId: Int
): Unit

This method is called independently of the others in ExtensionCaptureCallback, when a capture sequence finishes.

In total, there will be at least one onCaptureProcessStarted/#onCaptureFailed invocation before this callback is triggered. If the capture sequence is aborted before any requests have begun processing, onCaptureSequenceAborted is invoked instead.

The default implementation does nothing.

Parameters
session CameraExtensionSession: the session received during StateCallback#onConfigured(CameraExtensionSession) This value cannot be null.
sequenceId Int: A sequence ID returned by the capture family of functions.

onCaptureStarted

Added in API level 31
open fun onCaptureStarted(
    session: CameraExtensionSession,
    request: CaptureRequest,
    timestamp: Long
): Unit

This method is called when the camera device has started capturing the initial input image of the device-specific extension post-process request.

This callback is invoked right as the capture of a frame begins, so it is the most appropriate time for playing a shutter sound, or triggering UI indicators of capture.

The request that is being used for this capture is provided, along with the actual timestamp for the start of exposure.

The default implementation of this method does nothing.

Parameters
session CameraExtensionSession: the session received during StateCallback#onConfigured(CameraExtensionSession) This value cannot be null.
request CaptureRequest: the request for the capture that just begun This value cannot be null.
timestamp Long: the timestamp at start of capture for repeating request or the timestamp at start of capture of the first frame in a multi-frame capture.