TextClassifierEvent


public abstract class TextClassifierEvent
extends Object implements Parcelable

java.lang.Object
   ↳ android.view.textclassifier.TextClassifierEvent


This class represents events that are sent by components to the TextClassifier to report something of note that relates to a feature powered by the TextClassifier. The TextClassifier may log these events or use them to improve future responses to queries.

Each category of events has its their own subclass. Events of each type have an associated set of related properties. You can find their specification in the subclasses.

Summary

Nested classes

class TextClassifierEvent.Builder<T extends Builder<T>>

Builder to build a text classifier event. 

class TextClassifierEvent.ConversationActionsEvent

This class represents events that are related to the conversation actions feature. 

class TextClassifierEvent.LanguageDetectionEvent

This class represents events that are related to the language detection feature. 

class TextClassifierEvent.TextLinkifyEvent

This class represents events that are related to the smart linkify feature. 

class TextClassifierEvent.TextSelectionEvent

This class represents events that are related to the smart text selection feature. 

Constants

int CATEGORY_CONVERSATION_ACTIONS

Conversation actions

int CATEGORY_LANGUAGE_DETECTION

Language detection

int CATEGORY_LINKIFY

Linkify

int CATEGORY_SELECTION

Smart selection

int TYPE_ACTIONS_GENERATED

TextClassifier generated some actions

int TYPE_ACTIONS_SHOWN

Smart actions shown to the user.

int TYPE_AUTO_SELECTION

Something else other than user or the default TextClassifier triggered a selection.

int TYPE_COPY_ACTION

User clicked on Copy action.

int TYPE_CUT_ACTION

User clicked on Cut action.

int TYPE_LINKS_GENERATED

Some text links were generated.

int TYPE_LINK_CLICKED

User clicked a link.

int TYPE_MANUAL_REPLY

User composed a reply.

int TYPE_OTHER_ACTION

User clicked on a custom action.

int TYPE_OVERTYPE

User typed over the selection.

int TYPE_PASTE_ACTION

User clicked on Paste action.

int TYPE_SELECTION_DESTROYED

Selection is destroyed.

int TYPE_SELECTION_DRAG

User dragged+dropped the selection.

int TYPE_SELECTION_MODIFIED

User modified an existing selection.

int TYPE_SELECTION_RESET

User reset the smart selection.

int TYPE_SELECTION_STARTED

User started a new selection.

int TYPE_SELECT_ALL

User clicked on Select All action

int TYPE_SHARE_ACTION

User clicked on Share action.

int TYPE_SMART_ACTION

User clicked on a Smart action.

int TYPE_SMART_SELECTION_MULTI

Smart selection triggered spanning multiple tokens (words).

int TYPE_SMART_SELECTION_SINGLE

Smart selection triggered for a single token (word).

Inherited constants

Fields

public static final Creator<TextClassifierEvent> CREATOR

Public methods

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

int[] getActionIndices()

Returns the indices of the actions relating to this event.

String[] getEntityTypes()

Returns an array of entity types.

int getEventCategory()

Returns the event category.

TextClassificationContext getEventContext()

Returns the event context.

int getEventIndex()

Returns the index of this event in the series of event it belongs to.

int getEventType()

Returns the event type.

Bundle getExtras()

Returns a bundle containing non-structured extra information about this event.

ULocale getLocale()

Returns the detected locale.

String getModelName()

Returns the model name.

String getResultId()

Returns the id of the text classifier result related to this event.

float[] getScores()

Returns the scores of the suggestions.

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

CATEGORY_CONVERSATION_ACTIONS

Added in API level 29
public static final int CATEGORY_CONVERSATION_ACTIONS

Conversation actions

Constant Value: 3 (0x00000003)

CATEGORY_LANGUAGE_DETECTION

Added in API level 29
public static final int CATEGORY_LANGUAGE_DETECTION

Language detection

Constant Value: 4 (0x00000004)

CATEGORY_LINKIFY

Added in API level 29
public static final int CATEGORY_LINKIFY

Linkify

Constant Value: 2 (0x00000002)

CATEGORY_SELECTION

Added in API level 29
public static final int CATEGORY_SELECTION

Smart selection

Constant Value: 1 (0x00000001)

TYPE_ACTIONS_GENERATED

Added in API level 29
public static final int TYPE_ACTIONS_GENERATED

TextClassifier generated some actions

Constant Value: 20 (0x00000014)

TYPE_ACTIONS_SHOWN

Added in API level 29
public static final int TYPE_ACTIONS_SHOWN

Smart actions shown to the user.

Constant Value: 6 (0x00000006)

TYPE_AUTO_SELECTION

Added in API level 29
public static final int TYPE_AUTO_SELECTION

Something else other than user or the default TextClassifier triggered a selection.

Constant Value: 5 (0x00000005)

TYPE_COPY_ACTION

Added in API level 29
public static final int TYPE_COPY_ACTION

User clicked on Copy action.

Constant Value: 9 (0x00000009)

TYPE_CUT_ACTION

Added in API level 29
public static final int TYPE_CUT_ACTION

User clicked on Cut action.

Constant Value: 11 (0x0000000b)

Added in API level 30
public static final int TYPE_LINKS_GENERATED

Some text links were generated.

Constant Value: 21 (0x00000015)

Added in API level 29
public static final int TYPE_LINK_CLICKED

User clicked a link.

Constant Value: 7 (0x00000007)

TYPE_MANUAL_REPLY

Added in API level 29
public static final int TYPE_MANUAL_REPLY

User composed a reply.

Constant Value: 19 (0x00000013)

TYPE_OTHER_ACTION

Added in API level 29
public static final int TYPE_OTHER_ACTION

User clicked on a custom action.

Constant Value: 16 (0x00000010)

TYPE_OVERTYPE

Added in API level 29
public static final int TYPE_OVERTYPE

User typed over the selection.

Constant Value: 8 (0x00000008)

TYPE_PASTE_ACTION

Added in API level 29
public static final int TYPE_PASTE_ACTION

User clicked on Paste action.

Constant Value: 10 (0x0000000a)

TYPE_SELECTION_DESTROYED

Added in API level 29
public static final int TYPE_SELECTION_DESTROYED

Selection is destroyed.

Constant Value: 15 (0x0000000f)

TYPE_SELECTION_DRAG

Added in API level 29
public static final int TYPE_SELECTION_DRAG

User dragged+dropped the selection.

Constant Value: 14 (0x0000000e)

TYPE_SELECTION_MODIFIED

Added in API level 29
public static final int TYPE_SELECTION_MODIFIED

User modified an existing selection.

Constant Value: 2 (0x00000002)

TYPE_SELECTION_RESET

Added in API level 29
public static final int TYPE_SELECTION_RESET

User reset the smart selection.

Constant Value: 18 (0x00000012)

TYPE_SELECTION_STARTED

Added in API level 29
public static final int TYPE_SELECTION_STARTED

User started a new selection.

Constant Value: 1 (0x00000001)

TYPE_SELECT_ALL

Added in API level 29
public static final int TYPE_SELECT_ALL

User clicked on Select All action

Constant Value: 17 (0x00000011)

TYPE_SHARE_ACTION

Added in API level 29
public static final int TYPE_SHARE_ACTION

User clicked on Share action.

Constant Value: 12 (0x0000000c)

TYPE_SMART_ACTION

Added in API level 29
public static final int TYPE_SMART_ACTION

User clicked on a Smart action.

Constant Value: 13 (0x0000000d)

TYPE_SMART_SELECTION_MULTI

Added in API level 29
public static final int TYPE_SMART_SELECTION_MULTI

Smart selection triggered spanning multiple tokens (words).

Constant Value: 4 (0x00000004)

TYPE_SMART_SELECTION_SINGLE

Added in API level 29
public static final int TYPE_SMART_SELECTION_SINGLE

Smart selection triggered for a single token (word).

Constant Value: 3 (0x00000003)

Fields

CREATOR

Added in API level 29
public static final Creator<TextClassifierEvent> CREATOR

Public methods

describeContents

Added in API level 29
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

getActionIndices

Added in API level 29
public int[] getActionIndices ()

Returns the indices of the actions relating to this event. Actions are usually returned by the text classifier in priority order with the most preferred action at index 0. This list gives an indication of the position of the actions that are being reported.

Returns
int[] This value cannot be null.

getEntityTypes

Added in API level 29
public String[] getEntityTypes ()

Returns an array of entity types. e.g. TextClassifier.TYPE_ADDRESS.

Returns
String[] This value cannot be null.

getEventCategory

Added in API level 29
public int getEventCategory ()

Returns the event category. e.g. CATEGORY_SELECTION.

Returns
int Value is CATEGORY_SELECTION, CATEGORY_LINKIFY, CATEGORY_CONVERSATION_ACTIONS, or CATEGORY_LANGUAGE_DETECTION

getEventContext

Added in API level 29
public TextClassificationContext getEventContext ()

Returns the event context.

Returns
TextClassificationContext This value may be null.

getEventIndex

Added in API level 29
public int getEventIndex ()

Returns the index of this event in the series of event it belongs to.

Returns
int

getExtras

Added in API level 29
public Bundle getExtras ()

Returns a bundle containing non-structured extra information about this event.

NOTE: Do not modify this bundle.

Returns
Bundle This value cannot be null.

getLocale

Added in API level 29
public ULocale getLocale ()

Returns the detected locale.

Returns
ULocale This value may be null.

getModelName

Added in API level 29
public String getModelName ()

Returns the model name.

Returns
String This value may be null.

getResultId

Added in API level 29
public String getResultId ()

Returns the id of the text classifier result related to this event.

Returns
String This value may be null.

getScores

Added in API level 29
public float[] getScores ()

Returns the scores of the suggestions.

Returns
float[] This value cannot be null.

toString

Added in API level 29
public String toString ()

Returns a string representation of the object.

Returns
String a string representation of the object.

writeToParcel

Added in API level 29
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. 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 Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES