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

# CameraOfflineSession.CameraOfflineSessionCallback

*** ** * ** ***

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

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

<br />

*** ** * ** ***

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession.CameraOfflineSessionCallback#STATUS_INTERNAL_ERROR` This status code indicates unexpected and fatal internal camera error. |

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

| ### Public methods ||
|---|---|
| ` abstract void` | ` https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession.CameraOfflineSessionCallback#onClosed(android.hardware.camera2.CameraOfflineSession)(https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession session) ` This method is called when the offline session is closed. |
| ` abstract void` | ` https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession.CameraOfflineSessionCallback#onError(android.hardware.camera2.CameraOfflineSession,%20int)(https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession session, int status) ` This method is called when the offline session encounters an unexpected error. |
| ` abstract void` | ` https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession.CameraOfflineSessionCallback#onIdle(android.hardware.camera2.CameraOfflineSession)(https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession session) ` This method indicates that all pending offline requests were processed. |
| ` abstract void` | ` https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession.CameraOfflineSessionCallback#onReady(android.hardware.camera2.CameraOfflineSession)(https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession session) ` This method indicates that the offline switch call `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#switchToOffline(java.util.Collection<android.view.Surface>,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraOfflineSession.CameraOfflineSessionCallback)` was successful. |
| ` abstract void` | ` https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession.CameraOfflineSessionCallback#onSwitchFailed(android.hardware.camera2.CameraOfflineSession)(https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession session) ` This method indicates that the offline switch call `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#switchToOffline(java.util.Collection<android.view.Surface>,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraOfflineSession.CameraOfflineSessionCallback)` was not able to complete successfully. |

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

## Constants

### STATUS_INTERNAL_ERROR

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

```
public static final int STATUS_INTERNAL_ERROR
```

This status code indicates unexpected and fatal internal camera error.

Pending offline requests will be discarded and the respective registered capture callbacks may not get triggered.

<br />

<br />

**See also:**

- `https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession.CameraOfflineSessionCallback#onError(android.hardware.camera2.CameraOfflineSession,%20int)`

Constant Value: 0 (0x00000000)

## Public constructors

### CameraOfflineSessionCallback

```
public CameraOfflineSessionCallback ()
```

<br />

<br />

## Public methods

### onClosed

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

```
public abstract void onClosed (CameraOfflineSession session)
```

This method is called when the offline session is closed.

An offline session will be closed after a call to `https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession#close()`.

In case of failure to switch to offline mode, only `https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession.CameraOfflineSessionCallback#onSwitchFailed(android.hardware.camera2.CameraOfflineSession)` will be called and `https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession.CameraOfflineSessionCallback#onClosed(android.hardware.camera2.CameraOfflineSession)` will not be.

In case there was no previous `https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession.CameraOfflineSessionCallback#onIdle(android.hardware.camera2.CameraOfflineSession)` notification any in-progress offline capture requests within the offline session will be discarded and further result callbacks will not be triggered.

<br />

<br />

| Parameters ||
|---|---|
| `session` | `CameraOfflineSession`: the session returned by `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#switchToOffline(java.util.Collection<android.view.Surface>,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraOfflineSession.CameraOfflineSessionCallback)` This value cannot be `null`. <br /> |

### onError

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

```
public abstract void onError (CameraOfflineSession session, 
                int status)
```

This method is called when the offline session encounters an unexpected error.

This notification will only be invoked for sessions that reached the ready state. Clients will need to call `https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession#close()` to close and release all resources. `https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession.CameraOfflineSessionCallback#onClosed(android.hardware.camera2.CameraOfflineSession)` will not be triggered automatically in error scenarios.

<br />

<br />

| Parameters ||
|---|---|
| `session` | `CameraOfflineSession`: the current offline session. This value cannot be `null`. <br /> |
| `status` | `int`: error status. Value is one of the following: - `https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession.CameraOfflineSessionCallback#STATUS_INTERNAL_ERROR` |

### onIdle

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

```
public abstract void onIdle (CameraOfflineSession session)
```

This method indicates that all pending offline requests were processed.

This callback will be invoked once the offline session finishes processing all of its pending offline capture requests.

<br />

<br />

| Parameters ||
|---|---|
| `session` | `CameraOfflineSession`: the currently ready offline session. This value cannot be `null`. <br /> |

### onReady

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

```
public abstract void onReady (CameraOfflineSession session)
```

This method indicates that the offline switch call `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#switchToOffline(java.util.Collection<android.view.Surface>,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraOfflineSession.CameraOfflineSessionCallback)` was successful.

This callback will be invoked once the offline session moves to the ready state.

Calls to `https://developer.android.com/reference/android/hardware/camera2/CameraDevice#close()` will not have impact on the processing of offline requests once the offline session moves in ready state.

<br />

<br />

| Parameters ||
|---|---|
| `session` | `CameraOfflineSession`: the currently ready offline session. This value cannot be `null`. <br /> |

### onSwitchFailed

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

```
public abstract void onSwitchFailed (CameraOfflineSession session)
```

This method indicates that the offline switch call `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#switchToOffline(java.util.Collection<android.view.Surface>,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraOfflineSession.CameraOfflineSessionCallback)` was not able to complete successfully.

The offline switch can fail either due to internal camera error during the switch sequence or because the camera implementation was not able to find any pending capture requests that can be migrated to offline mode.

Calling `https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession#close()` is not necessary and clients will not receive any further offline session notifications.

<br />

<br />

| Parameters ||
|---|---|
| `session` | `CameraOfflineSession`: the offline session that failed to switch to ready state. This value cannot be `null`. <br /> |