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

Commit 21e8dcb3 authored by Felipe Leme's avatar Felipe Leme
Browse files

Removed ContentCaptureSession.FLAG_USER_INPUT.

This flag was meant to indicate when a text was changed by the user (for example, using IME), but
that information is not readly available and would require changes in too many parts of the system,
so it's not worth the effort (at least for now...).

Test: m update-api
Test: atest CtsContentCaptureServiceTestCases \
      FrameworksCoreTests:android.view.contentcapture.ContentCaptureSessionTest

Fixes: 121045053

Change-Id: Ifcdd5e5bb0c6c5c0f840fe0bbdbda8eca9bdb479
parent 793f1a79
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -52681,7 +52681,6 @@ package android.view.contentcapture {
    method public final void notifyViewDisappeared(android.view.autofill.AutofillId);
    method public final void notifyViewTextChanged(android.view.autofill.AutofillId, java.lang.CharSequence, int);
    method public final void notifyViewsDisappeared(android.view.autofill.AutofillId, int[]);
    field public static final int FLAG_USER_INPUT = 1; // 0x1
  }
  public final class ContentCaptureSessionId implements android.os.Parcelable {
+0 −1
Original line number Diff line number Diff line
@@ -8311,7 +8311,6 @@ package android.view.contentcapture {
  public final class ContentCaptureEvent implements android.os.Parcelable {
    method public int describeContents();
    method public long getEventTime();
    method public int getFlags();
    method public android.view.autofill.AutofillId getId();
    method public java.lang.CharSequence getText();
    method public int getType();
+2 −3
Original line number Diff line number Diff line
@@ -88,9 +88,8 @@ final class ChildContentCaptureSession extends ContentCaptureSession {
    }

    @Override
    void internalNotifyViewTextChanged(@NonNull AutofillId id, @Nullable CharSequence text,
            int flags) {
        getMainCaptureSession().notifyViewTextChanged(mId, id, text, flags);
    void internalNotifyViewTextChanged(@NonNull AutofillId id, @Nullable CharSequence text) {
        getMainCaptureSession().notifyViewTextChanged(mId, id, text);
    }

    @Override
+3 −29
Original line number Diff line number Diff line
@@ -74,7 +74,6 @@ public final class ContentCaptureEvent implements Parcelable {
    private final @NonNull String mSessionId;
    private final int mType;
    private final long mEventTime;
    private final int mFlags;
    private @Nullable AutofillId mId;
    private @Nullable ViewNode mNode;
    private @Nullable CharSequence mText;
@@ -82,21 +81,15 @@ public final class ContentCaptureEvent implements Parcelable {
    private @Nullable ContentCaptureContext mClientContext;

    /** @hide */
    public ContentCaptureEvent(@NonNull String sessionId, int type, long eventTime, int flags) {
    public ContentCaptureEvent(@NonNull String sessionId, int type, long eventTime) {
        mSessionId = sessionId;
        mType = type;
        mEventTime = eventTime;
        mFlags = flags;
    }

    /** @hide */
    public ContentCaptureEvent(@NonNull String sessionId, int type, int flags) {
        this(sessionId, type, System.currentTimeMillis(), flags);
    }

    /** @hide */
    public ContentCaptureEvent(@NonNull String sessionId, int type) {
        this(sessionId, type, /* flags= */ 0);
        this(sessionId, type, System.currentTimeMillis());
    }

    /** @hide */
@@ -182,16 +175,6 @@ public final class ContentCaptureEvent implements Parcelable {
        return mEventTime;
    }

    /**
     * Gets optional flags associated with the event.
     *
     * @return either {@code 0} or
     * {@link android.view.contentcapture.ContentCaptureSession#FLAG_USER_INPUT}.
     */
    public int getFlags() {
        return mFlags;
    }

    /**
     * Gets the whole metadata of the node associated with the event.
     *
@@ -226,9 +209,6 @@ public final class ContentCaptureEvent implements Parcelable {
    public void dump(@NonNull PrintWriter pw) {
        pw.print("type="); pw.print(getTypeAsString(mType));
        pw.print(", time="); pw.print(mEventTime);
        if (mFlags > 0) {
            pw.print(", flags="); pw.print(mFlags);
        }
        if (mId != null) {
            pw.print(", id="); pw.print(mId);
        }
@@ -255,9 +235,6 @@ public final class ContentCaptureEvent implements Parcelable {
        if (mType == TYPE_SESSION_STARTED && mParentSessionId != null) {
            string.append(", parent=").append(mParentSessionId);
        }
        if (mFlags > 0) {
            string.append(", flags=").append(mFlags);
        }
        if (mId != null) {
            string.append(", id=").append(mId);
        }
@@ -281,7 +258,6 @@ public final class ContentCaptureEvent implements Parcelable {
        parcel.writeString(mSessionId);
        parcel.writeInt(mType);
        parcel.writeLong(mEventTime);
        parcel.writeInt(mFlags);
        parcel.writeParcelable(mId, flags);
        ViewNode.writeToParcel(parcel, mNode, flags);
        parcel.writeCharSequence(mText);
@@ -301,9 +277,7 @@ public final class ContentCaptureEvent implements Parcelable {
            final String sessionId = parcel.readString();
            final int type = parcel.readInt();
            final long eventTime  = parcel.readLong();
            final int flags = parcel.readInt();
            final ContentCaptureEvent event =
                    new ContentCaptureEvent(sessionId, type, eventTime, flags);
            final ContentCaptureEvent event = new ContentCaptureEvent(sessionId, type, eventTime);
            final AutofillId id = parcel.readParcelable(null);
            if (id != null) {
                event.setAutofillId(id);
+4 −11
Original line number Diff line number Diff line
@@ -50,12 +50,6 @@ public abstract class ContentCaptureSession implements AutoCloseable {

    private static final String TAG = ContentCaptureSession.class.getSimpleName();

    /**
     * Used on {@link #notifyViewTextChanged(AutofillId, CharSequence, int)} to indicate that the
     * text change was caused by user input (for example, through IME).
     */
    public static final int FLAG_USER_INPUT = 0x1;

    /**
     * Initial state, when there is no session.
     *
@@ -375,8 +369,7 @@ public abstract class ContentCaptureSession implements AutoCloseable {
     *
     * @param id of the node.
     * @param text new text.
     * @param flags either {@code 0} or {@link #FLAG_USER_INPUT} when the value was explicitly
     * changed by the user (for example, through the keyboard).
     * @param flags currently ignored.
     */
    public final void notifyViewTextChanged(@NonNull AutofillId id, @Nullable CharSequence text,
            int flags) {
@@ -384,11 +377,11 @@ public abstract class ContentCaptureSession implements AutoCloseable {

        if (!isContentCaptureEnabled()) return;

        internalNotifyViewTextChanged(id, text, flags);
        internalNotifyViewTextChanged(id, text);
    }

    abstract void internalNotifyViewTextChanged(@NonNull AutofillId id, @Nullable CharSequence text,
            int flags);
    abstract void internalNotifyViewTextChanged(@NonNull AutofillId id,
            @Nullable CharSequence text);

    /**
     * Creates a {@link ViewStructure} for a "standard" view.
Loading