# Print output for @column tags ?>
public
static
class
NotificationManager.Policy
extends Object
implements
Parcelable
java.lang.Object | |
↳ | android.app.NotificationManager.Policy |
Notification policy configuration. Represents user-preferences for notification filtering.
Constants | |
---|---|
int |
CONVERSATION_SENDERS_ANYONE
Used to indicate all conversations can bypass dnd. |
int |
CONVERSATION_SENDERS_IMPORTANT
Used to indicate important conversations can bypass dnd. |
int |
CONVERSATION_SENDERS_NONE
Used to indicate no conversations can bypass dnd. |
int |
PRIORITY_CATEGORY_ALARMS
Alarms are prioritized |
int |
PRIORITY_CATEGORY_CALLS
Calls are prioritized. |
int |
PRIORITY_CATEGORY_CONVERSATIONS
Conversations are allowed through DND. |
int |
PRIORITY_CATEGORY_EVENTS
Event notifications are prioritized. |
int |
PRIORITY_CATEGORY_MEDIA
Media, game, voice navigation are prioritized |
int |
PRIORITY_CATEGORY_MESSAGES
Message notifications are prioritized. |
int |
PRIORITY_CATEGORY_REMINDERS
Reminder notifications are prioritized. |
int |
PRIORITY_CATEGORY_REPEAT_CALLERS
Calls from repeat callers are prioritized. |
int |
PRIORITY_CATEGORY_SYSTEM
System (catch-all for non-never suppressible sounds) are prioritized |
int |
PRIORITY_SENDERS_ANY
Any sender is prioritized. |
int |
PRIORITY_SENDERS_CONTACTS
Saved contacts are prioritized. |
int |
PRIORITY_SENDERS_STARRED
Only starred contacts are prioritized. |
int |
SUPPRESSED_EFFECT_AMBIENT
Whether notification intercepted by DND are prevented from appearing on ambient displays on devices that support ambient display. |
int |
SUPPRESSED_EFFECT_BADGE
Whether |
int |
SUPPRESSED_EFFECT_FULL_SCREEN_INTENT
Whether |
int |
SUPPRESSED_EFFECT_LIGHTS
Whether |
int |
SUPPRESSED_EFFECT_NOTIFICATION_LIST
Whether notification intercepted by DND are prevented from appearing in notification list views like the notification shade or lockscreen on devices that support those views. |
int |
SUPPRESSED_EFFECT_PEEK
Whether notifications intercepted by DND are prevented from peeking. |
int |
SUPPRESSED_EFFECT_SCREEN_OFF
This constant is deprecated.
use |
int |
SUPPRESSED_EFFECT_SCREEN_ON
This constant is deprecated.
use |
int |
SUPPRESSED_EFFECT_STATUS_BAR
Whether notifications intercepted by DND are prevented from appearing in the status bar, on devices that support status bars. |
Inherited constants |
---|
Fields | |
---|---|
public
static
final
Creator<NotificationManager.Policy> |
CREATOR
|
public
final
int |
priorityCallSenders
Notification senders to prioritize for calls. |
public
final
int |
priorityCategories
Notification categories to prioritize. |
public
final
int |
priorityConversationSenders
Notification senders to prioritize for conversations. |
public
final
int |
priorityMessageSenders
Notification senders to prioritize for messages. |
public
final
int |
suppressedVisualEffects
Visual effects to suppress for a notification that is filtered by Do Not Disturb mode. |
Public constructors | |
---|---|
Policy(int priorityCategories, int priorityCallSenders, int priorityMessageSenders)
Constructs a policy for Do Not Disturb priority mode behavior. |
|
Policy(int priorityCategories, int priorityCallSenders, int priorityMessageSenders, int suppressedVisualEffects)
Constructs a policy for Do Not Disturb priority mode behavior. |
|
Policy(int priorityCategories, int priorityCallSenders, int priorityMessageSenders, int suppressedVisualEffects, int priorityConversationSenders)
Constructs a policy for Do Not Disturb priority mode behavior. |
Public methods | |
---|---|
int
|
describeContents()
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
boolean
|
equals(Object o)
Indicates whether some other object is "equal to" this one. |
int
|
hashCode()
Returns a hash code value for the object. |
static
String
|
priorityCategoriesToString(int priorityCategories)
|
static
String
|
prioritySendersToString(int prioritySenders)
|
static
String
|
suppressedEffectsToString(int effects)
|
String
|
toString()
Returns a string representation of the object. |
void
|
writeToParcel(Parcel dest, int flags)
Flatten this object in to a Parcel. |
Inherited methods | |
---|---|
public static final int CONVERSATION_SENDERS_ANYONE
Used to indicate all conversations can bypass dnd.
Constant Value: 1 (0x00000001)
public static final int CONVERSATION_SENDERS_IMPORTANT
Used to indicate important conversations can bypass dnd.
Constant Value: 2 (0x00000002)
public static final int CONVERSATION_SENDERS_NONE
Used to indicate no conversations can bypass dnd.
Constant Value: 3 (0x00000003)
public static final int PRIORITY_CATEGORY_ALARMS
Alarms are prioritized
Constant Value: 32 (0x00000020)
public static final int PRIORITY_CATEGORY_CALLS
Calls are prioritized.
Constant Value: 8 (0x00000008)
public static final int PRIORITY_CATEGORY_CONVERSATIONS
Conversations are allowed through DND.
Constant Value: 256 (0x00000100)
public static final int PRIORITY_CATEGORY_EVENTS
Event notifications are prioritized.
Constant Value: 2 (0x00000002)
public static final int PRIORITY_CATEGORY_MEDIA
Media, game, voice navigation are prioritized
Constant Value: 64 (0x00000040)
public static final int PRIORITY_CATEGORY_MESSAGES
Message notifications are prioritized.
Constant Value: 4 (0x00000004)
public static final int PRIORITY_CATEGORY_REMINDERS
Reminder notifications are prioritized.
Constant Value: 1 (0x00000001)
public static final int PRIORITY_CATEGORY_REPEAT_CALLERS
Calls from repeat callers are prioritized.
Constant Value: 16 (0x00000010)
public static final int PRIORITY_CATEGORY_SYSTEM
System (catch-all for non-never suppressible sounds) are prioritized
Constant Value: 128 (0x00000080)
public static final int PRIORITY_SENDERS_ANY
Any sender is prioritized.
Constant Value: 0 (0x00000000)
public static final int PRIORITY_SENDERS_CONTACTS
Saved contacts are prioritized.
Constant Value: 1 (0x00000001)
public static final int PRIORITY_SENDERS_STARRED
Only starred contacts are prioritized.
Constant Value: 2 (0x00000002)
public static final int SUPPRESSED_EFFECT_AMBIENT
Whether notification intercepted by DND are prevented from appearing on ambient displays on devices that support ambient display.
Constant Value: 128 (0x00000080)
public static final int SUPPRESSED_EFFECT_BADGE
Whether NotificationChannel#canShowBadge()
from
notifications intercepted by DND are blocked on devices that support badging.
Constant Value: 64 (0x00000040)
public static final int SUPPRESSED_EFFECT_FULL_SCREEN_INTENT
Whether Notification#fullScreenIntent
from
notifications intercepted by DND are blocked.
Constant Value: 4 (0x00000004)
public static final int SUPPRESSED_EFFECT_LIGHTS
Whether NotificationChannel#shouldShowLights()
from
notifications intercepted by DND are blocked.
Constant Value: 8 (0x00000008)
public static final int SUPPRESSED_EFFECT_NOTIFICATION_LIST
Whether notification intercepted by DND are prevented from appearing in notification list views like the notification shade or lockscreen on devices that support those views.
Constant Value: 256 (0x00000100)
public static final int SUPPRESSED_EFFECT_PEEK
Whether notifications intercepted by DND are prevented from peeking.
Constant Value: 16 (0x00000010)
public static final int SUPPRESSED_EFFECT_SCREEN_OFF
This constant is deprecated.
use SUPPRESSED_EFFECT_FULL_SCREEN_INTENT
and
SUPPRESSED_EFFECT_AMBIENT
and SUPPRESSED_EFFECT_LIGHTS
individually.
Whether notifications suppressed by DND should not interrupt visually (e.g. with notification lights or by turning the screen on) when the screen is off.
Constant Value: 1 (0x00000001)
public static final int SUPPRESSED_EFFECT_SCREEN_ON
This constant is deprecated.
use SUPPRESSED_EFFECT_PEEK
.
Whether notifications suppressed by DND should not interrupt visually when the screen is on (e.g. by peeking onto the screen).
Constant Value: 2 (0x00000002)
public static final int SUPPRESSED_EFFECT_STATUS_BAR
Whether notifications intercepted by DND are prevented from appearing in the status bar, on devices that support status bars.
Constant Value: 32 (0x00000020)
public final int priorityCallSenders
Notification senders to prioritize for calls. One of: PRIORITY_SENDERS_ANY, PRIORITY_SENDERS_CONTACTS, PRIORITY_SENDERS_STARRED
public final int priorityCategories
Notification categories to prioritize. Bitmask of PRIORITY_CATEGORY_* constants.
public final int priorityConversationSenders
Notification senders to prioritize for conversations. One of:
CONVERSATION_SENDERS_NONE
, CONVERSATION_SENDERS_IMPORTANT
,
CONVERSATION_SENDERS_ANYONE
.
public final int priorityMessageSenders
Notification senders to prioritize for messages. One of: PRIORITY_SENDERS_ANY, PRIORITY_SENDERS_CONTACTS, PRIORITY_SENDERS_STARRED
public final int suppressedVisualEffects
Visual effects to suppress for a notification that is filtered by Do Not Disturb mode. Bitmask of SUPPRESSED_EFFECT_* constants.
public Policy (int priorityCategories, int priorityCallSenders, int priorityMessageSenders)
Constructs a policy for Do Not Disturb priority mode behavior.
Apps that target API levels below Build.VERSION_CODES#P
cannot
change user-designated values to allow or disallow
Policy#PRIORITY_CATEGORY_ALARMS
, Policy#PRIORITY_CATEGORY_SYSTEM
, and
Policy#PRIORITY_CATEGORY_MEDIA
from bypassing dnd.
Parameters | |
---|---|
priorityCategories |
int : bitmask of categories of notifications that can bypass DND. |
priorityCallSenders |
int : which callers can bypass DND. |
priorityMessageSenders |
int : which message senders can bypass DND. |
public Policy (int priorityCategories, int priorityCallSenders, int priorityMessageSenders, int suppressedVisualEffects)
Constructs a policy for Do Not Disturb priority mode behavior.
Apps that target API levels below Build.VERSION_CODES#R
cannot
change user-designated values to allow or disallow
Policy#PRIORITY_CATEGORY_CONVERSATIONS
, from bypassing dnd.
Additionally, apps that target API levels below Build.VERSION_CODES#P
can
only modify the SUPPRESSED_EFFECT_SCREEN_ON
and
SUPPRESSED_EFFECT_SCREEN_OFF
bits of the suppressed visual effects field.
All other suppressed effects will be ignored and reconstituted from the screen on
and screen off values.
Apps that target Build.VERSION_CODES#P
or above can set any
suppressed visual effects. However, if any suppressed effects >
SUPPRESSED_EFFECT_SCREEN_ON
are set, SUPPRESSED_EFFECT_SCREEN_ON
and SUPPRESSED_EFFECT_SCREEN_OFF
will be ignored and reconstituted from
the more specific suppressed visual effect bits. Apps should migrate to targeting
specific effects instead of the deprecated SUPPRESSED_EFFECT_SCREEN_ON
and
SUPPRESSED_EFFECT_SCREEN_OFF
effects.
Parameters | |
---|---|
priorityCategories |
int : bitmask of categories of notifications that can bypass DND. |
priorityCallSenders |
int : which callers can bypass DND. |
priorityMessageSenders |
int : which message senders can bypass DND. |
suppressedVisualEffects |
int : which visual interruptions should be suppressed from
notifications that are filtered by DND. |
public Policy (int priorityCategories, int priorityCallSenders, int priorityMessageSenders, int suppressedVisualEffects, int priorityConversationSenders)
Constructs a policy for Do Not Disturb priority mode behavior.
Apps that target API levels below Build.VERSION_CODES#P
cannot
change user-designated values to allow or disallow
Policy#PRIORITY_CATEGORY_CONVERSATIONS
from bypassing dnd. If you do need
to change them, use a ZenPolicy
associated with an AutomaticZenRule
instead of changing the global setting.
Apps that target API levels below Build.VERSION_CODES#P
cannot
change user-designated values to allow or disallow
Policy#PRIORITY_CATEGORY_ALARMS
,
Policy#PRIORITY_CATEGORY_SYSTEM
, and
Policy#PRIORITY_CATEGORY_MEDIA
from bypassing dnd.
Additionally, apps that target API levels below Build.VERSION_CODES#P
can
only modify the SUPPRESSED_EFFECT_SCREEN_ON
and
SUPPRESSED_EFFECT_SCREEN_OFF
bits of the suppressed visual effects field.
All other suppressed effects will be ignored and reconstituted from the screen on
and screen off values.
Apps that target Build.VERSION_CODES#P
or above can set any
suppressed visual effects. However, if any suppressed effects >
SUPPRESSED_EFFECT_SCREEN_ON
are set, SUPPRESSED_EFFECT_SCREEN_ON
and SUPPRESSED_EFFECT_SCREEN_OFF
will be ignored and reconstituted from
the more specific suppressed visual effect bits. Apps should migrate to targeting
specific effects instead of the deprecated SUPPRESSED_EFFECT_SCREEN_ON
and
SUPPRESSED_EFFECT_SCREEN_OFF
effects.
Parameters | |
---|---|
priorityCategories |
int : bitmask of categories of notifications that can bypass DND. |
priorityCallSenders |
int : which callers can bypass DND.
Value is PRIORITY_SENDERS_ANY , PRIORITY_SENDERS_CONTACTS , or PRIORITY_SENDERS_STARRED |
priorityMessageSenders |
int : which message senders can bypass DND.
Value is PRIORITY_SENDERS_ANY , PRIORITY_SENDERS_CONTACTS , or PRIORITY_SENDERS_STARRED |
suppressedVisualEffects |
int : which visual interruptions should be suppressed from
notifications that are filtered by DND. |
priorityConversationSenders |
int : Value is CONVERSATION_SENDERS_ANYONE , CONVERSATION_SENDERS_IMPORTANT , or CONVERSATION_SENDERS_NONE |
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 writeToParcel(android.os.Parcel, int)
,
the return value of this method must include the
CONTENTS_FILE_DESCRIPTOR
bit.
Returns | |
---|---|
int |
a bitmask indicating the set of special object types marshaled
by this Parcelable object instance.
Value is either 0 or CONTENTS_FILE_DESCRIPTOR |
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:
x
, x.equals(x)
should return
true
.
x
and y
, x.equals(y)
should return true
if and only if
y.equals(x)
returns true
.
x
, y
, and z
, if
x.equals(y)
returns true
and
y.equals(z)
returns true
, then
x.equals(z)
should return true
.
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.
x
,
x.equals(null)
should return false
.
The equals
method for class Object
implements
the most discriminating possible equivalence relation on objects;
that is, for any non-null reference values x
and
y
, this method returns true
if and only
if x
and y
refer to the same object
(x == y
has the value true
).
Note that it is generally necessary to override the hashCode
method whenever this method is overridden, so as to maintain the
general contract for the hashCode
method, which states
that equal objects must have equal hash codes.
Parameters | |
---|---|
o |
Object : the reference object with which to compare. |
Returns | |
---|---|
boolean |
true if this object is the same as the obj
argument; false otherwise. |
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
HashMap
.
The general contract of hashCode
is:
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.
equals(Object)
method, then calling the hashCode
method on each of
the two objects must produce the same integer result.
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.
As much as is reasonably practical, the hashCode method defined by
class Object
does return distinct integers for distinct
objects. (This is typically implemented by converting the internal
address of the object into an integer, but this implementation
technique is not required by the
Java™ programming language.)
Returns | |
---|---|
int |
a hash code value for this object. |
public static String priorityCategoriesToString (int priorityCategories)
Parameters | |
---|---|
priorityCategories |
int |
Returns | |
---|---|
String |
public static String prioritySendersToString (int prioritySenders)
Parameters | |
---|---|
prioritySenders |
int |
Returns | |
---|---|
String |
public static String suppressedEffectsToString (int effects)
Parameters | |
---|---|
effects |
int |
Returns | |
---|---|
String |
public String toString ()
Returns a string representation of the object. In general, the
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
Returns | |
---|---|
String |
a string representation of the object. |
public void writeToParcel (Parcel dest, int flags)
Flatten this object in to a Parcel.
Parameters | |
---|---|
dest |
Parcel : The Parcel in which the object should be written. |
flags |
int : Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE .
Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |