Added in API level 21

CaptureFailure

open class CaptureFailure
kotlin.Any
   ↳ android.hardware.camera2.CaptureFailure

A report of failed capture for a single image capture from the image sensor.

CaptureFailures are produced by a CameraDevice if processing a CaptureRequest fails, either partially or fully. Use getReason to determine the specific nature of the failed capture.

Receiving a CaptureFailure means that the metadata associated with that frame number has been dropped -- no CaptureResult with the same frame number will be produced.

Summary

Constants
static Int

The CaptureResult has been dropped this frame only due to an error in the framework.

static Int

The capture has failed due to a CameraCaptureSession#abortCaptures call from the application.

Public methods
open Long

Get the frame number associated with this failed capture.

open String?

The physical camera device ID in case the capture failure comes from a CaptureRequest with configured physical camera streams for a logical camera.

open Int

Determine why the request was dropped, whether due to an error or to a user action.

open CaptureRequest

Get the request associated with this failed capture.

open Int

The sequence ID for this failed capture that was returned by the CameraCaptureSession#capture family of functions.

open Boolean

Determine if the image was captured from the camera.

Constants

REASON_ERROR

Added in API level 21
static val REASON_ERROR: Int

The CaptureResult has been dropped this frame only due to an error in the framework.

Value: 0

See Also

REASON_FLUSHED

Added in API level 21
static val REASON_FLUSHED: Int

The capture has failed due to a CameraCaptureSession#abortCaptures call from the application.

Value: 1

See Also

Public methods

getFrameNumber

Added in API level 21
open fun getFrameNumber(): Long

Get the frame number associated with this failed capture.

Whenever a request has been processed, regardless of failed capture or success, it gets a unique frame number assigned to its future result/failed capture.

This value monotonically increments, starting with 0, for every new result or failure; and the scope is the lifetime of the CameraDevice.

Return
Long long frame number

getPhysicalCameraId

Added in API level 29
open fun getPhysicalCameraId(): String?

The physical camera device ID in case the capture failure comes from a CaptureRequest with configured physical camera streams for a logical camera.

Return
String? String The physical camera device ID of the respective failing output. null in case the capture request has no associated physical camera device.

getReason

Added in API level 21
open fun getReason(): Int

Determine why the request was dropped, whether due to an error or to a user action.

Return
Int int The reason code. Value is android.hardware.camera2.CaptureFailure#REASON_ERROR, or android.hardware.camera2.CaptureFailure#REASON_FLUSHED

getRequest

Added in API level 21
open fun getRequest(): CaptureRequest

Get the request associated with this failed capture.

Whenever a request is unsuccessfully captured, with CameraCaptureSession.CaptureCallback#onCaptureFailed, the failed capture's getRequest() will return that request.

In particular,

<code>cameraDevice.capture(someRequest, new CaptureCallback() {
      @Override
      void onCaptureFailed(CaptureRequest myRequest, CaptureFailure myFailure) {
          assert(myFailure.getRequest.equals(myRequest) == true);
      }
  };
  </code>

Return
CaptureRequest The request associated with this failed capture. Never null.

getSequenceId

Added in API level 21
open fun getSequenceId(): Int

The sequence ID for this failed capture that was returned by the CameraCaptureSession#capture family of functions.

The sequence ID is a unique monotonically increasing value starting from 0, incremented every time a new group of requests is submitted to the CameraDevice.

Return
Int int The ID for the sequence of requests that this capture failure is the result of

wasImageCaptured

Added in API level 21
open fun wasImageCaptured(): Boolean

Determine if the image was captured from the camera.

If the image was not captured, no image buffers will be available. If the image was captured, then image buffers may be available.

Return
Boolean boolean True if the image was captured, false otherwise.