AgentTaskState
class AgentTaskState : Parcelable
| kotlin.Any | |
| ↳ | android.agenticon.AgentTaskState |
Information about the agent's current state. This information is shown as an icon in the status bar.
This icon can be clicked to open the agent application.
Summary
| Nested classes | |
|---|---|
|
Builder for |
|
| Inherited constants | |
|---|---|
| Public methods | |
|---|---|
| Int |
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| PendingIntent? |
|
| CharSequence |
Content description associated with |
| Icon |
getIcon()Icon to display in the status bar. |
| Boolean |
Indicates that this new state's icon should interrupt the animation of the previous state's icon. |
| Boolean |
Indicates that this state's icon animation should be looped on repeat. |
| Unit |
writeToParcel(dest: Parcel, flags: Int)Flatten this object in to a Parcel. |
| Properties | |
|---|---|
| static Parcelable.Creator<AgentTaskState!> | |
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
|
getClickAction
fun getClickAction(): PendingIntent?
PendingIntent to send when the state icon 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, then the state icon will not be clickable. - 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
Content description associated with getIcon.
This content description will be concatenated with the application name, and may be hidden in sensitive contexts.
| Return | |
|---|---|
CharSequence |
a description of the icon. This value cannot be null. |
getIcon
fun getIcon(): Icon
Icon to display in the status bar.
This icon will be used until the next AgentTaskState is sent.
The icon should be a monochrome icon that will be tinted for contrast purposes.
The icon can be an animation. Icon animations are recommended to be finite and less than 3 seconds in length. Longer animations may be cut short depending on system constraints.
If the provided animation should loop on repeat, #shouldLoopAnimtion() should be set to true.
The icon animation will be played to completion before switching to the next AgentTaskState. This behavior can be interrupted by sending a new AgentTaskState with shouldInterruptPreviousAnimation() set to true.
| Return | |
|---|---|
Icon |
the icon representing the current state of the agent. This value cannot be null. |
shouldInterruptPreviousAnimation
fun shouldInterruptPreviousAnimation(): Boolean
Indicates that this new state's icon should interrupt the animation of the previous state's icon.
If the previous state's icon is an animation, when this is true, this new AgentTaskState will interrupt that animation, immediately moving to the new state (and icon), without waiting for the previous animation to complete.
If the previous icon is not animated, this value is ignored.
| Return | |
|---|---|
Boolean |
true if this state's icon should interrupt the previous state's animation, instead of playing it until completion. |
shouldLoopAnimation
fun shouldLoopAnimation(): Boolean
Indicates that this state's icon animation should be looped on repeat.
If this value is true:
- If the icon provided in
getIconhas a finite animation, then the finite animation will be re-played. The amount of repetitions will be determined by the system depending on system health, battery life, and other factors. The icon animation will be played to completion before switching to the nextAgentTaskState. This behavior can be interrupted by sending a newAgentTaskStatewithshouldInterruptPreviousAnimation()set totrue. - If the icon provided in
getIconhas a infinite animation, then the infinite animation will be played. The total animation time will be determined by the system depending on system health, battery life, and other factors. When the animation is stopped by the system or when a newAgentTaskStateis sent, the infinite animation can be stopped at any frame. - If the icon provided in
getIconis not animated, this value is ignored.
If this value is false:
- If the icon provided in
getIconhas a finite animation, then the finite animation will be played once and will be played to the end of the animation, though longer animations may be cut short depending on system constraints. - If the icon provided in
getIconhas a infinite animation, then the infinite animation will be played for a short period of time, around 3 seconds. When the animation is stopped by the system or when a newAgentTaskStateis sent, the infinite animation can be stopped at any frame. - If the icon provided in
getIconis not animated, this value is ignored.
| Return | |
|---|---|
Boolean |
true if this state's icon should continue looping as long as is allowed by the system. |
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:
|