Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#pubctors) \| [Methods](https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#inhmethods)

# CameraExtensionSession.ExtensionCaptureCallback

*** ** * ** ***

` public static abstract class CameraExtensionSession.ExtensionCaptureCallback `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.hardware.camera2.CameraExtensionSession.ExtensionCaptureCallback |

<br />

*** ** * ** ***

A callback object for tracking the progress of a `https://developer.android.com/reference/android/hardware/camera2/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.

<br />

**See also:**

- `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession#capture(android.hardware.camera2.CaptureRequest,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraExtensionSession.ExtensionCaptureCallback)`
- `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession#setRepeatingRequest(android.hardware.camera2.CaptureRequest,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraExtensionSession.ExtensionCaptureCallback)`

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#ExtensionCaptureCallback()() ` |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#onCaptureFailed(android.hardware.camera2.CameraExtensionSession,%20android.hardware.camera2.CaptureRequest,%20int)(https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession session, https://developer.android.com/reference/android/hardware/camera2/CaptureRequest request, int failure) ` This method is called instead of `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#onCaptureProcessStarted(android.hardware.camera2.CameraExtensionSession,%20android.hardware.camera2.CaptureRequest)` when the camera device failed to produce the required input for the device-specific extension. |
| ` void` | ` https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#onCaptureFailed(android.hardware.camera2.CameraExtensionSession,%20android.hardware.camera2.CaptureRequest)(https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession session, https://developer.android.com/reference/android/hardware/camera2/CaptureRequest request) ` This method is called instead of `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#onCaptureProcessStarted(android.hardware.camera2.CameraExtensionSession,%20android.hardware.camera2.CaptureRequest)` when the camera device failed to produce the required input for the device-specific extension. |
| ` void` | ` https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#onCaptureProcessProgressed(android.hardware.camera2.CameraExtensionSession,%20android.hardware.camera2.CaptureRequest,%20int)(https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession session, https://developer.android.com/reference/android/hardware/camera2/CaptureRequest request, int progress) ` This method is called when image capture processing is ongoing between `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#onCaptureProcessStarted(android.hardware.camera2.CameraExtensionSession,%20android.hardware.camera2.CaptureRequest)` and the processed still capture frame returning to the client surface. |
| ` void` | ` https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#onCaptureProcessStarted(android.hardware.camera2.CameraExtensionSession,%20android.hardware.camera2.CaptureRequest)(https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession session, https://developer.android.com/reference/android/hardware/camera2/CaptureRequest request) ` This method is called when an image (or images in case of multi-frame capture) is captured and device-specific extension processing is triggered. |
| ` void` | ` https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#onCaptureResultAvailable(android.hardware.camera2.CameraExtensionSession,%20android.hardware.camera2.CaptureRequest,%20android.hardware.camera2.TotalCaptureResult)(https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession session, https://developer.android.com/reference/android/hardware/camera2/CaptureRequest request, https://developer.android.com/reference/android/hardware/camera2/TotalCaptureResult result) ` This method is called when an image capture has fully completed and all the result metadata is available. |
| ` void` | ` https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#onCaptureSequenceAborted(android.hardware.camera2.CameraExtensionSession,%20int)(https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession session, int sequenceId) ` This method is called when a capture sequence aborts. |
| ` void` | ` https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#onCaptureSequenceCompleted(android.hardware.camera2.CameraExtensionSession,%20int)(https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession session, int sequenceId) ` This method is called independently of the others in ExtensionCaptureCallback, when a capture sequence finishes. |
| ` void` | ` https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#onCaptureStarted(android.hardware.camera2.CameraExtensionSession,%20android.hardware.camera2.CaptureRequest,%20long)(https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession session, https://developer.android.com/reference/android/hardware/camera2/CaptureRequest request, long timestamp) ` This method is called when the camera device has started capturing the initial input image of the device-specific extension post-process request. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public constructors

### ExtensionCaptureCallback

```
public ExtensionCaptureCallback ()
```

<br />

<br />

## Public methods

### onCaptureFailed

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onCaptureFailed (CameraExtensionSession session, 
                CaptureRequest request, 
                int failure)
```

This method is called instead of `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#onCaptureProcessStarted(android.hardware.camera2.CameraExtensionSession,%20android.hardware.camera2.CaptureRequest)` 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.

<br />

<br />

| Parameters ||
|---|---|
| `session` | `CameraExtensionSession`: the session received during `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.StateCallback#onConfigured(android.hardware.camera2.CameraExtensionSession)` This value cannot be `null`. <br /> |
| `request` | `CaptureRequest`: The request that was given to the CameraDevice. This value cannot be `null`. <br /> |
| `failure` | `int`: The capture failure reason. Value is one of the following: - `https://developer.android.com/reference/android/hardware/camera2/CaptureFailure#REASON_ERROR` - `https://developer.android.com/reference/android/hardware/camera2/CaptureFailure#REASON_FLUSHED` |

**See also:**

- `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession#capture(android.hardware.camera2.CaptureRequest,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraExtensionSession.ExtensionCaptureCallback)`
- `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession#setRepeatingRequest(android.hardware.camera2.CaptureRequest,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraExtensionSession.ExtensionCaptureCallback)`

### onCaptureFailed

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onCaptureFailed (CameraExtensionSession session, 
                CaptureRequest request)
```

This method is called instead of `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#onCaptureProcessStarted(android.hardware.camera2.CameraExtensionSession,%20android.hardware.camera2.CaptureRequest)` 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.

<br />

<br />

| Parameters ||
|---|---|
| `session` | `CameraExtensionSession`: the session received during `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.StateCallback#onConfigured(android.hardware.camera2.CameraExtensionSession)` This value cannot be `null`. <br /> |
| `request` | `CaptureRequest`: The request that was given to the CameraDevice. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession#capture(android.hardware.camera2.CaptureRequest,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraExtensionSession.ExtensionCaptureCallback)`
- `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession#setRepeatingRequest(android.hardware.camera2.CaptureRequest,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraExtensionSession.ExtensionCaptureCallback)`

### onCaptureProcessProgressed

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onCaptureProcessProgressed (CameraExtensionSession session, 
                CaptureRequest request, 
                int progress)
```

This method is called when image capture processing is ongoing between `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#onCaptureProcessStarted(android.hardware.camera2.CameraExtensionSession,%20android.hardware.camera2.CaptureRequest)` 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 `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession#capture(android.hardware.camera2.CaptureRequest,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraExtensionSession.ExtensionCaptureCallback)` sequence.

The callback will be triggered only by extensions that return `true` from calls `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionCharacteristics#isCaptureProcessProgressAvailable(int)`.

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 `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession#capture(android.hardware.camera2.CaptureRequest,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraExtensionSession.ExtensionCaptureCallback)` and is not supported for repeating requests `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession#setRepeatingRequest(android.hardware.camera2.CaptureRequest,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraExtensionSession.ExtensionCaptureCallback)`.

The default implementation of this method does nothing.

<br />

<br />

| Parameters ||
|---|---|
| `session` | `CameraExtensionSession`: The session received during `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.StateCallback#onConfigured(android.hardware.camera2.CameraExtensionSession)` This value cannot be `null`. <br /> |
| `request` | `CaptureRequest`: The request that was given to the CameraDevice. This value cannot be `null`. <br /> |
| `progress` | `int`: Value between 0 and 100 (inclusive) indicating the current post-processing progress. Value is between 0 and 100 inclusive <br /> |

**See also:**

- `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionCharacteristics#isCaptureProcessProgressAvailable(int)`

### onCaptureProcessStarted

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onCaptureProcessStarted (CameraExtensionSession session, 
                CaptureRequest request)
```

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` `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#onCaptureProcessStarted(android.hardware.camera2.CameraExtensionSession,%20android.hardware.camera2.CaptureRequest)`.

The default implementation of this method does nothing.

<br />

<br />

| Parameters ||
|---|---|
| `session` | `CameraExtensionSession`: the session received during `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.StateCallback#onConfigured(android.hardware.camera2.CameraExtensionSession)` This value cannot be `null`. <br /> |
| `request` | `CaptureRequest`: The request that was given to the CameraExtensionSession. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession#capture(android.hardware.camera2.CaptureRequest,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraExtensionSession.ExtensionCaptureCallback)`
- `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession#setRepeatingRequest(android.hardware.camera2.CaptureRequest,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraExtensionSession.ExtensionCaptureCallback)`

### onCaptureResultAvailable

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onCaptureResultAvailable (CameraExtensionSession session, 
                CaptureRequest request, 
                TotalCaptureResult result)
```

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 `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionCharacteristics#getAvailableCaptureResultKeys(int)` returns a valid non-empty list.

The default implementation of this method does nothing.

<br />

<br />

| Parameters ||
|---|---|
| `session` | `CameraExtensionSession`: The session received during `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.StateCallback#onConfigured(android.hardware.camera2.CameraExtensionSession)` This value cannot be `null`. <br /> |
| `request` | `CaptureRequest`: The request that was given to the CameraDevice. This value cannot be `null`. <br /> |
| `result` | `TotalCaptureResult`: The total output metadata from the capture, which only includes the capture result keys advertised as supported in `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionCharacteristics#getAvailableCaptureResultKeys(int)`. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession#capture(android.hardware.camera2.CaptureRequest,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraExtensionSession.ExtensionCaptureCallback)`
- `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession#setRepeatingRequest(android.hardware.camera2.CaptureRequest,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraExtensionSession.ExtensionCaptureCallback)`
- `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionCharacteristics#getAvailableCaptureResultKeys(int)`

### onCaptureSequenceAborted

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onCaptureSequenceAborted (CameraExtensionSession session, 
                int sequenceId)
```

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 `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession#stopRepeating()`. When such an event happens, `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#onCaptureProcessStarted(android.hardware.camera2.CameraExtensionSession,%20android.hardware.camera2.CaptureRequest)` will not be called.

The default implementation does nothing.

<br />

<br />

| Parameters ||
|---|---|
| `session` | `CameraExtensionSession`: the session received during `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.StateCallback#onConfigured(android.hardware.camera2.CameraExtensionSession)` This value cannot be `null`. <br /> |
| `sequenceId` | `int`: A sequence ID returned by the `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession#capture(android.hardware.camera2.CaptureRequest,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraExtensionSession.ExtensionCaptureCallback)` family of functions. <br /> |

**See also:**

- `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#onCaptureProcessStarted(android.hardware.camera2.CameraExtensionSession,%20android.hardware.camera2.CaptureRequest)`

### onCaptureSequenceCompleted

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onCaptureSequenceCompleted (CameraExtensionSession session, 
                int sequenceId)
```

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

In total, there will be at least one `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#onCaptureProcessStarted(android.hardware.camera2.CameraExtensionSession,%20android.hardware.camera2.CaptureRequest)`/`https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#onCaptureFailed(android.hardware.camera2.CameraExtensionSession,%20android.hardware.camera2.CaptureRequest)` invocation before this callback is triggered. If the capture sequence is aborted before any requests have begun processing, `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#onCaptureSequenceAborted(android.hardware.camera2.CameraExtensionSession,%20int)` is invoked instead.

The default implementation does nothing.

<br />

<br />

| Parameters ||
|---|---|
| `session` | `CameraExtensionSession`: the session received during `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.StateCallback#onConfigured(android.hardware.camera2.CameraExtensionSession)` This value cannot be `null`. <br /> |
| `sequenceId` | `int`: A sequence ID returned by the `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession#capture(android.hardware.camera2.CaptureRequest,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraExtensionSession.ExtensionCaptureCallback)` family of functions. <br /> |

**See also:**

- `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.ExtensionCaptureCallback#onCaptureSequenceAborted(android.hardware.camera2.CameraExtensionSession,%20int)`

### onCaptureStarted

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onCaptureStarted (CameraExtensionSession session, 
                CaptureRequest request, 
                long timestamp)
```

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.

<br />

<br />

| Parameters ||
|---|---|
| `session` | `CameraExtensionSession`: the session received during `https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.StateCallback#onConfigured(android.hardware.camera2.CameraExtensionSession)` This value cannot be `null`. <br /> |
| `request` | `CaptureRequest`: the request for the capture that just begun. This value cannot be `null`. <br /> |
| `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. <br /> |