# GpuHeadroomParams.Builder

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

# Builder

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/os/GpuHeadroomParams.Builder "View this page in Java")  

```
class Builder
```

|---|------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                               ||
| ↳ | [android.os.GpuHeadroomParams.Builder](https://developer.android.com/reference/kotlin/android/os/GpuHeadroomParams.Builder#) |

## Summary

|                                                                                                                                                Public constructors                                                                                                                                                 ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/os/GpuHeadroomParams.Builder#Builder())`()` <br />                                                                                                                                                                                             |
| [Builder](https://developer.android.com/reference/kotlin/android/os/GpuHeadroomParams.Builder#Builder(android.os.GpuHeadroomParams))`(`params:` `[GpuHeadroomParams](https://developer.android.com/reference/kotlin/android/os/GpuHeadroomParams)`)` Returns a new builder with the same values as this object. |

|                                                                                                                                                                                                             Public methods                                                                                                                                                                                                             ||
|-------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [GpuHeadroomParams](https://developer.android.com/reference/kotlin/android/os/GpuHeadroomParams)                  | [build](https://developer.android.com/reference/kotlin/android/os/GpuHeadroomParams.Builder#build())`()` Builds the[GpuHeadroomParams](https://developer.android.com/reference/kotlin/android/os/GpuHeadroomParams)object.                                                                                          |
| [GpuHeadroomParams.Builder](https://developer.android.com/reference/kotlin/android/os/GpuHeadroomParams.Builder#) | [setCalculationType](https://developer.android.com/reference/kotlin/android/os/GpuHeadroomParams.Builder#setCalculationType(kotlin.Int))`(`calculationType:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the headroom calculation type.                                     |
| [GpuHeadroomParams.Builder](https://developer.android.com/reference/kotlin/android/os/GpuHeadroomParams.Builder#) | [setCalculationWindowMillis](https://developer.android.com/reference/kotlin/android/os/GpuHeadroomParams.Builder#setCalculationWindowMillis(kotlin.Int))`(`windowMillis:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the headroom calculation window size in milliseconds. |

## Public constructors

### Builder

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

```
Builder()
```  

### Builder

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

```
Builder(params: GpuHeadroomParams)
```

Returns a new builder with the same values as this object.

|                                                               Parameters                                                               ||
|----------|------------------------------------------------------------------------------------------------------------------------------|
| `params` | [GpuHeadroomParams](https://developer.android.com/reference/kotlin/android/os/GpuHeadroomParams):This value cannot be`null`. |

## Public methods

### build

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

```
fun build(): GpuHeadroomParams
```

Builds the[GpuHeadroomParams](https://developer.android.com/reference/kotlin/android/os/GpuHeadroomParams)object.

|                                                            Return                                                             ||
|--------------------------------------------------------------------------------------------------|-----------------------------|
| [GpuHeadroomParams](https://developer.android.com/reference/kotlin/android/os/GpuHeadroomParams) | This value cannot be`null`. |

### setCalculationType

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

```
fun setCalculationType(calculationType: Int): GpuHeadroomParams.Builder
```

Sets the headroom calculation type.

<br />

|                                                                                                                                                                                                                                               Parameters                                                                                                                                                                                                                                               ||
|-------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `calculationType` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Value is[android.os.GpuHeadroomParams#GPU_HEADROOM_CALCULATION_TYPE_MIN](https://developer.android.com/reference/kotlin/android/os/GpuHeadroomParams#GPU_HEADROOM_CALCULATION_TYPE_MIN:kotlin.Int), or[android.os.GpuHeadroomParams#GPU_HEADROOM_CALCULATION_TYPE_AVERAGE](https://developer.android.com/reference/kotlin/android/os/GpuHeadroomParams#GPU_HEADROOM_CALCULATION_TYPE_AVERAGE:kotlin.Int) |

|                                                                     Return                                                                     ||
|-------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [GpuHeadroomParams.Builder](https://developer.android.com/reference/kotlin/android/os/GpuHeadroomParams.Builder#) | This value cannot be`null`. |

|                          Exceptions                           ||
|--------------------------------------|-------------------------|
| `java.lang.IllegalArgumentException` | if the type is invalid. |

### setCalculationWindowMillis

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

```
fun setCalculationWindowMillis(windowMillis: Int): GpuHeadroomParams.Builder
```

Sets the headroom calculation window size in milliseconds.

<br />

|                                                                                                                                                                                                                                                                                                                                                              Parameters                                                                                                                                                                                                                                                                                                                                                              ||
|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `windowMillis` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the window size in milliseconds ranges from[SystemHealthManager.getGpuHeadroomCalculationWindowRange()](https://developer.android.com/reference/kotlin/android/os/health/SystemHealthManager#getGpuHeadroomCalculationWindowRange()). The smaller the window size, the larger fluctuation in the headroom value should be expected. The default value can be retrieved from the[GpuHeadroomParams.getCalculationWindowMillis](https://developer.android.com/reference/kotlin/android/os/GpuHeadroomParams#getCalculationWindowMillis()). The device will try to use the closest feasible window size to this param. Value is 1 or greater |

|                                                                     Return                                                                     ||
|-------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [GpuHeadroomParams.Builder](https://developer.android.com/reference/kotlin/android/os/GpuHeadroomParams.Builder#) | This value cannot be`null`. |

|                           Exceptions                            ||
|--------------------------------------|---------------------------|
| `java.lang.IllegalArgumentException` | if the window is invalid. |