diff options
| author | Nikita Dubrovsky <dubrovsky@google.com> | 2020-10-15 14:47:20 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-10-15 14:47:20 +0000 |
| commit | 4e34109f323c45aa1f52d0e388a5ef58fd43ec5b (patch) | |
| tree | e28cad07c5b50c1a7fbcff4eaa8a083c163d46c7 /core/java/android | |
| parent | 14063a76bbd396ae700369051bdcc4dd38883fca (diff) | |
| parent | 835e120747e5d468e16f6ca5bf395031f97388da (diff) | |
Merge changes I6e6f1600,Id45cee90
* changes:
Add SOURCE_APP to OnReceiveContentCallback.Payload
Removed duplicate javadocs from OnReceiveContentCallback.Payload fields
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/view/OnReceiveContentCallback.java | 54 |
1 files changed, 18 insertions, 36 deletions
diff --git a/core/java/android/view/OnReceiveContentCallback.java b/core/java/android/view/OnReceiveContentCallback.java index 73bcb93d39d0..a217ff642ab7 100644 --- a/core/java/android/view/OnReceiveContentCallback.java +++ b/core/java/android/view/OnReceiveContentCallback.java @@ -134,46 +134,52 @@ public interface OnReceiveContentCallback<T extends View> { final class Payload { /** - * Specifies the UI through which content is being inserted. + * Specifies the UI through which content is being inserted. Future versions of Android may + * support additional values. * * @hide */ - @IntDef(prefix = {"SOURCE_"}, value = {SOURCE_CLIPBOARD, SOURCE_INPUT_METHOD, + @IntDef(prefix = {"SOURCE_"}, value = {SOURCE_APP, SOURCE_CLIPBOARD, SOURCE_INPUT_METHOD, SOURCE_DRAG_AND_DROP, SOURCE_AUTOFILL, SOURCE_PROCESS_TEXT}) @Retention(RetentionPolicy.SOURCE) public @interface Source {} /** + * Specifies that the operation was triggered by the app that contains the target view. + */ + public static final int SOURCE_APP = 0; + + /** * 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). */ - public static final int SOURCE_CLIPBOARD = 0; + public static final int SOURCE_CLIPBOARD = 1; /** * Specifies that the operation was triggered from the soft keyboard (also known as input * method editor or IME). See https://developer.android.com/guide/topics/text/image-keyboard * for more info. */ - public static final int SOURCE_INPUT_METHOD = 1; + public static final int SOURCE_INPUT_METHOD = 2; /** * Specifies that the operation was triggered by the drag/drop framework. See * https://developer.android.com/guide/topics/ui/drag-drop for more info. */ - public static final int SOURCE_DRAG_AND_DROP = 2; + public static final int SOURCE_DRAG_AND_DROP = 3; /** * Specifies that the operation was triggered by the autofill framework. See * https://developer.android.com/guide/topics/text/autofill for more info. */ - public static final int SOURCE_AUTOFILL = 3; + public static final int SOURCE_AUTOFILL = 4; /** * Specifies that the operation was triggered by a result from a * {@link android.content.Intent#ACTION_PROCESS_TEXT PROCESS_TEXT} action in the selection * menu. */ - public static final int SOURCE_PROCESS_TEXT = 4; + public static final int SOURCE_PROCESS_TEXT = 5; /** * Returns the symbolic name of the given source. @@ -182,6 +188,7 @@ public interface OnReceiveContentCallback<T extends View> { */ static String sourceToString(@Source int source) { switch (source) { + case SOURCE_APP: return "SOURCE_APP"; case SOURCE_CLIPBOARD: return "SOURCE_CLIPBOARD"; case SOURCE_INPUT_METHOD: return "SOURCE_INPUT_METHOD"; case SOURCE_DRAG_AND_DROP: return "SOURCE_DRAG_AND_DROP"; @@ -217,37 +224,11 @@ public interface OnReceiveContentCallback<T extends View> { return String.valueOf(flags); } - /** - * The data to be inserted. - */ @NonNull private final ClipData mClip; - - /** - * The source of the operation. See {@code SOURCE_} constants. - */ private final @Source int mSource; - - /** - * Optional flags that control the insertion behavior. See {@code FLAG_} constants. - */ private final @Flags int mFlags; - - /** - * Optional http/https URI for the content that may be provided by the IME. This is only - * populated if the source is {@link #SOURCE_INPUT_METHOD} and if a non-empty - * {@link android.view.inputmethod.InputContentInfo#getLinkUri linkUri} was passed by the - * IME. - */ - @Nullable - private final Uri mLinkUri; - - /** - * Optional additional metadata. If the source is {@link #SOURCE_INPUT_METHOD}, this will - * include the {@link android.view.inputmethod.InputConnection#commitContent opts} passed by - * the IME. - */ - @Nullable - private final Bundle mExtras; + @Nullable private final Uri mLinkUri; + @Nullable private final Bundle mExtras; private Payload(Builder b) { this.mClip = Objects.requireNonNull(b.mClip); @@ -278,7 +259,8 @@ public interface OnReceiveContentCallback<T extends View> { } /** - * The source of the operation. See {@code SOURCE_} constants. + * The source of the operation. See {@code SOURCE_} constants. Future versions of Android + * may pass additional values. */ public @Source int getSource() { return mSource; |
