Merge "Rename getOnReceiveContentMimeTypes (drop "On")" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2bb75a4007
@@ -7712,7 +7712,7 @@ package android.app.assist {
|
|||||||
method public int getMaxTextEms();
|
method public int getMaxTextEms();
|
||||||
method public int getMaxTextLength();
|
method public int getMaxTextLength();
|
||||||
method public int getMinTextEms();
|
method public int getMinTextEms();
|
||||||
method @Nullable public String[] getOnReceiveContentMimeTypes();
|
method @Nullable public String[] getReceiveContentMimeTypes();
|
||||||
method public int getScrollX();
|
method public int getScrollX();
|
||||||
method public int getScrollY();
|
method public int getScrollY();
|
||||||
method @Nullable public CharSequence getText();
|
method @Nullable public CharSequence getText();
|
||||||
@@ -48649,7 +48649,6 @@ package android.view {
|
|||||||
method @IdRes public int getNextFocusRightId();
|
method @IdRes public int getNextFocusRightId();
|
||||||
method @IdRes public int getNextFocusUpId();
|
method @IdRes public int getNextFocusUpId();
|
||||||
method public android.view.View.OnFocusChangeListener getOnFocusChangeListener();
|
method public android.view.View.OnFocusChangeListener getOnFocusChangeListener();
|
||||||
method @Nullable public String[] getOnReceiveContentMimeTypes();
|
|
||||||
method @ColorInt public int getOutlineAmbientShadowColor();
|
method @ColorInt public int getOutlineAmbientShadowColor();
|
||||||
method public android.view.ViewOutlineProvider getOutlineProvider();
|
method public android.view.ViewOutlineProvider getOutlineProvider();
|
||||||
method @ColorInt public int getOutlineSpotShadowColor();
|
method @ColorInt public int getOutlineSpotShadowColor();
|
||||||
@@ -48666,6 +48665,7 @@ package android.view {
|
|||||||
method public float getPivotX();
|
method public float getPivotX();
|
||||||
method public float getPivotY();
|
method public float getPivotY();
|
||||||
method public android.view.PointerIcon getPointerIcon();
|
method public android.view.PointerIcon getPointerIcon();
|
||||||
|
method @Nullable public String[] getReceiveContentMimeTypes();
|
||||||
method public android.content.res.Resources getResources();
|
method public android.content.res.Resources getResources();
|
||||||
method public final boolean getRevealOnFocusHint();
|
method public final boolean getRevealOnFocusHint();
|
||||||
method public final int getRight();
|
method public final int getRight();
|
||||||
@@ -49845,8 +49845,8 @@ package android.view {
|
|||||||
method public void setMaxTextEms(int);
|
method public void setMaxTextEms(int);
|
||||||
method public void setMaxTextLength(int);
|
method public void setMaxTextLength(int);
|
||||||
method public void setMinTextEms(int);
|
method public void setMinTextEms(int);
|
||||||
method public void setOnReceiveContentMimeTypes(@Nullable String[]);
|
|
||||||
method public abstract void setOpaque(boolean);
|
method public abstract void setOpaque(boolean);
|
||||||
|
method public void setReceiveContentMimeTypes(@Nullable String[]);
|
||||||
method public abstract void setSelected(boolean);
|
method public abstract void setSelected(boolean);
|
||||||
method public abstract void setText(CharSequence);
|
method public abstract void setText(CharSequence);
|
||||||
method public abstract void setText(CharSequence, int, int);
|
method public abstract void setText(CharSequence, int, int);
|
||||||
|
|||||||
@@ -717,7 +717,7 @@ public class AssistStructure implements Parcelable {
|
|||||||
String mWebDomain;
|
String mWebDomain;
|
||||||
Bundle mExtras;
|
Bundle mExtras;
|
||||||
LocaleList mLocaleList;
|
LocaleList mLocaleList;
|
||||||
String[] mOnReceiveContentMimeTypes;
|
String[] mReceiveContentMimeTypes;
|
||||||
|
|
||||||
ViewNode[] mChildren;
|
ViewNode[] mChildren;
|
||||||
|
|
||||||
@@ -884,7 +884,7 @@ public class AssistStructure implements Parcelable {
|
|||||||
mLocaleList = in.readParcelable(null);
|
mLocaleList = in.readParcelable(null);
|
||||||
}
|
}
|
||||||
if ((flags & FLAGS_HAS_MIME_TYPES) != 0) {
|
if ((flags & FLAGS_HAS_MIME_TYPES) != 0) {
|
||||||
mOnReceiveContentMimeTypes = in.readStringArray();
|
mReceiveContentMimeTypes = in.readStringArray();
|
||||||
}
|
}
|
||||||
if ((flags&FLAGS_HAS_EXTRAS) != 0) {
|
if ((flags&FLAGS_HAS_EXTRAS) != 0) {
|
||||||
mExtras = in.readBundle();
|
mExtras = in.readBundle();
|
||||||
@@ -945,7 +945,7 @@ public class AssistStructure implements Parcelable {
|
|||||||
if (mLocaleList != null) {
|
if (mLocaleList != null) {
|
||||||
flags |= FLAGS_HAS_LOCALE_LIST;
|
flags |= FLAGS_HAS_LOCALE_LIST;
|
||||||
}
|
}
|
||||||
if (mOnReceiveContentMimeTypes != null) {
|
if (mReceiveContentMimeTypes != null) {
|
||||||
flags |= FLAGS_HAS_MIME_TYPES;
|
flags |= FLAGS_HAS_MIME_TYPES;
|
||||||
}
|
}
|
||||||
if (mExtras != null) {
|
if (mExtras != null) {
|
||||||
@@ -1119,7 +1119,7 @@ public class AssistStructure implements Parcelable {
|
|||||||
out.writeParcelable(mLocaleList, 0);
|
out.writeParcelable(mLocaleList, 0);
|
||||||
}
|
}
|
||||||
if ((flags & FLAGS_HAS_MIME_TYPES) != 0) {
|
if ((flags & FLAGS_HAS_MIME_TYPES) != 0) {
|
||||||
out.writeStringArray(mOnReceiveContentMimeTypes);
|
out.writeStringArray(mReceiveContentMimeTypes);
|
||||||
}
|
}
|
||||||
if ((flags&FLAGS_HAS_EXTRAS) != 0) {
|
if ((flags&FLAGS_HAS_EXTRAS) != 0) {
|
||||||
out.writeBundle(mExtras);
|
out.writeBundle(mExtras);
|
||||||
@@ -1540,12 +1540,12 @@ public class AssistStructure implements Parcelable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the MIME types accepted by {@link View#performReceiveContent} for this view. See
|
* Returns the MIME types accepted by {@link View#performReceiveContent} for this view. See
|
||||||
* {@link View#getOnReceiveContentMimeTypes()} for details.
|
* {@link View#getReceiveContentMimeTypes()} for details.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
@SuppressLint("NullableCollection")
|
@SuppressLint("NullableCollection")
|
||||||
public String[] getOnReceiveContentMimeTypes() {
|
public String[] getReceiveContentMimeTypes() {
|
||||||
return mOnReceiveContentMimeTypes;
|
return mReceiveContentMimeTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2168,8 +2168,8 @@ public class AssistStructure implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setOnReceiveContentMimeTypes(@Nullable String[] mimeTypes) {
|
public void setReceiveContentMimeTypes(@Nullable String[] mimeTypes) {
|
||||||
mNode.mOnReceiveContentMimeTypes = mimeTypes;
|
mNode.mReceiveContentMimeTypes = mimeTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2449,7 +2449,7 @@ public class AssistStructure implements Parcelable {
|
|||||||
if (localeList != null) {
|
if (localeList != null) {
|
||||||
Log.i(TAG, prefix + " LocaleList: " + localeList);
|
Log.i(TAG, prefix + " LocaleList: " + localeList);
|
||||||
}
|
}
|
||||||
String[] mimeTypes = node.getOnReceiveContentMimeTypes();
|
String[] mimeTypes = node.getReceiveContentMimeTypes();
|
||||||
if (mimeTypes != null) {
|
if (mimeTypes != null) {
|
||||||
Log.i(TAG, prefix + " MIME types: " + Arrays.toString(mimeTypes));
|
Log.i(TAG, prefix + " MIME types: " + Arrays.toString(mimeTypes));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5255,7 +5255,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
int mUnbufferedInputSource = InputDevice.SOURCE_CLASS_NONE;
|
int mUnbufferedInputSource = InputDevice.SOURCE_CLASS_NONE;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private String[] mOnReceiveContentMimeTypes;
|
private String[] mReceiveContentMimeTypes;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private ViewTranslationCallback mViewTranslationCallback;
|
private ViewTranslationCallback mViewTranslationCallback;
|
||||||
@@ -8847,7 +8847,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
structure.setAutofillValue(getAutofillValue());
|
structure.setAutofillValue(getAutofillValue());
|
||||||
}
|
}
|
||||||
structure.setImportantForAutofill(getImportantForAutofill());
|
structure.setImportantForAutofill(getImportantForAutofill());
|
||||||
structure.setOnReceiveContentMimeTypes(getOnReceiveContentMimeTypes());
|
structure.setReceiveContentMimeTypes(getReceiveContentMimeTypes());
|
||||||
}
|
}
|
||||||
|
|
||||||
int ignoredParentLeft = 0;
|
int ignoredParentLeft = 0;
|
||||||
@@ -9066,7 +9066,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
Preconditions.checkArgument(Arrays.stream(mimeTypes).noneMatch(t -> t.startsWith("*")),
|
Preconditions.checkArgument(Arrays.stream(mimeTypes).noneMatch(t -> t.startsWith("*")),
|
||||||
"A MIME type set here must not start with *: " + Arrays.toString(mimeTypes));
|
"A MIME type set here must not start with *: " + Arrays.toString(mimeTypes));
|
||||||
}
|
}
|
||||||
mOnReceiveContentMimeTypes = ArrayUtils.isEmpty(mimeTypes) ? null : mimeTypes;
|
mReceiveContentMimeTypes = ArrayUtils.isEmpty(mimeTypes) ? null : mimeTypes;
|
||||||
getListenerInfo().mOnReceiveContentListener = listener;
|
getListenerInfo().mOnReceiveContentListener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9134,8 +9134,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
*/
|
*/
|
||||||
@SuppressLint("NullableCollection")
|
@SuppressLint("NullableCollection")
|
||||||
@Nullable
|
@Nullable
|
||||||
public String[] getOnReceiveContentMimeTypes() {
|
public String[] getReceiveContentMimeTypes() {
|
||||||
return mOnReceiveContentMimeTypes;
|
return mReceiveContentMimeTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -373,12 +373,12 @@ public abstract class ViewStructure {
|
|||||||
public void setImportantForAutofill(@AutofillImportance int mode) {}
|
public void setImportantForAutofill(@AutofillImportance int mode) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the MIME types accepted by this view. See {@link View#getOnReceiveContentMimeTypes()}.
|
* Sets the MIME types accepted by this view. See {@link View#getReceiveContentMimeTypes()}.
|
||||||
*
|
*
|
||||||
* <p>Should only be set when the node is used for Autofill or Content Capture purposes - it
|
* <p>Should only be set when the node is used for Autofill or Content Capture purposes - it
|
||||||
* will be ignored when used for Assist.
|
* will be ignored when used for Assist.
|
||||||
*/
|
*/
|
||||||
public void setOnReceiveContentMimeTypes(
|
public void setReceiveContentMimeTypes(
|
||||||
@SuppressLint("NullableCollection") @Nullable String[] mimeTypes) {}
|
@SuppressLint("NullableCollection") @Nullable String[] mimeTypes) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ public final class ViewNode extends AssistStructure.ViewNode {
|
|||||||
private String[] mAutofillHints;
|
private String[] mAutofillHints;
|
||||||
private AutofillValue mAutofillValue;
|
private AutofillValue mAutofillValue;
|
||||||
private CharSequence[] mAutofillOptions;
|
private CharSequence[] mAutofillOptions;
|
||||||
private String[] mOnReceiveContentMimeTypes;
|
private String[] mReceiveContentMimeTypes;
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public ViewNode() {
|
public ViewNode() {
|
||||||
@@ -172,7 +172,7 @@ public final class ViewNode extends AssistStructure.ViewNode {
|
|||||||
mLocaleList = parcel.readParcelable(null);
|
mLocaleList = parcel.readParcelable(null);
|
||||||
}
|
}
|
||||||
if ((nodeFlags & FLAGS_HAS_MIME_TYPES) != 0) {
|
if ((nodeFlags & FLAGS_HAS_MIME_TYPES) != 0) {
|
||||||
mOnReceiveContentMimeTypes = parcel.readStringArray();
|
mReceiveContentMimeTypes = parcel.readStringArray();
|
||||||
}
|
}
|
||||||
if ((nodeFlags & FLAGS_HAS_INPUT_TYPE) != 0) {
|
if ((nodeFlags & FLAGS_HAS_INPUT_TYPE) != 0) {
|
||||||
mInputType = parcel.readInt();
|
mInputType = parcel.readInt();
|
||||||
@@ -470,8 +470,8 @@ public final class ViewNode extends AssistStructure.ViewNode {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public String[] getOnReceiveContentMimeTypes() {
|
public String[] getReceiveContentMimeTypes() {
|
||||||
return mOnReceiveContentMimeTypes;
|
return mReceiveContentMimeTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@@ -519,7 +519,7 @@ public final class ViewNode extends AssistStructure.ViewNode {
|
|||||||
if (mLocaleList != null) {
|
if (mLocaleList != null) {
|
||||||
nodeFlags |= FLAGS_HAS_LOCALE_LIST;
|
nodeFlags |= FLAGS_HAS_LOCALE_LIST;
|
||||||
}
|
}
|
||||||
if (mOnReceiveContentMimeTypes != null) {
|
if (mReceiveContentMimeTypes != null) {
|
||||||
nodeFlags |= FLAGS_HAS_MIME_TYPES;
|
nodeFlags |= FLAGS_HAS_MIME_TYPES;
|
||||||
}
|
}
|
||||||
if (mInputType != 0) {
|
if (mInputType != 0) {
|
||||||
@@ -599,7 +599,7 @@ public final class ViewNode extends AssistStructure.ViewNode {
|
|||||||
parcel.writeParcelable(mLocaleList, 0);
|
parcel.writeParcelable(mLocaleList, 0);
|
||||||
}
|
}
|
||||||
if ((nodeFlags & FLAGS_HAS_MIME_TYPES) != 0) {
|
if ((nodeFlags & FLAGS_HAS_MIME_TYPES) != 0) {
|
||||||
parcel.writeStringArray(mOnReceiveContentMimeTypes);
|
parcel.writeStringArray(mReceiveContentMimeTypes);
|
||||||
}
|
}
|
||||||
if ((nodeFlags & FLAGS_HAS_INPUT_TYPE) != 0) {
|
if ((nodeFlags & FLAGS_HAS_INPUT_TYPE) != 0) {
|
||||||
parcel.writeInt(mInputType);
|
parcel.writeInt(mInputType);
|
||||||
@@ -929,8 +929,8 @@ public final class ViewNode extends AssistStructure.ViewNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setOnReceiveContentMimeTypes(@Nullable String[] mimeTypes) {
|
public void setReceiveContentMimeTypes(@Nullable String[] mimeTypes) {
|
||||||
mNode.mOnReceiveContentMimeTypes = mimeTypes;
|
mNode.mReceiveContentMimeTypes = mimeTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -938,12 +938,12 @@ public class BaseInputConnection implements InputConnection {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Default implementation which invokes {@link View#performReceiveContent} on the target
|
* Default implementation which invokes {@link View#performReceiveContent} on the target
|
||||||
* view if the view {@link View#getOnReceiveContentMimeTypes allows} content insertion;
|
* view if the view {@link View#getReceiveContentMimeTypes allows} content insertion;
|
||||||
* otherwise returns false without any side effects.
|
* otherwise returns false without any side effects.
|
||||||
*/
|
*/
|
||||||
public boolean commitContent(InputContentInfo inputContentInfo, int flags, Bundle opts) {
|
public boolean commitContent(InputContentInfo inputContentInfo, int flags, Bundle opts) {
|
||||||
ClipDescription description = inputContentInfo.getDescription();
|
ClipDescription description = inputContentInfo.getDescription();
|
||||||
if (mTargetView.getOnReceiveContentMimeTypes() == null) {
|
if (mTargetView.getReceiveContentMimeTypes() == null) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.d(TAG, "Can't insert content from IME: content=" + description);
|
Log.d(TAG, "Can't insert content from IME: content=" + description);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8773,7 +8773,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
outAttrs.initialSelEnd = getSelectionEnd();
|
outAttrs.initialSelEnd = getSelectionEnd();
|
||||||
outAttrs.initialCapsMode = ic.getCursorCapsMode(getInputType());
|
outAttrs.initialCapsMode = ic.getCursorCapsMode(getInputType());
|
||||||
outAttrs.setInitialSurroundingText(mText);
|
outAttrs.setInitialSurroundingText(mText);
|
||||||
outAttrs.contentMimeTypes = getOnReceiveContentMimeTypes();
|
outAttrs.contentMimeTypes = getReceiveContentMimeTypes();
|
||||||
return ic;
|
return ic;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11741,10 +11741,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String[] mimeTypes = getOnReceiveContentMimeTypes();
|
String[] mimeTypes = getReceiveContentMimeTypes();
|
||||||
if (mimeTypes == null && mEditor != null) {
|
if (mimeTypes == null && mEditor != null) {
|
||||||
// If the app hasn't set a listener for receiving content on this view (ie,
|
// If the app hasn't set a listener for receiving content on this view (ie,
|
||||||
// getOnReceiveContentMimeTypes() returns null), check if it implements the
|
// getReceiveContentMimeTypes() returns null), check if it implements the
|
||||||
// keyboard image API and, if possible, use those MIME types as fallback.
|
// keyboard image API and, if possible, use those MIME types as fallback.
|
||||||
// This fallback is only in place for autofill, not other mechanisms for
|
// This fallback is only in place for autofill, not other mechanisms for
|
||||||
// inserting content. See AUTOFILL_NON_TEXT_REQUIRES_ON_RECEIVE_CONTENT_LISTENER
|
// inserting content. See AUTOFILL_NON_TEXT_REQUIRES_ON_RECEIVE_CONTENT_LISTENER
|
||||||
@@ -11752,7 +11752,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
mimeTypes = mEditor.getDefaultOnReceiveContentListener()
|
mimeTypes = mEditor.getDefaultOnReceiveContentListener()
|
||||||
.getFallbackMimeTypesForAutofill(this);
|
.getFallbackMimeTypesForAutofill(this);
|
||||||
}
|
}
|
||||||
structure.setOnReceiveContentMimeTypes(mimeTypes);
|
structure.setReceiveContentMimeTypes(mimeTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isPassword || viewFor == VIEW_STRUCTURE_FOR_AUTOFILL
|
if (!isPassword || viewFor == VIEW_STRUCTURE_FOR_AUTOFILL
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ public final class TextViewOnReceiveContentListener implements OnReceiveContentL
|
|||||||
* non-text content.
|
* non-text content.
|
||||||
*/
|
*/
|
||||||
private static boolean isUsageOfImeCommitContentEnabled(@NonNull View view) {
|
private static boolean isUsageOfImeCommitContentEnabled(@NonNull View view) {
|
||||||
if (view.getOnReceiveContentMimeTypes() != null) {
|
if (view.getReceiveContentMimeTypes() != null) {
|
||||||
if (Log.isLoggable(LOG_TAG, Log.VERBOSE)) {
|
if (Log.isLoggable(LOG_TAG, Log.VERBOSE)) {
|
||||||
Log.v(LOG_TAG, "Fallback to commitContent disabled (custom callback is set)");
|
Log.v(LOG_TAG, "Fallback to commitContent disabled (custom callback is set)");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,12 +61,12 @@ import org.mockito.Mockito;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link TextViewOnReceiveContentListener}. Most of the test cases are in the CTS test
|
* Tests for {@link TextViewOnReceiveContentListener}. Most of the test cases are in the CTS test
|
||||||
* {@link android.widget.cts.TextViewOnReceiveContentTest}. This class tests some internal
|
* {@link android.widget.cts.TextViewReceiveContentTest}. This class tests some internal
|
||||||
* implementation details, e.g. fallback to the keyboard image API.
|
* implementation details, e.g. fallback to the keyboard image API.
|
||||||
*/
|
*/
|
||||||
@MediumTest
|
@MediumTest
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class TextViewOnReceiveContentTest {
|
public class TextViewReceiveContentTest {
|
||||||
private static final Uri SAMPLE_CONTENT_URI = Uri.parse("content://com.example/path");
|
private static final Uri SAMPLE_CONTENT_URI = Uri.parse("content://com.example/path");
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
Reference in New Issue
Block a user