Merge changes I6e6f1600,Id45cee90

* changes:
  Add SOURCE_APP to OnReceiveContentCallback.Payload
  Removed duplicate javadocs from OnReceiveContentCallback.Payload fields
This commit is contained in:
Nikita Dubrovsky
2020-10-15 14:47:20 +00:00
committed by Android (Google) Code Review
3 changed files with 30 additions and 46 deletions

View File

@@ -53744,11 +53744,12 @@ package android.view {
method @Nullable public android.net.Uri getLinkUri();
method public int getSource();
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_PROCESS_TEXT = 4; // 0x4
field public static final int SOURCE_APP = 0; // 0x0
field public static final int SOURCE_AUTOFILL = 4; // 0x4
field public static final int SOURCE_CLIPBOARD = 1; // 0x1
field public static final int SOURCE_DRAG_AND_DROP = 3; // 0x3
field public static final int SOURCE_INPUT_METHOD = 2; // 0x2
field public static final int SOURCE_PROCESS_TEXT = 5; // 0x5
}
public static final class OnReceiveContentCallback.Payload.Builder {

View File

@@ -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;

View File

@@ -51871,11 +51871,12 @@ package android.view {
method @Nullable public android.net.Uri getLinkUri();
method public int getSource();
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_PROCESS_TEXT = 4; // 0x4
field public static final int SOURCE_APP = 0; // 0x0
field public static final int SOURCE_AUTOFILL = 4; // 0x4
field public static final int SOURCE_CLIPBOARD = 1; // 0x1
field public static final int SOURCE_DRAG_AND_DROP = 3; // 0x3
field public static final int SOURCE_INPUT_METHOD = 2; // 0x2
field public static final int SOURCE_PROCESS_TEXT = 5; // 0x5
}
public static final class OnReceiveContentCallback.Payload.Builder {