ZenPolicy
class ZenPolicy : Parcelable
| kotlin.Any | |
| ↳ | android.service.notification.ZenPolicy |
ZenPolicy determines whether to allow certain notifications and their corresponding sounds to play when a device is in Do Not Disturb mode. ZenPolicy also dictates the visual effects of notifications that are intercepted when a device is in Do Not Disturb mode.
Summary
| Nested classes | |
|---|---|
|
Builder class for |
|
| Constants | |
|---|---|
| static Int |
Used to indicate all conversations can bypass dnd. |
| static Int |
Used to indicate important conversations can bypass dnd. |
| static Int |
Used to indicate no conversations can bypass dnd. |
| static Int |
Used to indicate no preference for the type of conversations that can bypass dnd. |
| static Int |
Used to indicate all calls or messages can bypass dnd. |
| static Int |
Used to indicate calls or messages from contacts can bypass dnd. |
| static Int |
Used to indicate no calls or messages can bypass dnd. |
| static Int |
Used to indicate calls or messages from starred contacts can bypass dnd. |
| static Int |
Used to indicate no preference for the type of people that can bypass dnd for either calls or messages. |
| static Int |
Indicates a type of sound or visual effect is allowed to play/show when DND is active. |
| static Int |
Indicates a type of sound or visual effect is not allowed to play/show when DND is active. |
| static Int |
Indicates no preference for whether a type of sound or visual effect is or isn't allowed to play/show when DND is active. |
| Inherited constants | |
|---|---|
| Public methods | |
|---|---|
| Int | |
| Boolean |
Indicates whether some other object is "equal to" this one. |
| Int |
Callers that can bypass DND. |
| Int |
Whether this policy wants to allow notifications with category |
| Int |
Whether this policy wants to allow notifications with category |
| Int |
Whether this policy wants to allow conversation notifications (see |
| Int |
Whether this policy wants to allow notifications with category |
| Int |
Whether this policy wants to allow media notifications to play sounds and visually appear or to intercept them when DND is active. |
| Int |
Whether this policy wants to allow notifications with category |
| Int |
Whether this policy wants to allow notifications with category |
| Int |
Whether this policy wants to allow repeat callers (notifications with category |
| Int |
Whether this policy wants to allow system sounds when DND is active. |
| Int |
Whether this policy allows |
| Int |
Conversation type that can bypass DND. |
| Int |
Message senders that can bypass DND. |
| Int |
Whether this policy allows notifications intercepted by DND from appearing on ambient displays on devices that support ambient display. |
| Int |
Whether this policy allows |
| Int |
Whether this policy allows |
| Int |
Whether this policy allows |
| Int |
Whether this policy allows notifications intercepted by DND from appearing in notification list views like the notification shade or lockscreen on devices that support those views. |
| Int |
Whether this policy allows peeking from notifications intercepted by DND. |
| Int |
Whether this policy allows notifications intercepted by DND from appearing in the status bar on devices that support status bars. |
| Int |
hashCode() |
| String |
toString() |
| Unit |
writeToParcel(dest: Parcel, flags: Int) |
| Properties | |
|---|---|
| static Parcelable.Creator<ZenPolicy!> | |
Constants
CONVERSATION_SENDERS_ANYONE
static val CONVERSATION_SENDERS_ANYONE: Int
Used to indicate all conversations can bypass dnd.
Value: 1CONVERSATION_SENDERS_IMPORTANT
static val CONVERSATION_SENDERS_IMPORTANT: Int
Used to indicate important conversations can bypass dnd.
Value: 2CONVERSATION_SENDERS_NONE
static val CONVERSATION_SENDERS_NONE: Int
Used to indicate no conversations can bypass dnd.
Value: 3CONVERSATION_SENDERS_UNSET
static val CONVERSATION_SENDERS_UNSET: Int
Used to indicate no preference for the type of conversations that can bypass dnd.
Value: 0PEOPLE_TYPE_ANYONE
static val PEOPLE_TYPE_ANYONE: Int
Used to indicate all calls or messages can bypass dnd.
Value: 1PEOPLE_TYPE_CONTACTS
static val PEOPLE_TYPE_CONTACTS: Int
Used to indicate calls or messages from contacts can bypass dnd.
Value: 2PEOPLE_TYPE_NONE
static val PEOPLE_TYPE_NONE: Int
Used to indicate no calls or messages can bypass dnd.
Value: 4PEOPLE_TYPE_STARRED
static val PEOPLE_TYPE_STARRED: Int
Used to indicate calls or messages from starred contacts can bypass dnd.
Value: 3PEOPLE_TYPE_UNSET
static val PEOPLE_TYPE_UNSET: Int
Used to indicate no preference for the type of people that can bypass dnd for either calls or messages.
Value: 0STATE_ALLOW
static val STATE_ALLOW: Int
Indicates a type of sound or visual effect is allowed to play/show when DND is active.
Value: 1STATE_DISALLOW
static val STATE_DISALLOW: Int
Indicates a type of sound or visual effect is not allowed to play/show when DND is active.
Value: 2STATE_UNSET
static val STATE_UNSET: Int
Indicates no preference for whether a type of sound or visual effect is or isn't allowed to play/show when DND is active. Will default to the current set policy.
Value: 0Public methods
describeContents
fun describeContents(): Int
| Return | |
|---|---|
Int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR |
equals
fun equals(other: Any?): Boolean
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 returntrue. - It is symmetric: for any non-null reference values
xandy,x.equals(y)should returntrueif and only ify.equals(x)returnstrue. - It is transitive: for any non-null reference values
x,y, andz, ifx.equals(y)returnstrueandy.equals(z)returnstrue, thenx.equals(z)should returntrue. - It is consistent: for any non-null reference values
xandy, multiple invocations ofx.equals(y)consistently returntrueor consistently returnfalse, provided no information used inequalscomparisons on the objects is modified. - For any non-null reference value
x,x.equals(null)should returnfalse.
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.
| Parameters | |
|---|---|
obj |
the reference object with which to compare. |
o |
This value may be null. |
| Return | |
|---|---|
Boolean |
true if this object is the same as the obj argument; false otherwise. |
getPriorityCallSenders
fun getPriorityCallSenders(): Int
Callers that can bypass DND.
getPriorityCategoryAlarms
fun getPriorityCategoryAlarms(): Int
Whether this policy wants to allow notifications with category Notification.CATEGORY_ALARM to play sounds and visually appear or to intercept them when DND is active. When alarms are disallowed, the alarm stream will be muted when DND is active.
getPriorityCategoryCalls
fun getPriorityCategoryCalls(): Int
Whether this policy wants to allow notifications with category Notification.CATEGORY_CALL to play sounds and visually appear or to intercept them when DND is active. Types of callers that are allowed are specified by getPriorityCallSenders().
getPriorityCategoryConversations
fun getPriorityCategoryConversations(): Int
Whether this policy wants to allow conversation notifications (see NotificationChannel.getConversationId()) to play sounds and visually appear or to intercept them when DND is active.
getPriorityCategoryEvents
fun getPriorityCategoryEvents(): Int
Whether this policy wants to allow notifications with category Notification.CATEGORY_EVENT to play sounds and visually appear or to intercept them when DND is active.
getPriorityCategoryMedia
fun getPriorityCategoryMedia(): Int
Whether this policy wants to allow media notifications to play sounds and visually appear or to intercept them when DND is active. When media is disallowed, the media stream will be muted when DND is active.
getPriorityCategoryMessages
fun getPriorityCategoryMessages(): Int
Whether this policy wants to allow notifications with category Notification.CATEGORY_MESSAGE to play sounds and visually appear or to intercept them when DND is active. Types of message senders that are allowed are specified by getPriorityMessageSenders.
getPriorityCategoryReminders
fun getPriorityCategoryReminders(): Int
Whether this policy wants to allow notifications with category Notification.CATEGORY_REMINDER to play sounds and visually appear or to intercept them when DND is active.
getPriorityCategoryRepeatCallers
fun getPriorityCategoryRepeatCallers(): Int
Whether this policy wants to allow repeat callers (notifications with category Notification.CATEGORY_CALL that have recently called) to play sounds and visually appear or to intercept them when DND is active.
getPriorityCategorySystem
fun getPriorityCategorySystem(): Int
Whether this policy wants to allow system sounds when DND is active. When system is STATE_DISALLOW, the system stream will be muted when DND is active.
getPriorityChannelsAllowed
fun getPriorityChannelsAllowed(): Int
Whether this policy allows channels marked as NotificationChannel.canBypassDnd() to bypass DND. If STATE_ALLOW, these channels may bypass; if STATE_DISALLOW, then even notifications from channels with NotificationChannel.canBypassDnd() will be intercepted.
| Return | |
|---|---|
Int |
Value is android.service.notification.ZenPolicy#STATE_UNSET, android.service.notification.ZenPolicy#STATE_ALLOW, or android.service.notification.ZenPolicy#STATE_DISALLOW |
getPriorityConversationSenders
fun getPriorityConversationSenders(): Int
Conversation type that can bypass DND.
getPriorityMessageSenders
fun getPriorityMessageSenders(): Int
Message senders that can bypass DND.
getVisualEffectAmbient
fun getVisualEffectAmbient(): Int
Whether this policy allows notifications intercepted by DND from appearing on ambient displays on devices that support ambient display.
| Return | |
|---|---|
Int |
Value is android.service.notification.ZenPolicy#STATE_UNSET, android.service.notification.ZenPolicy#STATE_ALLOW, or android.service.notification.ZenPolicy#STATE_DISALLOW |
getVisualEffectBadge
fun getVisualEffectBadge(): Int
Whether this policy allows badges from notifications intercepted by DND on devices that support badging.
| Return | |
|---|---|
Int |
Value is android.service.notification.ZenPolicy#STATE_UNSET, android.service.notification.ZenPolicy#STATE_ALLOW, or android.service.notification.ZenPolicy#STATE_DISALLOW |
getVisualEffectFullScreenIntent
fun getVisualEffectFullScreenIntent(): Int
Whether this policy allows full screen intents from notifications intercepted by DND.
| Return | |
|---|---|
Int |
Value is android.service.notification.ZenPolicy#STATE_UNSET, android.service.notification.ZenPolicy#STATE_ALLOW, or android.service.notification.ZenPolicy#STATE_DISALLOW |
getVisualEffectLights
fun getVisualEffectLights(): Int
Whether this policy allows lights from notifications intercepted by DND.
| Return | |
|---|---|
Int |
Value is android.service.notification.ZenPolicy#STATE_UNSET, android.service.notification.ZenPolicy#STATE_ALLOW, or android.service.notification.ZenPolicy#STATE_DISALLOW |
getVisualEffectNotificationList
fun getVisualEffectNotificationList(): Int
Whether this policy allows notifications intercepted by DND from appearing in notification list views like the notification shade or lockscreen on devices that support those views.
| Return | |
|---|---|
Int |
Value is android.service.notification.ZenPolicy#STATE_UNSET, android.service.notification.ZenPolicy#STATE_ALLOW, or android.service.notification.ZenPolicy#STATE_DISALLOW |
getVisualEffectPeek
fun getVisualEffectPeek(): Int
Whether this policy allows peeking from notifications intercepted by DND.
| Return | |
|---|---|
Int |
Value is android.service.notification.ZenPolicy#STATE_UNSET, android.service.notification.ZenPolicy#STATE_ALLOW, or android.service.notification.ZenPolicy#STATE_DISALLOW |
getVisualEffectStatusBar
fun getVisualEffectStatusBar(): Int
Whether this policy allows notifications intercepted by DND from appearing in the status bar on devices that support status bars.
| Return | |
|---|---|
Int |
Value is android.service.notification.ZenPolicy#STATE_UNSET, android.service.notification.ZenPolicy#STATE_ALLOW, or android.service.notification.ZenPolicy#STATE_DISALLOW |
toString
fun toString(): String
| Return | |
|---|---|
String |
a string representation of the object. |
writeToParcel
fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
| Parameters | |
|---|---|
dest |
Parcel: The Parcel in which the object should be written. This value cannot be null. |
flags |
Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |