# ZenDeviceEffects.Builder

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

# Builder

*** ** * ** ***

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

```
class Builder
```

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

Builder class for[ZenDeviceEffects](https://developer.android.com/reference/kotlin/android/service/notification/ZenDeviceEffects)objects.

## Summary

|                                                                                                                                                                                                                                                                                                             Public constructors                                                                                                                                                                                                                                                                                                             ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenDeviceEffects.Builder#Builder())`()` Instantiates a new[ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder)with all effects set to default (disabled).                                                                                                                                                                                                                                                                                                                            |
| [Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenDeviceEffects.Builder#Builder(android.service.notification.ZenDeviceEffects))`(`zenDeviceEffects:` `[ZenDeviceEffects](https://developer.android.com/reference/kotlin/android/service/notification/ZenDeviceEffects)`)` Instantiates a new[ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder)with all effects set to their corresponding values in the supplied[ZenDeviceEffects](https://developer.android.com/reference/kotlin/android/service/notification/ZenDeviceEffects). |

|                                                                                                                                                                                                                                                                              Public methods                                                                                                                                                                                                                                                                              ||
|-----------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ZenDeviceEffects](https://developer.android.com/reference/kotlin/android/service/notification/ZenDeviceEffects)                  | [build](https://developer.android.com/reference/kotlin/android/service/notification/ZenDeviceEffects.Builder#build())`()` Builds a[ZenDeviceEffects](https://developer.android.com/reference/kotlin/android/service/notification/ZenDeviceEffects)object based on the builder's state.                                                                                                                                                |
| [ZenDeviceEffects.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenDeviceEffects.Builder#) | [setShouldDimWallpaper](https://developer.android.com/reference/kotlin/android/service/notification/ZenDeviceEffects.Builder#setShouldDimWallpaper(kotlin.Boolean))`(`dimWallpaper:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Sets whether the wallpaper should be dimmed while the rule is active.                                                                                     |
| [ZenDeviceEffects.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenDeviceEffects.Builder#) | [setShouldDisplayGrayscale](https://developer.android.com/reference/kotlin/android/service/notification/ZenDeviceEffects.Builder#setShouldDisplayGrayscale(kotlin.Boolean))`(`grayscale:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Sets whether the level of color saturation of the display should be set to minimum, effectively switching it to grayscale, while the rule is active. |
| [ZenDeviceEffects.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenDeviceEffects.Builder#) | [setShouldSuppressAmbientDisplay](https://developer.android.com/reference/kotlin/android/service/notification/ZenDeviceEffects.Builder#setShouldSuppressAmbientDisplay(kotlin.Boolean))`(`suppressAmbientDisplay:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Sets whether the ambient (always-on) display feature should be disabled while the rule is active.                           |
| [ZenDeviceEffects.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenDeviceEffects.Builder#) | [setShouldUseNightMode](https://developer.android.com/reference/kotlin/android/service/notification/ZenDeviceEffects.Builder#setShouldUseNightMode(kotlin.Boolean))`(`nightMode:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Sets whether night mode (aka dark theme) should be applied while the rule is active.                                                                         |

## Public constructors

### Builder

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

```
Builder()
```

Instantiates a new[ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder)with all effects set to default (disabled).  

### Builder

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

```
Builder(zenDeviceEffects: ZenDeviceEffects)
```

Instantiates a new[ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder)with all effects set to their corresponding values in the supplied[ZenDeviceEffects](https://developer.android.com/reference/kotlin/android/service/notification/ZenDeviceEffects).

|                                                                            Parameters                                                                            ||
|--------------------|----------------------------------------------------------------------------------------------------------------------------------------------|
| `zenDeviceEffects` | [ZenDeviceEffects](https://developer.android.com/reference/kotlin/android/service/notification/ZenDeviceEffects):This value cannot be`null`. |

## Public methods

### build

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

```
fun build(): ZenDeviceEffects
```

Builds a[ZenDeviceEffects](https://developer.android.com/reference/kotlin/android/service/notification/ZenDeviceEffects)object based on the builder's state.

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

### setShouldDimWallpaper

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

```
fun setShouldDimWallpaper(dimWallpaper: Boolean): ZenDeviceEffects.Builder
```

Sets whether the wallpaper should be dimmed while the rule is active.

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

### setShouldDisplayGrayscale

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

```
fun setShouldDisplayGrayscale(grayscale: Boolean): ZenDeviceEffects.Builder
```

Sets whether the level of color saturation of the display should be set to minimum, effectively switching it to grayscale, while the rule is active.

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

### setShouldSuppressAmbientDisplay

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

```
fun setShouldSuppressAmbientDisplay(suppressAmbientDisplay: Boolean): ZenDeviceEffects.Builder
```

Sets whether the ambient (always-on) display feature should be disabled while the rule is active. This will have no effect if the device doesn't support always-on display or if it's not generally enabled.

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

### setShouldUseNightMode

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

```
fun setShouldUseNightMode(nightMode: Boolean): ZenDeviceEffects.Builder
```

Sets whether night mode (aka dark theme) should be applied while the rule is active.

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