Adjustment
public
final
class
Adjustment
extends Object
implements
Parcelable
| java.lang.Object | |
| ↳ | android.service.notification.Adjustment |
Ranking updates from the Assistant.
The updates are provides as a Bundle of signals, using the keys provided in this
class.
Each KEY specifies what type of data it supports and what kind of Adjustment it
realizes on the notification rankings.
Notifications affected by the Adjustment will be re-ranked if necessary.
Summary
Constants | |
|---|---|
String |
KEY_CONTEXTUAL_ACTIONS
Data type: ArrayList of |
String |
KEY_IMPORTANCE
Data type: int, one of importance values e.g. |
String |
KEY_SNOOZE_CRITERIA
Parcelable |
String |
KEY_TEXT_REPLIES
Data type: ArrayList of |
String |
KEY_USER_SENTIMENT
Data type: int, one of |
Inherited constants |
|---|
Fields | |
|---|---|
public
static
final
Creator<Adjustment> |
CREATOR
|
Public constructors | |
|---|---|
Adjustment(String pkg, String key, Bundle signals, CharSequence explanation, UserHandle userHandle)
Create a notification adjustment. |
|
Public methods | |
|---|---|
int
|
describeContents()
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
CharSequence
|
getExplanation()
|
String
|
getKey()
|
String
|
getPackage()
|
Bundle
|
getSignals()
|
UserHandle
|
getUserHandle()
|
String
|
toString()
Returns a string representation of the object. |
void
|
writeToParcel(Parcel dest, int flags)
Flatten this object in to a Parcel. |
Inherited methods | |
|---|---|
Constants
KEY_CONTEXTUAL_ACTIONS
public static final String KEY_CONTEXTUAL_ACTIONS
Data type: ArrayList of Notification.Action.
Used to suggest contextual actions for a notification.
Constant Value: "key_contextual_actions"
KEY_IMPORTANCE
public static final String KEY_IMPORTANCE
Data type: int, one of importance values e.g.
NotificationManager.IMPORTANCE_MIN.
If used from
NotificationAssistantService#onNotificationEnqueued(StatusBarNotification), and
received before the notification is posted, it can block a notification from appearing or
silence it. Importance adjustments received too late from
NotificationAssistantService#onNotificationEnqueued(StatusBarNotification) will be
ignored.
If used from
NotificationAssistantService#adjustNotification(Adjustment), it can
visually demote or cancel a notification, but use this with care if they notification was
recently posted because the notification may already have made noise.
Constant Value: "key_importance"
KEY_SNOOZE_CRITERIA
public static final String KEY_SNOOZE_CRITERIA
Parcelable ArrayList of SnoozeCriterion. These criteria may be visible to
users. If a user chooses to snooze a notification until one of these criterion, the
assistant will be notified via
NotificationAssistantService#onNotificationSnoozedUntilContext.
Constant Value: "key_snooze_criteria"
KEY_TEXT_REPLIES
public static final String KEY_TEXT_REPLIES
Data type: ArrayList of CharSequence.
Used to suggest smart replies for a notification.
Constant Value: "key_text_replies"
KEY_USER_SENTIMENT
public static final String KEY_USER_SENTIMENT
Data type: int, one of NotificationListenerService.Ranking#USER_SENTIMENT_POSITIVE,
NotificationListenerService.Ranking#USER_SENTIMENT_NEUTRAL,
NotificationListenerService.Ranking#USER_SENTIMENT_NEGATIVE. Used to express how
a user feels about notifications in the same NotificationChannel as
the notification represented by getKey().
Constant Value: "key_user_sentiment"
Fields
Public constructors
Adjustment
public Adjustment (String pkg, String key, Bundle signals, CharSequence explanation, UserHandle userHandle)
Create a notification adjustment.
| Parameters | |
|---|---|
pkg |
String: The package of the notification. |
key |
String: The notification key. |
signals |
Bundle: A bundle of signals that should inform notification display, ordering, and
interruptiveness. |
explanation |
CharSequence: A human-readable justification for the adjustment. |
userHandle |
UserHandle: User handle for for whose the adjustments will be applied. |
Public methods
describeContents
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 |
toString
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. |
writeToParcel
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 |