Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/app/AutomaticZenRule#nestedclasses) \| [Constants](https://developer.android.com/reference/android/app/AutomaticZenRule#constants) \| [Inherited Constants](https://developer.android.com/reference/android/app/AutomaticZenRule#inhconstants) \| [Fields](https://developer.android.com/reference/android/app/AutomaticZenRule#lfields) \| [Ctors](https://developer.android.com/reference/android/app/AutomaticZenRule#pubctors) \| [Methods](https://developer.android.com/reference/android/app/AutomaticZenRule#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/app/AutomaticZenRule#inhmethods)

# AutomaticZenRule

*** ** * ** ***

` public final class AutomaticZenRule `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/android/os/Parcelable `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.app.AutomaticZenRule |

<br />

*** ** * ** ***

Rule instance information for a zen (aka DND or Attention Management) mode.

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/app/AutomaticZenRule.Builder` |

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/app/AutomaticZenRule#TYPE_BEDTIME` The type for rules triggered by bedtime/sleeping, like time of day, or snore detection. |
| `int` | `https://developer.android.com/reference/android/app/AutomaticZenRule#TYPE_DRIVING` The type for rules triggered by driving detection, like Bluetooth connections or vehicle sounds. |
| `int` | `https://developer.android.com/reference/android/app/AutomaticZenRule#TYPE_IMMERSIVE` The type for rules triggered by the user entering an immersive activity, like opening an app using `https://developer.android.com/reference/android/view/WindowInsetsController#hide(int)`. |
| `int` | `https://developer.android.com/reference/android/app/AutomaticZenRule#TYPE_MANAGED` The type for rules created and managed by a device owner. |
| `int` | `https://developer.android.com/reference/android/app/AutomaticZenRule#TYPE_OTHER` Rule is of a known type, but not one of the specific types. |
| `int` | `https://developer.android.com/reference/android/app/AutomaticZenRule#TYPE_SCHEDULE_CALENDAR` The type for rules triggered by calendar events. |
| `int` | `https://developer.android.com/reference/android/app/AutomaticZenRule#TYPE_SCHEDULE_TIME` The type for rules triggered according to a time-based schedule. |
| `int` | `https://developer.android.com/reference/android/app/AutomaticZenRule#TYPE_THEATER` The type for rules that have a `https://developer.android.com/reference/android/service/notification/ZenPolicy` that implies that the device should not make sound and potentially hide some visual effects; may be triggered when entering a location where silence is requested, like a theater. |
| `int` | `https://developer.android.com/reference/android/app/AutomaticZenRule#TYPE_TRANSIT` The type for rules triggered during the user's transiting, in public transportation such as trains and subways, etc. |
| `int` | `https://developer.android.com/reference/android/app/AutomaticZenRule#TYPE_UNKNOWN` Rule is of an unknown type. |

### Inherited constants

From interface `https://developer.android.com/reference/android/os/Parcelable` `int` `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR`

Descriptor bit used with `https://developer.android.com/reference/android/os/Parcelable#describeContents()`: indicates that the Parcelable object's flattened representation includes a file descriptor.
`int` `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`

Flag for use with `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`: the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`".

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/os/Parcelable.Creator<https://developer.android.com/reference/android/app/AutomaticZenRule>` | `https://developer.android.com/reference/android/app/AutomaticZenRule#CREATOR` <br /> |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/app/AutomaticZenRule#AutomaticZenRule(android.os.Parcel)(https://developer.android.com/reference/android/os/Parcel source) ` |
| ` https://developer.android.com/reference/android/app/AutomaticZenRule#AutomaticZenRule(java.lang.String,%20android.content.ComponentName,%20android.content.ComponentName,%20android.net.Uri,%20android.service.notification.ZenPolicy,%20int,%20boolean)(https://developer.android.com/reference/java/lang/String name, https://developer.android.com/reference/android/content/ComponentName owner, https://developer.android.com/reference/android/content/ComponentName configurationActivity, https://developer.android.com/reference/android/net/Uri conditionId, https://developer.android.com/reference/android/service/notification/ZenPolicy policy, int interruptionFilter, boolean enabled) ` Creates an automatic zen rule. |
| ` https://developer.android.com/reference/android/app/AutomaticZenRule#AutomaticZenRule(java.lang.String,%20android.content.ComponentName,%20android.net.Uri,%20int,%20boolean)(https://developer.android.com/reference/java/lang/String name, https://developer.android.com/reference/android/content/ComponentName owner, https://developer.android.com/reference/android/net/Uri conditionId, int interruptionFilter, boolean enabled) ` *This constructor is deprecated. Use `https://developer.android.com/reference/android/app/AutomaticZenRule.Builder` to construct an `https://developer.android.com/reference/android/app/AutomaticZenRule`.* |

| ### Public methods ||
|---|---|
| ` int` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| ` boolean` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Indicates whether some other object is "equal to" this one. |
| ` https://developer.android.com/reference/android/net/Uri` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#getConditionId()() ` Returns the representation of the state that causes this rule to become active. |
| ` https://developer.android.com/reference/android/content/ComponentName` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#getConfigurationActivity()() ` Returns the `https://developer.android.com/reference/android/content/ComponentName` of the activity that shows configuration options for this rule. |
| ` long` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#getCreationTime()() ` Returns the time this rule was created, represented as milliseconds since the epoch. |
| ` https://developer.android.com/reference/android/service/notification/ZenDeviceEffects` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#getDeviceEffects()() ` Gets the `https://developer.android.com/reference/android/service/notification/ZenDeviceEffects` of this rule. |
| ` int` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#getIconResId()() ` Gets the resource id of the drawable icon for this rule. |
| ` int` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#getInterruptionFilter()() ` Returns the interruption filter that is applied when this rule is active. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#getName()() ` Returns the name of this rule. |
| ` https://developer.android.com/reference/android/content/ComponentName` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#getOwner()() ` Returns the `https://developer.android.com/reference/android/content/ComponentName` of the condition provider service that owns this rule. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#getTriggerDescription()() ` Gets the user visible description of when this rule is active (see `https://developer.android.com/reference/android/service/notification/Condition#STATE_TRUE`). |
| ` int` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#getType()() ` Gets the type of the rule. |
| ` https://developer.android.com/reference/android/service/notification/ZenPolicy` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#getZenPolicy()() ` Gets the `https://developer.android.com/reference/android/service/notification/ZenPolicy` applied if `https://developer.android.com/reference/android/app/AutomaticZenRule#getInterruptionFilter()` is `https://developer.android.com/reference/android/app/NotificationManager#INTERRUPTION_FILTER_PRIORITY`. |
| ` int` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#hashCode()() ` Returns a hash code value for the object. |
| ` boolean` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#isEnabled()() ` Returns whether this rule is enabled. |
| ` boolean` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#isManualInvocationAllowed()() ` Gets whether this rule can be manually activated by the user even when the triggering condition for the rule is not met. |
| ` void` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#setConditionId(android.net.Uri)(https://developer.android.com/reference/android/net/Uri conditionId) ` Sets the representation of the state that causes this rule to become active. |
| ` void` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#setConfigurationActivity(android.content.ComponentName)(https://developer.android.com/reference/android/content/ComponentName componentName) ` Sets the configuration activity - an activity that handles `https://developer.android.com/reference/android/app/NotificationManager#ACTION_AUTOMATIC_ZEN_RULE` and shows more information about this rule and/or allows the user to configure it. |
| ` void` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#setDeviceEffects(android.service.notification.ZenDeviceEffects)(https://developer.android.com/reference/android/service/notification/ZenDeviceEffects deviceEffects) ` Sets the `https://developer.android.com/reference/android/service/notification/ZenDeviceEffects` associated to this rule. |
| ` void` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#setEnabled(boolean)(boolean enabled) ` Enables this rule. |
| ` void` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#setInterruptionFilter(int)(int interruptionFilter) ` Sets the interruption filter that is applied when this rule is active. |
| ` void` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#setName(java.lang.String)(https://developer.android.com/reference/java/lang/String name) ` Sets the name of this rule. |
| ` void` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#setZenPolicy(android.service.notification.ZenPolicy)(https://developer.android.com/reference/android/service/notification/ZenPolicy zenPolicy) ` Sets the `https://developer.android.com/reference/android/service/notification/ZenPolicy` applied if `https://developer.android.com/reference/android/app/AutomaticZenRule#getInterruptionFilter()` is `https://developer.android.com/reference/android/app/NotificationManager#INTERRUPTION_FILTER_PRIORITY`. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#toString()() ` Returns a string representation of the object. |
| ` void` | ` https://developer.android.com/reference/android/app/AutomaticZenRule#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) ` Flatten this object in to a Parcel. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.
From interface ` https://developer.android.com/reference/android/os/Parcelable ` ` abstract int` ` https://developer.android.com/reference/android/os/Parcelable#describeContents()() `

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.
` abstract void` ` https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) `

Flatten this object in to a Parcel.

## Constants

### TYPE_BEDTIME

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

```
public static final int TYPE_BEDTIME
```

The type for rules triggered by bedtime/sleeping, like time of day, or snore detection.

Only the 'Wellbeing' app may own rules of this type.

<br />

Constant Value: 3 (0x00000003)

### TYPE_DRIVING

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

```
public static final int TYPE_DRIVING
```

The type for rules triggered by driving detection, like Bluetooth connections or vehicle sounds.

<br />

Constant Value: 4 (0x00000004)

### TYPE_IMMERSIVE

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

```
public static final int TYPE_IMMERSIVE
```

The type for rules triggered by the user entering an immersive activity, like opening an app using `https://developer.android.com/reference/android/view/WindowInsetsController#hide(int)`.

<br />

Constant Value: 5 (0x00000005)

### TYPE_MANAGED

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

```
public static final int TYPE_MANAGED
```

The type for rules created and managed by a device owner. These rules may not be fully editable by the device user.

Only a 'Device Owner' app may own rules of this type.

<br />

Constant Value: 7 (0x00000007)

### TYPE_OTHER

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

```
public static final int TYPE_OTHER
```

Rule is of a known type, but not one of the specific types.

<br />

Constant Value: 0 (0x00000000)

### TYPE_SCHEDULE_CALENDAR

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

```
public static final int TYPE_SCHEDULE_CALENDAR
```

The type for rules triggered by calendar events.

<br />

Constant Value: 2 (0x00000002)

### TYPE_SCHEDULE_TIME

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

```
public static final int TYPE_SCHEDULE_TIME
```

The type for rules triggered according to a time-based schedule.

<br />

Constant Value: 1 (0x00000001)

### TYPE_THEATER

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

```
public static final int TYPE_THEATER
```

The type for rules that have a `https://developer.android.com/reference/android/service/notification/ZenPolicy` that implies that the device should not make sound and potentially hide some visual effects; may be triggered when entering a location where silence is requested, like a theater.

<br />

Constant Value: 6 (0x00000006)

### TYPE_TRANSIT

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

```
public static final int TYPE_TRANSIT
```

The type for rules triggered during the user's transiting, in public transportation such as trains and subways, etc.

<br />

Constant Value: 8 (0x00000008)

### TYPE_UNKNOWN

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

```
public static final int TYPE_UNKNOWN
```

Rule is of an unknown type. This is the default value if not provided by the owning app, and the value returned if the true type was added in an API level higher than the calling app's targetSdk.

<br />

Constant Value: -1 (0xffffffff)

## Fields

### CREATOR

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

```
public static final Creator<AutomaticZenRule> CREATOR
```

<br />

<br />

## Public constructors

### AutomaticZenRule

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

```
public AutomaticZenRule (Parcel source)
```

<br />

<br />

| Parameters ||
|---|---|
| `source` | `Parcel` <br /> |

### AutomaticZenRule

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

```
public AutomaticZenRule (String name, 
                ComponentName owner, 
                ComponentName configurationActivity, 
                Uri conditionId, 
                ZenPolicy policy, 
                int interruptionFilter, 
                boolean enabled)
```

Creates an automatic zen rule.

Note: Prefer `https://developer.android.com/reference/android/app/AutomaticZenRule.Builder` to construct an `https://developer.android.com/reference/android/app/AutomaticZenRule`.

<br />

| Parameters ||
|---|---|
| `name` | `String`: The name of the rule. This value cannot be `null`. <br /> |
| `owner` | `ComponentName`: The Condition Provider service that owns this rule. This can be null if you're using `https://developer.android.com/reference/android/app/NotificationManager#setAutomaticZenRuleState(java.lang.String,%20android.service.notification.Condition)` instead of `https://developer.android.com/reference/android/service/notification/ConditionProviderService`. <br /> |
| `configurationActivity` | `ComponentName`: An activity that handles `https://developer.android.com/reference/android/app/NotificationManager#ACTION_AUTOMATIC_ZEN_RULE` that shows the user more information about this rule and/or allows them to configure it. This is required if you are not using a `https://developer.android.com/reference/android/service/notification/ConditionProviderService`. If you are, it overrides the information specified in your manifest. This value may be `null`. <br /> |
| `conditionId` | `Uri`: A representation of the state that should cause your app to apply the given interruption filter. This value cannot be `null`. <br /> |
| `policy` | `ZenPolicy`: The policy defines which notifications are allowed to interrupt the user while this rule is active. This overrides the global policy while this rule is action (`https://developer.android.com/reference/android/service/notification/Condition#STATE_TRUE`). This value may be `null`. <br /> |
| `interruptionFilter` | `int`: The interruption filter defines which notifications are allowed to interrupt the user (e.g. via sound \& vibration) while this rule is active. <br /> |
| `enabled` | `boolean`: Whether the rule is enabled. <br /> |

### AutomaticZenRule

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

```
public AutomaticZenRule (String name, 
                ComponentName owner, 
                Uri conditionId, 
                int interruptionFilter, 
                boolean enabled)
```

<br />

**This constructor is deprecated.**   

Use `https://developer.android.com/reference/android/app/AutomaticZenRule.Builder` to construct an `https://developer.android.com/reference/android/app/AutomaticZenRule`.

Creates an automatic zen rule.

<br />

| Parameters ||
|---|---|
| `name` | `String`: The name of the rule. <br /> |
| `owner` | `ComponentName`: The Condition Provider service that owns this rule. <br /> |
| `conditionId` | `Uri` <br /> |
| `interruptionFilter` | `int`: The interruption filter defines which notifications are allowed to interrupt the user (e.g. via sound \& vibration) while this rule is active. <br /> |
| `enabled` | `boolean`: Whether the rule is enabled. <br /> |

## Public methods

### describeContents

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

```
public int describeContents ()
```

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`, the return value of this method must include the `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` bit.

<br />

| Returns ||
|---|---|
| `int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or - `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` |

### equals

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

```
public boolean equals (Object o)
```

Indicates whether some other object is "equal to" this one.

The `equals` method implements an equivalence relation on non-null object references:

- It is *reflexive*: for any non-null reference value `x`, `x.equals(x)` should return `true`.
- It is *symmetric*: for any non-null reference values `x` and `y`, `x.equals(y)` should return `true` if and only if `y.equals(x)` returns `true`.
- It is *transitive*: for any non-null reference values `x`, `y`, and `z`, if `x.equals(y)` returns `true` and `y.equals(z)` returns `true`, then `x.equals(z)` should return `true`.
- It is *consistent*: for any non-null reference values `x` and `y`, multiple invocations of `x.equals(y)` consistently return `true` or consistently return `false`, provided no information used in `equals` comparisons on the objects is modified.
- For any non-null reference value `x`, `x.equals(null)` should return `false`.

An equivalence relation partitions the elements it operates on into *equivalence classes*; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

<br />

| Parameters ||
|---|---|
| `o` | `Object`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if this object is the same as the obj argument; `false` otherwise. <br /> |

### getConditionId

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

```
public Uri getConditionId ()
```

Returns the representation of the state that causes this rule to become active.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/Uri` | <br /> |

### getConfigurationActivity

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

```
public ComponentName getConfigurationActivity ()
```

Returns the `https://developer.android.com/reference/android/content/ComponentName` of the activity that shows configuration options for this rule.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/ComponentName` | This value may be `null`. <br /> |

### getCreationTime

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

```
public long getCreationTime ()
```

Returns the time this rule was created, represented as milliseconds since the epoch.

<br />

| Returns ||
|---|---|
| `long` | <br /> |

### getDeviceEffects

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

```
public ZenDeviceEffects getDeviceEffects ()
```

Gets the `https://developer.android.com/reference/android/service/notification/ZenDeviceEffects` of this rule.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/service/notification/ZenDeviceEffects` | This value may be `null`. <br /> |

### getIconResId

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

```
public int getIconResId ()
```

Gets the resource id of the drawable icon for this rule.

<br />

| Returns ||
|---|---|
| `int` | <br /> |

### getInterruptionFilter

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

```
public int getInterruptionFilter ()
```

Returns the interruption filter that is applied when this rule is active.

<br />

| Returns ||
|---|---|
| `int` | <br /> |

### getName

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

```
public String getName ()
```

Returns the name of this rule.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | <br /> |

### getOwner

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

```
public ComponentName getOwner ()
```

Returns the `https://developer.android.com/reference/android/content/ComponentName` of the condition provider service that owns this rule.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/ComponentName` | <br /> |

### getTriggerDescription

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

```
public String getTriggerDescription ()
```

Gets the user visible description of when this rule is active (see `https://developer.android.com/reference/android/service/notification/Condition#STATE_TRUE`).

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | This value may be `null`. <br /> |

### getType

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

```
public int getType ()
```

Gets the type of the rule.

<br />

| Returns ||
|---|---|
| `int` | Value is one of the following: - `https://developer.android.com/reference/android/app/AutomaticZenRule#TYPE_UNKNOWN` - `https://developer.android.com/reference/android/app/AutomaticZenRule#TYPE_OTHER` - `https://developer.android.com/reference/android/app/AutomaticZenRule#TYPE_SCHEDULE_TIME` - `https://developer.android.com/reference/android/app/AutomaticZenRule#TYPE_SCHEDULE_CALENDAR` - `https://developer.android.com/reference/android/app/AutomaticZenRule#TYPE_BEDTIME` - `https://developer.android.com/reference/android/app/AutomaticZenRule#TYPE_DRIVING` - `https://developer.android.com/reference/android/app/AutomaticZenRule#TYPE_IMMERSIVE` - `https://developer.android.com/reference/android/app/AutomaticZenRule#TYPE_THEATER` - `https://developer.android.com/reference/android/app/AutomaticZenRule#TYPE_MANAGED` - `https://developer.android.com/reference/android/app/AutomaticZenRule#TYPE_TRANSIT` |

### getZenPolicy

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

```
public ZenPolicy getZenPolicy ()
```

Gets the `https://developer.android.com/reference/android/service/notification/ZenPolicy` applied if `https://developer.android.com/reference/android/app/AutomaticZenRule#getInterruptionFilter()` is `https://developer.android.com/reference/android/app/NotificationManager#INTERRUPTION_FILTER_PRIORITY`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/service/notification/ZenPolicy` | This value may be `null`. <br /> |

### hashCode

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

```
public int hashCode ()
```

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by `https://developer.android.com/reference/java/util/HashMap`.

The general contract of `hashCode` is:

- Whenever it is invoked on the same object more than once during an execution of a Java application, the `hashCode` method must consistently return the same integer, provided no information used in `equals` comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
- If two objects are equal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce the same integer result.
- It is *not* required that if two objects are unequal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

<br />

<br />

| Returns ||
|---|---|
| `int` | a hash code value for this object. <br /> |

### isEnabled

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

```
public boolean isEnabled ()
```

Returns whether this rule is enabled.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### isManualInvocationAllowed

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

```
public boolean isManualInvocationAllowed ()
```

Gets whether this rule can be manually activated by the user even when the triggering condition for the rule is not met.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### setConditionId

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

```
public void setConditionId (Uri conditionId)
```

Sets the representation of the state that causes this rule to become active.

<br />

| Parameters ||
|---|---|
| `conditionId` | `Uri` <br /> |

### setConfigurationActivity

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

```
public void setConfigurationActivity (ComponentName componentName)
```

Sets the configuration activity - an activity that handles `https://developer.android.com/reference/android/app/NotificationManager#ACTION_AUTOMATIC_ZEN_RULE` and shows more information about this rule and/or allows the user to configure it.

Although both are optional, *at least one* of `https://developer.android.com/reference/android/app/AutomaticZenRule#getOwner()` or `https://developer.android.com/reference/android/app/AutomaticZenRule#getConfigurationActivity()` must be provided. If both are set, `https://developer.android.com/reference/android/app/AutomaticZenRule#getConfigurationActivity()` supersedes `https://developer.android.com/reference/android/app/AutomaticZenRule#getOwner()`, and the owner will not be used to determine whether the rule should be active.

The system will validate that the provider `https://developer.android.com/reference/android/content/ComponentName` points to a valid and enabled Activity when calling `https://developer.android.com/reference/android/app/NotificationManager#addAutomaticZenRule(android.app.AutomaticZenRule)` or `https://developer.android.com/reference/android/app/NotificationManager#updateAutomaticZenRule(java.lang.String,%20android.app.AutomaticZenRule)`.

<br />

| Parameters ||
|---|---|
| `componentName` | `ComponentName`: This value may be `null`. <br /> |

### setDeviceEffects

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

```
public void setDeviceEffects (ZenDeviceEffects deviceEffects)
```

Sets the `https://developer.android.com/reference/android/service/notification/ZenDeviceEffects` associated to this rule. Device effects specify changes to the device behavior that should apply while the rule is active, but are not directly related to suppressing notifications (for example: disabling always-on display).

When updating an existing rule via `https://developer.android.com/reference/android/app/NotificationManager#updateAutomaticZenRule(java.lang.String,%20android.app.AutomaticZenRule)`, a `null` value here means the previous set of effects is retained.

<br />

| Parameters ||
|---|---|
| `deviceEffects` | `ZenDeviceEffects`: This value may be `null`. <br /> |

### setEnabled

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

```
public void setEnabled (boolean enabled)
```

Enables this rule.

<br />

| Parameters ||
|---|---|
| `enabled` | `boolean` <br /> |

### setInterruptionFilter

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

```
public void setInterruptionFilter (int interruptionFilter)
```

Sets the interruption filter that is applied when this rule is active.

- When `https://developer.android.com/reference/android/app/NotificationManager#INTERRUPTION_FILTER_PRIORITY`, the rule will use the `https://developer.android.com/reference/android/service/notification/ZenPolicy` supplied to `https://developer.android.com/reference/android/app/AutomaticZenRule#setZenPolicy(android.service.notification.ZenPolicy)` (or a default one).
- When `https://developer.android.com/reference/android/app/NotificationManager#INTERRUPTION_FILTER_ALARMS` or `https://developer.android.com/reference/android/app/NotificationManager#INTERRUPTION_FILTER_NONE`, the rule will use a fixed `https://developer.android.com/reference/android/service/notification/ZenPolicy` matching the filter.
- When `https://developer.android.com/reference/android/app/NotificationManager#INTERRUPTION_FILTER_ALL`, the rule will not block notifications, but can still have `https://developer.android.com/reference/android/service/notification/ZenDeviceEffects`.

<br />

<br />

| Parameters ||
|---|---|
| `interruptionFilter` | `int`: The do not disturb mode to enter when this rule is active. Value is one of the following: - `https://developer.android.com/reference/android/app/NotificationManager#INTERRUPTION_FILTER_NONE` - `https://developer.android.com/reference/android/app/NotificationManager#INTERRUPTION_FILTER_PRIORITY` - `https://developer.android.com/reference/android/app/NotificationManager#INTERRUPTION_FILTER_ALARMS` - `https://developer.android.com/reference/android/app/NotificationManager#INTERRUPTION_FILTER_ALL` - `https://developer.android.com/reference/android/app/NotificationManager#INTERRUPTION_FILTER_UNKNOWN` |

### setName

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

```
public void setName (String name)
```

Sets the name of this rule.

<br />

| Parameters ||
|---|---|
| `name` | `String` <br /> |

### setZenPolicy

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

```
public void setZenPolicy (ZenPolicy zenPolicy)
```

Sets the `https://developer.android.com/reference/android/service/notification/ZenPolicy` applied if `https://developer.android.com/reference/android/app/AutomaticZenRule#getInterruptionFilter()` is `https://developer.android.com/reference/android/app/NotificationManager#INTERRUPTION_FILTER_PRIORITY`.

When updating an existing rule via `https://developer.android.com/reference/android/app/NotificationManager#updateAutomaticZenRule(java.lang.String,%20android.app.AutomaticZenRule)`, a `null` value here means the previous policy is retained.

<br />

| Parameters ||
|---|---|
| `zenPolicy` | `ZenPolicy`: This value may be `null`. <br /> |

### toString

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

```
public String toString ()
```

Returns a string representation of the object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a string representation of the object. <br /> |

### writeToParcel

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

```
public void writeToParcel (Parcel dest, 
                int flags)
```

Flatten this object in to a Parcel.

<br />

| Parameters ||
|---|---|
| `dest` | `Parcel`: The Parcel in which the object should be written. This value cannot be `null`. <br /> |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` |