# CameraExtensionSession.StateCallback

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.StateCallback#pubctors)\|[Methods](https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.StateCallback#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.StateCallback#inhmethods)  

# CameraExtensionSession.StateCallback

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/hardware/camera2/CameraExtensionSession.StateCallback "View this page in Kotlin")\|Java

`
public
static

abstract
class
CameraExtensionSession.StateCallback
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

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

<br />

*** ** * ** ***

A callback object for receiving updates about the state of a camera extension session.

## Summary

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

|                                                                                                                                                                                                                              ### Public methods                                                                                                                                                                                                                               ||
|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void`          | ` `[onClosed](https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.StateCallback#onClosed(android.hardware.camera2.CameraExtensionSession))`(`[CameraExtensionSession](https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession)` session) ` This method is called when the session is closed.                                                                                            |
| ` abstract void` | ` `[onConfigureFailed](https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.StateCallback#onConfigureFailed(android.hardware.camera2.CameraExtensionSession))`(`[CameraExtensionSession](https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession)` session) ` This method is called if the session cannot be configured as requested.                                                    |
| ` abstract void` | ` `[onConfigured](https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.StateCallback#onConfigured(android.hardware.camera2.CameraExtensionSession))`(`[CameraExtensionSession](https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession)` session) ` This method is called when the camera device has finished configuring itself, and the session can start processing capture requests. |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](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 `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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

### StateCallback

```
public StateCallback ()
```

<br />

<br />

## Public methods

### onClosed

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

```
public void onClosed (CameraExtensionSession session)
```

This method is called when the session is closed.

A session is closed when a new session is created by the parent camera device, or when the parent camera device is closed (either by the user closing the device, or due to a camera device disconnection or fatal error).

Once a session is closed, all methods on it will throw an IllegalStateException, and any repeating requests are stopped (as if[CameraExtensionSession.stopRepeating()](https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession#stopRepeating())was called). However, any in-progress capture requests submitted to the session will be completed as normal.

<br />

<br />

|                                                                                                                                                         Parameters                                                                                                                                                          ||
|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `session` | `CameraExtensionSession`: the session received during[StateCallback.onConfigured(CameraExtensionSession)](https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.StateCallback#onConfigured(android.hardware.camera2.CameraExtensionSession))This value cannot be`null`. <br /> |

### onConfigureFailed

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

```
public abstract void onConfigureFailed (CameraExtensionSession session)
```

This method is called if the session cannot be configured as requested.

This can happen if the set of requested outputs contains unsupported sizes, too many outputs are requested at once or when trying to initialize multiple concurrent extension sessions from two (or more) separate camera devices or the camera device encounters an unrecoverable error during configuration.

The session is considered to be closed, and all methods called on it after this callback is invoked will throw an IllegalStateException.

<br />

<br />

|                                                      Parameters                                                       ||
|-----------|------------------------------------------------------------------------------------------------------------|
| `session` | `CameraExtensionSession`: the session instance that failed to configure This value cannot be`null`. <br /> |

### onConfigured

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

```
public abstract void onConfigured (CameraExtensionSession session)
```

This method is called when the camera device has finished configuring itself, and the session can start processing capture requests.

If the camera device configuration fails, then[onConfigureFailed(CameraExtensionSession)](https://developer.android.com/reference/android/hardware/camera2/CameraExtensionSession.StateCallback#onConfigureFailed(android.hardware.camera2.CameraExtensionSession))will be invoked instead of this callback.

<br />

<br />

|                                            Parameters                                             ||
|-----------|----------------------------------------------------------------------------------------|
| `session` | `CameraExtensionSession`: A valid extension session This value cannot be`null`. <br /> |