# ExposureState

Artifact: [androidx.camera:camera-core](https://developer.android.com/jetpack/androidx/releases/camera) [View Source](https://cs.android.com/search?q=file:androidx/camera/core/ExposureState.java+class:androidx.camera.core.ExposureState) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/camera#1.0.0)

*** ** * ** ***


```
interface ExposureState
```

<br />

*** ** * ** ***

An interface which contains the camera exposure related information.

Applications can retrieve an instance via `https://developer.android.com/reference/kotlin/androidx/camera/core/CameraInfo#getExposureState()`.

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/core/ExposureState#getExposureCompensationIndex()()` Get the current exposure compensation index. |
| `https://developer.android.com/reference/android/util/Range.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!>` | `https://developer.android.com/reference/kotlin/androidx/camera/core/ExposureState#getExposureCompensationRange()()` Get the maximum and minimum exposure compensation values for `https://developer.android.com/reference/kotlin/androidx/camera/core/CameraControl#setExposureCompensationIndex(int)` |
| `https://developer.android.com/reference/android/util/Rational.html` | `https://developer.android.com/reference/kotlin/androidx/camera/core/ExposureState#getExposureCompensationStep()()` Get the smallest step by which the exposure compensation can be changed. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/core/ExposureState#isExposureCompensationSupported()()` Whether exposure compensation is supported for this camera. |

## Public functions

### getExposureCompensationIndex

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/camera#1.0.0)

```
fun getExposureCompensationIndex(): Int
```

Get the current exposure compensation index.

The exposure value (EV) is the compensation index multiplied by the step value which is given by `https://developer.android.com/reference/kotlin/androidx/camera/core/ExposureState#getExposureCompensationStep()`. Increasing the compensation index by using the `https://developer.android.com/reference/kotlin/androidx/camera/core/CameraControl#setExposureCompensationIndex(int)` will increase exposure making the capture result brighter, decreasing the value making it darker.

For example, if the exposure value (EV) step size is 0.333, set the exposure compensation index value '6' will mean an exposure compensation of +2 EV; -3 will mean an exposure compensation of -1 EV.

The exposure value resets to default when there is no `https://developer.android.com/reference/kotlin/androidx/camera/core/UseCase` associated with the camera. For example, unbind all use cases from the camera or when the lifecycle changed that all the use case stopping data from the camera.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The current exposure compensation index. If `https://developer.android.com/reference/kotlin/androidx/camera/core/ExposureState#isExposureCompensationSupported()` is false, always return 0. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/CameraControl#setExposureCompensationIndex(int)` |   |

### getExposureCompensationRange

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/camera#1.0.0)

```
fun getExposureCompensationRange(): Range<Int!>
```

Get the maximum and minimum exposure compensation values for `https://developer.android.com/reference/kotlin/androidx/camera/core/CameraControl#setExposureCompensationIndex(int)`

The actual exposure value (EV) range that supported by the camera can be calculated by multiplying the `https://developer.android.com/reference/kotlin/androidx/camera/core/ExposureState#getExposureCompensationStep()` with the maximum and minimum values:

``Min.exposure compensation * `https://developer.android.com/reference/kotlin/androidx/camera/core/ExposureState#getExposureCompensationStep()` <= minimum
supported EV``

``Max.exposure compensation * `https://developer.android.com/reference/kotlin/androidx/camera/core/ExposureState#getExposureCompensationStep()` >= maximum
supported EV``

| Returns |
|---|---|
| `https://developer.android.com/reference/android/util/Range.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!>` | the maximum and minimum exposure compensation values range. If `https://developer.android.com/reference/kotlin/androidx/camera/core/ExposureState#isExposureCompensationSupported()` is false, return Range \[0,0\]. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html#CONTROL_AE_COMPENSATION_RANGE` |   |

### getExposureCompensationStep

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/camera#1.0.0)

```
fun getExposureCompensationStep(): Rational
```

Get the smallest step by which the exposure compensation can be changed.

| Returns |
|---|---|
| `https://developer.android.com/reference/android/util/Rational.html` | The exposure compensation step. If `https://developer.android.com/reference/kotlin/androidx/camera/core/ExposureState#isExposureCompensationSupported()` is false, return `https://developer.android.com/reference/android/util/Rational.html#ZERO`. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics.html#CONTROL_AE_COMPENSATION_STEP` |   |

### isExposureCompensationSupported

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/camera#1.0.0)

```
fun isExposureCompensationSupported(): Boolean
```

Whether exposure compensation is supported for this camera.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if exposure compensation is supported for this camera. |