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

Commit bc495089 authored by Nikita Dubrovsky's avatar Nikita Dubrovsky
Browse files

Rename RichContentReceiver.SOURCE_MENU to SOURCE_CLIPBOARD

Using "menu" was ambiguous since ACTION_PROCESS_TEXT is also triggered
via the menu but has its own enum value.

Bug: 152068298
Bug: 154151141
Test: ran tests
  atest CtsWidgetTestCases:TextViewRichContentReceiverTest
Change-Id: I3805577e9d7bbf55d40339d37820cd7f510da37e
parent a4c47c98
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -60573,9 +60573,9 @@ package android.widget {
    method public boolean onReceive(@NonNull T, @NonNull android.content.ClipData, int, int);
    field public static final int FLAG_CONVERT_TO_PLAIN_TEXT = 1; // 0x1
    field public static final int SOURCE_AUTOFILL = 3; // 0x3
    field public static final int SOURCE_CLIPBOARD = 0; // 0x0
    field public static final int SOURCE_DRAG_AND_DROP = 2; // 0x2
    field public static final int SOURCE_INPUT_METHOD = 1; // 0x1
    field public static final int SOURCE_MENU = 0; // 0x0
    field public static final int SOURCE_PROCESS_TEXT = 4; // 0x4
  }
+6 −6
Original line number Diff line number Diff line
@@ -74,16 +74,16 @@ public interface RichContentReceiver<T extends View> {
     *
     * @hide
     */
    @IntDef(prefix = {"SOURCE_"}, value = {SOURCE_MENU, SOURCE_INPUT_METHOD, SOURCE_DRAG_AND_DROP,
            SOURCE_AUTOFILL, SOURCE_PROCESS_TEXT})
    @IntDef(prefix = {"SOURCE_"}, value = {SOURCE_CLIPBOARD, SOURCE_INPUT_METHOD,
            SOURCE_DRAG_AND_DROP, SOURCE_AUTOFILL, SOURCE_PROCESS_TEXT})
    @Retention(RetentionPolicy.SOURCE)
    @interface Source {}

    /**
     * Specifies that the operation was triggered from the insertion/selection menu ("Paste" or
     * "Paste as plain text" action).
     * Specifies that the operation was triggered by a paste from the clipboard (e.g. "Paste" or
     * "Paste as plain text" action in the insertion/selection menu).
     */
    int SOURCE_MENU = 0;
    int SOURCE_CLIPBOARD = 0;

    /**
     * Specifies that the operation was triggered from the soft keyboard (also known as input method
@@ -131,7 +131,7 @@ public interface RichContentReceiver<T extends View> {
     * <p>For editable {@link TextView} components, this function will be invoked for the
     * following scenarios:
     * <ol>
     *     <li>Paste from the clipboard ("Paste" and "Paste as plain text" actions in the
     *     <li>Paste from the clipboard (e.g. "Paste" or "Paste as plain text" action in the
     *     insertion/selection menu)
     *     <li>Content insertion from the keyboard ({@link InputConnection#commitContent})
     *     <li>Drag and drop ({@link View#onDragEvent})
+2 −2
Original line number Diff line number Diff line
@@ -12843,7 +12843,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
            return;
        }
        int flags = withFormatting ? 0 : RichContentReceiver.FLAG_CONVERT_TO_PLAIN_TEXT;
        mRichContentReceiver.onReceive(this, clip, RichContentReceiver.SOURCE_MENU, flags);
        mRichContentReceiver.onReceive(this, clip, RichContentReceiver.SOURCE_CLIPBOARD, flags);
        sLastCutCopyOrTextChangedTime = 0;
    }
@@ -13649,7 +13649,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
     *
     * <p>This callback will be invoked for the following scenarios:
     * <ol>
     *     <li>Paste from the clipboard ("Paste" and "Paste as plain text" actions in the
     *     <li>Paste from the clipboard (e.g. "Paste" or "Paste as plain text" action in the
     *     insertion/selection menu)
     *     <li>Content insertion from the keyboard ({@link InputConnection#commitContent})
     *     <li>Drag and drop ({@link View#onDragEvent})