AgentTaskEvent
public
final
class
AgentTaskEvent
extends Object
implements
Parcelable
| java.lang.Object | |
| ↳ | 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 | |
|---|---|
class |
AgentTaskEvent.Builder
Builder for |
Inherited constants |
|---|
Fields | |
|---|---|
public
static
final
Creator<AgentTaskEvent> |
CREATOR
|
Public methods | |
|---|---|
int
|
describeContents()
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
Icon
|
getBackground()
Background icon to use for the event. |
PendingIntent
|
getClickAction()
|
CharSequence
|
getContentDescription()
Returns the content description for this element. |
List<Icon>
|
getLeadingIcons()
List of leading icons to show at the start of the event content, before any text (if available) or the trailing icons. |
static
int
|
getMaxAllowedLeadingIcons()
Maximum allowed number of leading icons to appear before the text (if any). |
static
int
|
getMaxAllowedTrailingIcons()
Maximum allowed number of trailing icons to appear after the text (if any). |
CharSequence
|
getText()
Optional text to show to the user. |
List<Icon>
|
getTrailingIcons()
List of trailing icons to show at the end of the event content, after the text (if available) or the leading icons. |
void
|
writeToParcel(Parcel dest, int flags)
Flatten this object in to a Parcel. |
Inherited methods | |
|---|---|
Fields
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(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
|
getBackground
public Icon getBackground ()
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.
| Returns | |
|---|---|
Icon |
the background to use for the event. If null, the implementation will decide. |
getClickAction
public PendingIntent getClickAction ()
PendingIntent to send when the event text in the status bar is clicked.
The PendingIntent should target an Activity.
If the PendingIntent was created with PendingIntent.FLAG_MUTABLE, as well
as 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.
| Returns | |
|---|---|
PendingIntent |
the action to execute when the element is clicked. |
See also:
getContentDescription
public CharSequence getContentDescription ()
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.
| Returns | |
|---|---|
CharSequence |
the content description associated with this whole element. |
getLeadingIcons
public List<Icon> getLeadingIcons ()
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.
| Returns | |
|---|---|
List<Icon> |
the list of leading icons.
This value cannot be null. |
See also:
getMaxAllowedLeadingIcons
public static int getMaxAllowedLeadingIcons ()
Maximum allowed number of leading icons to appear before the text (if any).
| Returns | |
|---|---|
int |
the maximum number of allowed leading icons.
Value is 1 or greater |
getMaxAllowedTrailingIcons
public static int getMaxAllowedTrailingIcons ()
Maximum allowed number of trailing icons to appear after the text (if any).
| Returns | |
|---|---|
int |
the maximum number of allowed trailing icons.
Value is 1 or greater |
getText
public CharSequence getText ()
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.
| Returns | |
|---|---|
CharSequence |
the text to show as part of the event. |
getTrailingIcons
public List<Icon> getTrailingIcons ()
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.
| Returns | |
|---|---|
List<Icon> |
the list of trailing icons.
This value cannot be null. |
See also:
writeToParcel
public void writeToParcel (Parcel dest, int flags)
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.PARCELABLE_WRITE_RETURN_VALUE.
Value is either 0 or a combination of the following:
|
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2026-08-28 UTC.