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

Commit 33d783fc authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "TextClassifierService.onSelectionEvent"

parents 75c79fc9 c6a56a31
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -51062,7 +51062,8 @@ package android.view.textclassifier {
    method public java.lang.String getWidgetVersion();
  }
  public final class SelectionEvent {
  public final class SelectionEvent implements android.os.Parcelable {
    method public int describeContents();
    method public long getDurationSincePreviousEvent();
    method public long getDurationSinceSessionStart();
    method public int getEnd();
@@ -51079,6 +51080,7 @@ package android.view.textclassifier {
    method public int getStart();
    method public java.lang.String getWidgetType();
    method public java.lang.String getWidgetVersion();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int ACTION_ABANDON = 107; // 0x6b
    field public static final int ACTION_COPY = 101; // 0x65
    field public static final int ACTION_CUT = 103; // 0x67
@@ -51090,6 +51092,7 @@ package android.view.textclassifier {
    field public static final int ACTION_SELECT_ALL = 200; // 0xc8
    field public static final int ACTION_SHARE = 104; // 0x68
    field public static final int ACTION_SMART_SHARE = 105; // 0x69
    field public static final android.os.Parcelable.Creator<android.view.textclassifier.SelectionEvent> CREATOR;
    field public static final int EVENT_AUTO_SELECTION = 5; // 0x5
    field public static final int EVENT_SELECTION_MODIFIED = 2; // 0x2
    field public static final int EVENT_SELECTION_STARTED = 1; // 0x1
+1 −0
Original line number Diff line number Diff line
@@ -4693,6 +4693,7 @@ package android.service.textclassifier {
    method public final android.os.IBinder onBind(android.content.Intent);
    method public abstract void onClassifyText(java.lang.CharSequence, int, int, android.view.textclassifier.TextClassification.Options, android.os.CancellationSignal, android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.TextClassification>);
    method public abstract void onGenerateLinks(java.lang.CharSequence, android.view.textclassifier.TextLinks.Options, android.os.CancellationSignal, android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.TextLinks>);
    method public void onSelectionEvent(android.view.textclassifier.SelectionEvent);
    method public abstract void onSuggestSelection(java.lang.CharSequence, int, int, android.view.textclassifier.TextSelection.Options, android.os.CancellationSignal, android.service.textclassifier.TextClassifierService.Callback<android.view.textclassifier.TextSelection>);
    field public static final java.lang.String SERVICE_INTERFACE = "android.service.textclassifier.TextClassifierService";
  }
+4 −1
Original line number Diff line number Diff line
@@ -19,13 +19,14 @@ package android.service.textclassifier;
import android.service.textclassifier.ITextClassificationCallback;
import android.service.textclassifier.ITextLinksCallback;
import android.service.textclassifier.ITextSelectionCallback;
import android.view.textclassifier.SelectionEvent;
import android.view.textclassifier.TextClassification;
import android.view.textclassifier.TextLinks;
import android.view.textclassifier.TextSelection;

/**
 * TextClassifierService binder interface.
 * See TextClassifier for interface documentation.
 * See TextClassifier (and TextClassifier.Logger) for interface documentation.
 * {@hide}
 */
oneway interface ITextClassifierService {
@@ -44,4 +45,6 @@ oneway interface ITextClassifierService {
            in CharSequence text,
            in TextLinks.Options options,
            in ITextLinksCallback c);

    void onSelectionEvent(in SelectionEvent event);
}
+16 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.os.IBinder;
import android.os.RemoteException;
import android.text.TextUtils;
import android.util.Slog;
import android.view.textclassifier.SelectionEvent;
import android.view.textclassifier.TextClassification;
import android.view.textclassifier.TextClassifier;
import android.view.textclassifier.TextLinks;
@@ -170,6 +171,12 @@ public abstract class TextClassifierService extends Service {
                        }
                    });
        }

        /** {@inheritDoc} */
        @Override
        public void onSelectionEvent(SelectionEvent event) throws RemoteException {
            TextClassifierService.this.onSelectionEvent(event);
        }
    };

    @Nullable
@@ -236,6 +243,15 @@ public abstract class TextClassifierService extends Service {
            @NonNull CancellationSignal cancellationSignal,
            @NonNull Callback<TextLinks> callback);

    /**
     * Writes the selection event.
     * This is called when a selection event occurs. e.g. user changed selection; or smart selection
     * happened.
     *
     * <p>The default implementation ignores the event.
     */
    public void onSelectionEvent(@NonNull SelectionEvent event) {}

    /**
     * Callbacks for TextClassifierService results.
     *
+1 −4
Original line number Diff line number Diff line
@@ -94,10 +94,7 @@ public abstract class Logger {
    }

    /**
     * Writes the selection event.
     *
     * <p><strong>NOTE: </strong>This method is designed for subclasses.
     * Apps should not call it directly.
     * Writes the selection event to a log.
     */
    public abstract void writeEvent(@NonNull SelectionEvent event);

Loading