Stay organized with collections
Save and categorize content based on your preferences.
Builder
class Builder
Builder class for ZenDeviceEffects
objects.
Summary
Public constructors
Builder
Builder()
Instantiates a new ZenPolicy.Builder
with all effects set to default (disabled).
Public methods
setShouldDimWallpaper
fun setShouldDimWallpaper(dimWallpaper: Boolean): ZenDeviceEffects.Builder
Sets whether the wallpaper should be dimmed while the rule is active.
setShouldDisplayGrayscale
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.
setShouldSuppressAmbientDisplay
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.
setShouldUseNightMode
fun setShouldUseNightMode(nightMode: Boolean): ZenDeviceEffects.Builder
Sets whether night mode (aka dark theme) should be applied while the rule is active.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# ZenDeviceEffects.Builder\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nBuilder\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/service/notification/ZenDeviceEffects.Builder \"View this page in Java\") \n\n```\nclass Builder\n```\n\n|---|------------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.service.notification.ZenDeviceEffects.Builder](#) |\n\nBuilder class for [ZenDeviceEffects](/reference/kotlin/android/service/notification/ZenDeviceEffects) objects.\n\nSummary\n-------\n\n| Public constructors ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [Builder](#Builder())`()` Instantiates a new [ZenPolicy.Builder](/reference/kotlin/android/service/notification/ZenPolicy.Builder) with all effects set to default (disabled). |\n| [Builder](#Builder(android.service.notification.ZenDeviceEffects))`(`zenDeviceEffects:` `[ZenDeviceEffects](/reference/kotlin/android/service/notification/ZenDeviceEffects)`)` Instantiates a new [ZenPolicy.Builder](/reference/kotlin/android/service/notification/ZenPolicy.Builder) with all effects set to their corresponding values in the supplied [ZenDeviceEffects](/reference/kotlin/android/service/notification/ZenDeviceEffects). |\n\n| Public methods ||\n|-------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [ZenDeviceEffects](/reference/kotlin/android/service/notification/ZenDeviceEffects) | [build](#build())`()` Builds a [ZenDeviceEffects](/reference/kotlin/android/service/notification/ZenDeviceEffects) object based on the builder's state. |\n| [ZenDeviceEffects.Builder](#) | [setShouldDimWallpaper](#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. |\n| [ZenDeviceEffects.Builder](#) | [setShouldDisplayGrayscale](#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. |\n| [ZenDeviceEffects.Builder](#) | [setShouldSuppressAmbientDisplay](#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. |\n| [ZenDeviceEffects.Builder](#) | [setShouldUseNightMode](#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. |\n\nPublic constructors\n-------------------\n\n### Builder\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nBuilder()\n```\n\nInstantiates a new [ZenPolicy.Builder](/reference/kotlin/android/service/notification/ZenPolicy.Builder) with all effects set to default (disabled). \n\n### Builder\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nBuilder(zenDeviceEffects: ZenDeviceEffects)\n```\n\nInstantiates a new [ZenPolicy.Builder](/reference/kotlin/android/service/notification/ZenPolicy.Builder) with all effects set to their corresponding values in the supplied [ZenDeviceEffects](/reference/kotlin/android/service/notification/ZenDeviceEffects).\n\n| Parameters ||\n|--------------------|-------------------------------------------------------------------------------------------------------------------|\n| `zenDeviceEffects` | [ZenDeviceEffects](/reference/kotlin/android/service/notification/ZenDeviceEffects): This value cannot be `null`. |\n\nPublic methods\n--------------\n\n### build\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun build(): ZenDeviceEffects\n```\n\nBuilds a [ZenDeviceEffects](/reference/kotlin/android/service/notification/ZenDeviceEffects) object based on the builder's state.\n\n| Return ||\n|-------------------------------------------------------------------------------------|------------------------------|\n| [ZenDeviceEffects](/reference/kotlin/android/service/notification/ZenDeviceEffects) | This value cannot be `null`. |\n\n### setShouldDimWallpaper\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setShouldDimWallpaper(dimWallpaper: Boolean): ZenDeviceEffects.Builder\n```\n\nSets whether the wallpaper should be dimmed while the rule is active.\n\n| Return ||\n|-------------------------------|------------------------------|\n| [ZenDeviceEffects.Builder](#) | This value cannot be `null`. |\n\n### setShouldDisplayGrayscale\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setShouldDisplayGrayscale(grayscale: Boolean): ZenDeviceEffects.Builder\n```\n\nSets whether the level of color saturation of the display should be set to minimum, effectively switching it to grayscale, while the rule is active.\n\n| Return ||\n|-------------------------------|------------------------------|\n| [ZenDeviceEffects.Builder](#) | This value cannot be `null`. |\n\n### setShouldSuppressAmbientDisplay\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setShouldSuppressAmbientDisplay(suppressAmbientDisplay: Boolean): ZenDeviceEffects.Builder\n```\n\nSets 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.\n\n| Return ||\n|-------------------------------|------------------------------|\n| [ZenDeviceEffects.Builder](#) | This value cannot be `null`. |\n\n### setShouldUseNightMode\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setShouldUseNightMode(nightMode: Boolean): ZenDeviceEffects.Builder\n```\n\nSets whether night mode (aka dark theme) should be applied while the rule is active.\n\n| Return ||\n|-------------------------------|------------------------------|\n| [ZenDeviceEffects.Builder](#) | This value cannot be `null`. |"]]