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

# CameraOfflineSession

*** ** * ** ***


`
public


abstract
class
CameraOfflineSession
`


`


`

`

extends https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession


`

`


`

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

<br />

*** ** * ** ***

A camera capture session that was switched to offline mode via successful call to
`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)`.

Offline capture sessions allow clients to select a set of camera registered surfaces that
support offline mode. After a successful offline mode switch all non-repeating pending requests
on those surfaces will continue to be processed by the camera stack even if clients close the
corresponding camera device.


Offline capture session instances will replace the previously active capture session arguments
in all capture callbacks after `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)` completes.

Processing of pending offline capture requests will begin only after the offline session
moves to ready state which will be indicated by the `https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession.CameraOfflineSessionCallback#onReady(android.hardware.camera2.CameraOfflineSession)`
callback.

In contrast to a regular `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession` an offline capture session will
not accept any further capture requests. Besides `https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession#close()` all
remaining methods will throw `https://developer.android.com/reference/java/lang/UnsupportedOperationException` and are not supported.

<br />

**See also:**

- `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#supportsOfflineProcessing(android.view.Surface)`

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession.CameraOfflineSessionCallback` |

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

| ### Public methods ||
|---|---|
| ` abstract void` | ` https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession#close()() ` Close this offline capture session. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession ` |---|---| | ` abstract void` | ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#abortCaptures()() ` Discard all captures currently pending and in-progress as fast as possible. | | ` abstract int` | ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#capture(android.hardware.camera2.CaptureRequest,%20android.hardware.camera2.CameraCaptureSession.CaptureCallback,%20android.os.Handler)(https://developer.android.com/reference/android/hardware/camera2/CaptureRequest request, https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback listener, https://developer.android.com/reference/android/os/Handler handler) ` <br /> Submit a request for an image to be captured by the camera device. | | ` abstract int` | ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#captureBurst(java.util.List<android.hardware.camera2.CaptureRequest>,%20android.hardware.camera2.CameraCaptureSession.CaptureCallback,%20android.os.Handler)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/hardware/camera2/CaptureRequest> requests, https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback listener, https://developer.android.com/reference/android/os/Handler handler) ` Submit a list of requests to be captured in sequence as a burst. | | ` int` | ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#captureBurstRequests(java.util.List<android.hardware.camera2.CaptureRequest>,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraCaptureSession.CaptureCallback)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/hardware/camera2/CaptureRequest> requests, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback listener) ` Submit a list of requests to be captured in sequence as a burst. | | ` int` | ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#captureSingleRequest(android.hardware.camera2.CaptureRequest,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraCaptureSession.CaptureCallback)(https://developer.android.com/reference/android/hardware/camera2/CaptureRequest request, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback listener) ` <br /> Submit a request for an image to be captured by the camera device. | | ` abstract void` | ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#close()() ` Close this capture session asynchronously. | | ` abstract void` | ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#finalizeOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration> outputConfigs) ` <br /> Finalize the output configurations that now have their deferred and/or extra Surfaces included. | | ` abstract https://developer.android.com/reference/android/hardware/camera2/CameraDevice` | ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#getDevice()() ` Get the camera device that this session is created for. | | ` abstract https://developer.android.com/reference/android/view/Surface` | ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#getInputSurface()() ` Get the input Surface associated with a reprocessable capture session. | | ` abstract boolean` | ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#isReprocessable()() ` Return if the application can submit reprocess capture requests with this camera capture session. | | ` abstract void` | ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#prepare(android.view.Surface)(https://developer.android.com/reference/android/view/Surface surface) ` <br /> Pre-allocate all buffers for an output Surface. | | ` abstract int` | ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#setRepeatingBurst(java.util.List<android.hardware.camera2.CaptureRequest>,%20android.hardware.camera2.CameraCaptureSession.CaptureCallback,%20android.os.Handler)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/hardware/camera2/CaptureRequest> requests, https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback listener, https://developer.android.com/reference/android/os/Handler handler) ` <br /> Request endlessly repeating capture of a sequence of images by this capture session. | | ` int` | ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#setRepeatingBurstRequests(java.util.List<android.hardware.camera2.CaptureRequest>,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraCaptureSession.CaptureCallback)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/hardware/camera2/CaptureRequest> requests, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback listener) ` <br /> Request endlessly repeating capture of a sequence of images by this capture session. | | ` abstract int` | ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#setRepeatingRequest(android.hardware.camera2.CaptureRequest,%20android.hardware.camera2.CameraCaptureSession.CaptureCallback,%20android.os.Handler)(https://developer.android.com/reference/android/hardware/camera2/CaptureRequest request, https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback listener, https://developer.android.com/reference/android/os/Handler handler) ` Request endlessly repeating capture of images by this capture session. | | ` int` | ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#setSingleRepeatingRequest(android.hardware.camera2.CaptureRequest,%20java.util.concurrent.Executor,%20android.hardware.camera2.CameraCaptureSession.CaptureCallback)(https://developer.android.com/reference/android/hardware/camera2/CaptureRequest request, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback listener) ` Request endlessly repeating capture of images by this capture session. | | ` abstract void` | ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#stopRepeating()() ` <br /> Cancel any ongoing repeating capture set by either `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#setRepeatingRequest(android.hardware.camera2.CaptureRequest,%20android.hardware.camera2.CameraCaptureSession.CaptureCallback,%20android.os.Handler)` or `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#setRepeatingBurst(java.util.List<android.hardware.camera2.CaptureRequest>,%20android.hardware.camera2.CameraCaptureSession.CaptureCallback,%20android.os.Handler)`. | | ` boolean` | ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#supportsOfflineProcessing(android.view.Surface)(https://developer.android.com/reference/android/view/Surface surface) ` <br /> Query whether a given Surface is able to support offline mode. | | ` https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession` | ` 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)(https://developer.android.com/reference/java/util/Collection<https://developer.android.com/reference/android/view/Surface> offlineSurfaces, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession.CameraOfflineSessionCallback listener) ` Switch the current capture session and a given set of registered camera surfaces to offline processing mode. | | ` void` | ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#updateOutputConfiguration(android.hardware.camera2.params.OutputConfiguration)(https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration config) ` Update `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration` after configuration finalization see `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#finalizeOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>)`. | | ` void` | ` https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession#updateOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration> configurations) ` Update the output configurations for this camera session. | ||
| 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*. | ||
| From interface ` https://developer.android.com/reference/java/lang/AutoCloseable ` |---|---| | ` abstract void` | ` https://developer.android.com/reference/java/lang/AutoCloseable#close()() ` Closes this resource, relinquishing any underlying resources. | ||

## Public constructors

### CameraOfflineSession

```
public CameraOfflineSession ()
```

<br />

<br />

## Public methods

### close

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

```
public abstract void close ()
```

Close this offline capture session.

Abort all pending offline requests and close the connection to the offline camera session
as quickly as possible.

This method can be called only after clients receive
`https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession.CameraOfflineSessionCallback#onReady(android.hardware.camera2.CameraOfflineSession)`.

Immediately after this call, besides the final
`https://developer.android.com/reference/android/hardware/camera2/CameraOfflineSession.CameraOfflineSessionCallback#onClosed(android.hardware.camera2.CameraOfflineSession)` notification, no further callbacks from the
offline session will be triggered and all remaining offline capture requests will be
discarded.

Closing a session is idempotent; closing more than once has no effect.

<br />

<br />

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if the offline session is not ready. |