Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33e979cc authored by Tony Mak's avatar Tony Mak Committed by Android (Google) Code Review
Browse files

Merge "Add TYPE_LINKS_GENERATED and make ... TextClassificationSessionId.flattenToString() public"

parents 9fc4fe0c a2ffa37d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -53727,6 +53727,7 @@ package android.view.textclassifier {
  public final class TextClassificationSessionId implements android.os.Parcelable {
    method public int describeContents();
    method @NonNull public String flattenToString();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextClassificationSessionId> CREATOR;
  }
@@ -53814,6 +53815,7 @@ package android.view.textclassifier {
    field public static final int TYPE_AUTO_SELECTION = 5; // 0x5
    field public static final int TYPE_COPY_ACTION = 9; // 0x9
    field public static final int TYPE_CUT_ACTION = 11; // 0xb
    field public static final int TYPE_LINKS_GENERATED = 21; // 0x15
    field public static final int TYPE_LINK_CLICKED = 7; // 0x7
    field public static final int TYPE_MANUAL_REPLY = 19; // 0x13
    field public static final int TYPE_OTHER_ACTION = 16; // 0x10
+0 −2
Original line number Diff line number Diff line
@@ -96,8 +96,6 @@ public final class TextClassificationSessionId implements Parcelable {
     * Flattens this id to a string.
     *
     * @return The flattened id.
     *
     * @hide
     */
    public @NonNull String flattenToString() {
        return mValue;
+25 −2
Original line number Diff line number Diff line
@@ -86,11 +86,13 @@ public abstract class TextClassifierEvent implements Parcelable {
            TYPE_ACTIONS_SHOWN, TYPE_LINK_CLICKED, TYPE_OVERTYPE, TYPE_COPY_ACTION,
            TYPE_PASTE_ACTION, TYPE_CUT_ACTION, TYPE_SHARE_ACTION, TYPE_SMART_ACTION,
            TYPE_SELECTION_DRAG, TYPE_SELECTION_DESTROYED, TYPE_OTHER_ACTION, TYPE_SELECT_ALL,
            TYPE_SELECTION_RESET, TYPE_MANUAL_REPLY, TYPE_ACTIONS_GENERATED})
            TYPE_SELECTION_RESET, TYPE_MANUAL_REPLY, TYPE_ACTIONS_GENERATED, TYPE_LINKS_GENERATED})
    public @interface Type {
        // For custom event types, use range 1,000,000+.
    }

    // All these event type constants are required to match with those defined in
    // textclassifier_enums.proto.
    /** User started a new selection. */
    public static final int TYPE_SELECTION_STARTED = 1;
    /** User modified an existing selection. */
@@ -131,6 +133,8 @@ public abstract class TextClassifierEvent implements Parcelable {
    public static final int TYPE_MANUAL_REPLY = 19;
    /** TextClassifier generated some actions */
    public static final int TYPE_ACTIONS_GENERATED = 20;
    /** Some text links were generated.*/
    public static final int TYPE_LINKS_GENERATED = 21;

    @Category
    private final int mEventCategory;
@@ -365,7 +369,8 @@ public abstract class TextClassifierEvent implements Parcelable {
        out.append(this.getClass().getSimpleName());
        out.append("{");
        out.append("mEventCategory=").append(mEventCategory);
        out.append(", mEventTypes=").append(Arrays.toString(mEntityTypes));
        out.append(", mEventType=").append(mEventType);
        out.append(", mEntityTypes=").append(Arrays.toString(mEntityTypes));
        out.append(", mEventContext=").append(mEventContext);
        out.append(", mResultId=").append(mResultId);
        out.append(", mEventIndex=").append(mEventIndex);
@@ -373,10 +378,18 @@ public abstract class TextClassifierEvent implements Parcelable {
        out.append(", mScores=").append(Arrays.toString(mScores));
        out.append(", mModelName=").append(mModelName);
        out.append(", mActionIndices=").append(Arrays.toString(mActionIndices));
        toString(out);
        out.append("}");
        return out.toString();
    }

    /**
     * Overrides this to append extra fields to the output of {@link #toString()}.
     * <p>
     * Extra fields should be  formatted like this: ", {field_name}={field_value}".
     */
    void toString(StringBuilder out) {}

    /**
     * Returns a {@link SelectionEvent} equivalent of this event; or {@code null} if it can not be
     * converted to a {@link SelectionEvent}.
@@ -811,6 +824,16 @@ public abstract class TextClassifierEvent implements Parcelable {
            return mRelativeSuggestedWordEndIndex;
        }

        @Override
        void toString(StringBuilder out) {
            out.append(", getRelativeWordStartIndex=").append(mRelativeWordStartIndex);
            out.append(", getRelativeWordEndIndex=").append(mRelativeWordEndIndex);
            out.append(", getRelativeSuggestedWordStartIndex=")
                    .append(mRelativeSuggestedWordStartIndex);
            out.append(", getRelativeSuggestedWordEndIndex=")
                    .append(mRelativeSuggestedWordEndIndex);
        }

        /**
         * Builder class for {@link TextSelectionEvent}.
         */
+2 −0
Original line number Diff line number Diff line
@@ -60,6 +60,8 @@ enum EventType {
    MANUAL_REPLY = 19;
    // TextClassifier generated some actions
    ACTIONS_GENERATED = 20;
    // Some text links were generated
    LINKS_GENERATED = 21;
}

enum WidgetType {