AgentTaskEvent
class AgentTaskEvent : Parcelable
| kotlin.Any | |
| ↳ | android.agenticon.AgentTaskEvent |
Information about a one-time agent-related event to communicate to the user.
These will be shown to the user in the status bar for a short period of time, possibly hiding the current AgentTaskState.
The event must contain text, icons, or both. The order of display from start to end is:
- Leading icons
- Text
- Trailing icons
null. Some of these may be ellipsized or omitted if there's not enough space.
These events may not be shown in some cases, for example when many are sent in a short period of time, or if the user's status bar is hidden, or if other critical information must be displayed in the status bar instead.
Summary
| Nested classes | |
|---|---|
|
Builder for |
|
| Inherited constants | |
|---|---|
| Public methods | |
|---|---|
| Int |
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| Icon? |
Background icon to use for the event. |
| PendingIntent? |
|
| CharSequence? |
Returns the content description for this element. |
| MutableList<Icon!> |
List of leading icons to show at the start of the event content, before any text (if available) or the trailing icons. |
| static Int |
Maximum allowed number of leading icons to appear before the text (if any). |
| static Int |
Maximum allowed number of trailing icons to appear after the text (if any). |
| CharSequence? |
getText()Optional text to show to the user. |
| MutableList<Icon!> |
List of trailing icons to show at the end of the event content, after the text (if available) or the leading icons. |
| Unit |
writeToParcel(dest: Parcel, flags: Int)Flatten this object in to a Parcel. |
| Properties | |
|---|---|
| static Parcelable.Creator<AgentTaskEvent!> | |
Public methods
describeContents
fun describeContents(): Int
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(Parcel,int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.
| Return | |
|---|---|
Int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or
|
getBackground
fun getBackground(): Icon?
Background icon to use for the event.
This icon will be masked to an appropriate shape and size, without changing the underlying proportions of the icon. The mask will be centered on the scaled icon. It is recommended for the icon to be "wide", to ensure that top and bottom are not cropped.
If null, the background will be chosen by the implementation.
| Return | |
|---|---|
Icon? |
the background to use for the event. If null, the implementation will decide. |
getClickAction
fun getClickAction(): PendingIntent?
PendingIntent to send when the event text in the status bar is clicked.
The PendingIntent should target an android.app.Activity.
If the PendingIntent was created with PendingIntent.FLAG_MUTABLE, as well as android.content.Intent#FILL_IN_SOURCE_BOUNDS, then the source bounds will be filled in with the coordinates on screen of the UI element that triggered this intent
Based on the value of StatusBarManager.isAgentTaskLaunchSupported(), this value will be used differently by the implementation:
- If
StatusBarManager.isAgentTaskLaunchSupported()istrue, the value will be used as is ifnon-null. If the value isnull, the default set usingStatusBarManager.ACTION_AGENT_TASK_MAINwill be used as the click action for this event. - If
StatusBarManager.isAgentTaskLaunchSupported()isfalse, this value will be ignored by the implementation, regardless of whether it'snullor not.
| Return | |
|---|---|
PendingIntent? |
the action to execute when the element is clicked. |
getContentDescription
fun getContentDescription(): CharSequence?
Returns the content description for this element.
This should describe the whole element (including any icons or text). If null, it will fall back to getText() if possible or the implementation will use a suitable description.
| Return | |
|---|---|
CharSequence? |
the content description associated with this whole element. |
getLeadingIcons
fun getLeadingIcons(): MutableList<Icon!>
List of leading icons to show at the start of the event content, before any text (if available) or the trailing icons.
This list could be empty. If so, getText() or getTrailingIcons() must not be empty.
Some of the icons may not be displayed, if there's not enough space.
| Return | |
|---|---|
MutableList<Icon!> |
the list of leading icons. This value cannot be null. |
See Also
getMaxAllowedLeadingIcons
static fun getMaxAllowedLeadingIcons(): Int
Maximum allowed number of leading icons to appear before the text (if any).
| Return | |
|---|---|
Int |
the maximum number of allowed leading icons. Value is 1 or greater |
getMaxAllowedTrailingIcons
static fun getMaxAllowedTrailingIcons(): Int
Maximum allowed number of trailing icons to appear after the text (if any).
| Return | |
|---|---|
Int |
the maximum number of allowed trailing icons. Value is 1 or greater |
getText
fun getText(): CharSequence?
Optional text to show to the user.
This can only be null or empty if one of getLeadingIcons or getTrailingIcons is not empty.
The text may be truncated if there's not enough space to show it.
| Return | |
|---|---|
CharSequence? |
the text to show as part of the event. |
getTrailingIcons
fun getTrailingIcons(): MutableList<Icon!>
List of trailing icons to show at the end of the event content, after the text (if available) or the leading icons.
This list could be empty. If so, getText() or getLeadingIcons() must not be empty.
Some of the icons may not be displayed, if there's not enough space.
| Return | |
|---|---|
MutableList<Icon!> |
the list of trailing icons. This value cannot be null. |
See Also
writeToParcel
fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
Flatten this object in to a Parcel.
| Parameters | |
|---|---|
dest |
Parcel: 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 the following:
|