# SessionParametersLegacy

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

*** ** * ** ***

<br />

```
class SessionParametersLegacy
```

<br />

*** ** * ** ***

A compat class to store Session Parameters for querying support. This class is a simple holder class for holding `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html`s and associated values, similar to what `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html` does in `https://developer.android.com/reference/android/hardware/camera2/params/SessionConfiguration.html#setSessionParameters(android.hardware.camera2.CaptureRequest)`.

This class allows querying on devices that do not support Camera2's `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.CameraDeviceSetup.html` and need to query the camera capabilities before calling `https://developer.android.com/reference/android/hardware/camera2/CameraManager.html#openCamera(java.lang.String, android.hardware.camera2.CameraDevice.StateCallback, android.os.Handler)`.

However, there are downsides to using the `*Legacy` classes.

1. When `*Legacy` classes are used, only the non-Camera2 databases (if present) will be queried.
2. The output of `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.html#createCaptureRequest(int)` will often set defaults based on the Template passed to it. Without the capture request provided by the camera2 API, there is no reasonable way for this API to guarantee that the result returned is completely reliable.

With those downsides, the usage of the `*Legacy` classes is restricted to devices that do not support `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.CameraDeviceSetup.html`. On devices that do not support `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.CameraDeviceSetup.html`, it is strongly recommended that this class is used if and only if calling `https://developer.android.com/reference/android/hardware/camera2/CameraManager.html#openCamera(java.lang.String, android.hardware.camera2.CameraDevice.StateCallback, android.os.Handler)` is not possible before the query.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/featurecombinationquery/CameraDeviceSetupCompat#isSessionConfigurationSupportedLegacy(androidx.camera.featurecombinationquery.SessionConfigurationLegacy)` |   |

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/camera/featurecombinationquery/SessionParametersLegacy.Builder` Simple builder class to build a `https://developer.android.com/reference/kotlin/androidx/camera/featurecombinationquery/SessionParametersLegacy` object. |

| ### Public functions |
|---|---|
| `T?` | `<T> https://developer.android.com/reference/kotlin/androidx/camera/featurecombinationquery/SessionParametersLegacy#get(android.hardware.camera2.CaptureRequest.Key<T>)(key: https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html<T!>)` Return the capture request field value associated with `key`. |
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html<*>!>` | `https://developer.android.com/reference/kotlin/androidx/camera/featurecombinationquery/SessionParametersLegacy#getKeys()()` Returns a `https://developer.android.com/reference/java/util/Set.html` of the keys contained in this map. |

## Public functions

### get

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

```
fun <T> get(key: CaptureRequest.Key<T!>): T?
```

Return the capture request field value associated with `key`.

The field definitions can be found in `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html`.

| Parameters |
|---|---|
| `key: https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html<T!>` | The key whose value should be returned |

| Returns |
|---|---|
| `T?` | The value of the passed `key`, or `null` if the `key` is not set |

### getKeys

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

```
fun getKeys(): (Mutable)Set<CaptureRequest.Key<*>!>
```

Returns a `https://developer.android.com/reference/java/util/Set.html` of the keys contained in this map.

The returned set is not modifiable, so any attempts to modify it will throw an `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html`.

All values retrieved by a key from this set with `https://developer.android.com/reference/kotlin/androidx/camera/featurecombinationquery/SessionParametersLegacy#get(android.hardware.camera2.CaptureRequest.Key<T>)` are guaranteed to be non-null.

| Returns |
|---|---|
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html<*>!>` | set of all keys in the map |