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

Commit 19d37240 authored by Nikita Dubrovsky's avatar Nikita Dubrovsky Committed by Android (Google) Code Review
Browse files

Merge "Add MIME types to ViewStructure and autofill/cc ViewNode classes"

parents 9e4b9c84 e8f7c4ba
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -7492,6 +7492,7 @@ package android.app.assist {
    method public int getMaxTextEms();
    method public int getMaxTextLength();
    method public int getMinTextEms();
    method @Nullable public String[] getOnReceiveContentMimeTypes();
    method public int getScrollX();
    method public int getScrollY();
    method @Nullable public CharSequence getText();
@@ -48764,6 +48765,7 @@ package android.view {
    method public void setMaxTextEms(int);
    method public void setMaxTextLength(int);
    method public void setMinTextEms(int);
    method public void setOnReceiveContentMimeTypes(@Nullable String[]);
    method public abstract void setOpaque(boolean);
    method public abstract void setSelected(boolean);
    method public abstract void setText(CharSequence);
+29 −0
Original line number Diff line number Diff line
@@ -672,6 +672,7 @@ public class AssistStructure implements Parcelable {
        static final int FLAGS_CONTEXT_CLICKABLE = 0x00004000;
        static final int FLAGS_OPAQUE = 0x00008000;

        static final int FLAGS_HAS_MIME_TYPES = 0x80000000;
        static final int FLAGS_HAS_MATRIX = 0x40000000;
        static final int FLAGS_HAS_ALPHA = 0x20000000;
        static final int FLAGS_HAS_ELEVATION = 0x10000000;
@@ -715,6 +716,7 @@ public class AssistStructure implements Parcelable {
        String mWebDomain;
        Bundle mExtras;
        LocaleList mLocaleList;
        String[] mOnReceiveContentMimeTypes;

        ViewNode[] mChildren;

@@ -880,6 +882,9 @@ public class AssistStructure implements Parcelable {
            if ((flags&FLAGS_HAS_LOCALE_LIST) != 0) {
                mLocaleList = in.readParcelable(null);
            }
            if ((flags & FLAGS_HAS_MIME_TYPES) != 0) {
                mOnReceiveContentMimeTypes = in.readStringArray();
            }
            if ((flags&FLAGS_HAS_EXTRAS) != 0) {
                mExtras = in.readBundle();
            }
@@ -939,6 +944,9 @@ public class AssistStructure implements Parcelable {
            if (mLocaleList != null) {
                flags |= FLAGS_HAS_LOCALE_LIST;
            }
            if (mOnReceiveContentMimeTypes != null) {
                flags |= FLAGS_HAS_MIME_TYPES;
            }
            if (mExtras != null) {
                flags |= FLAGS_HAS_EXTRAS;
            }
@@ -1109,6 +1117,9 @@ public class AssistStructure implements Parcelable {
            if ((flags&FLAGS_HAS_LOCALE_LIST) != 0) {
                out.writeParcelable(mLocaleList, 0);
            }
            if ((flags & FLAGS_HAS_MIME_TYPES) != 0) {
                out.writeStringArray(mOnReceiveContentMimeTypes);
            }
            if ((flags&FLAGS_HAS_EXTRAS) != 0) {
                out.writeBundle(mExtras);
            }
@@ -1526,6 +1537,15 @@ public class AssistStructure implements Parcelable {
            return mLocaleList;
        }

        /**
         * Returns the MIME types accepted by {@link View#performReceiveContent} for this view. See
         * {@link View#getOnReceiveContentMimeTypes()} for details.
         */
        @Nullable
        public String[] getOnReceiveContentMimeTypes() {
            return mOnReceiveContentMimeTypes;
        }

        /**
         * Returns any text associated with the node that is displayed to the user, or null
         * if there is none.
@@ -2145,6 +2165,11 @@ public class AssistStructure implements Parcelable {
            mNode.mImportantForAutofill = mode;
        }

        @Override
        public void setOnReceiveContentMimeTypes(@Nullable String[] mimeTypes) {
            mNode.mOnReceiveContentMimeTypes = mimeTypes;
        }

        @Override
        public void setInputType(int inputType) {
            mNode.mInputType = inputType;
@@ -2422,6 +2447,10 @@ public class AssistStructure implements Parcelable {
        if (localeList != null) {
            Log.i(TAG, prefix + "  LocaleList: " + localeList);
        }
        String[] mimeTypes = node.getOnReceiveContentMimeTypes();
        if (mimeTypes != null) {
            Log.i(TAG, prefix + "  MIME types: " + Arrays.toString(mimeTypes));
        }
        String hint = node.getHint();
        if (hint != null) {
            Log.i(TAG, prefix + "  Hint: " + hint);
+1 −0
Original line number Diff line number Diff line
@@ -8821,6 +8821,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                structure.setAutofillValue(getAutofillValue());
            }
            structure.setImportantForAutofill(getImportantForAutofill());
            structure.setOnReceiveContentMimeTypes(getOnReceiveContentMimeTypes());
        }
        int ignoredParentLeft = 0;
+8 −0
Original line number Diff line number Diff line
@@ -371,6 +371,14 @@ public abstract class ViewStructure {
     */
    public void setImportantForAutofill(@AutofillImportance int mode) {}

    /**
     * Sets the MIME types accepted by this view. See {@link View#getOnReceiveContentMimeTypes()}.
     *
     * <p>Should only be set when the node is used for Autofill or Content Capture purposes - it
     * will be ignored when used for Assist.
     */
    public void setOnReceiveContentMimeTypes(@Nullable String[] mimeTypes) {}

    /**
     * Sets the {@link android.text.InputType} bits of this node.
     *
+22 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ public final class ViewNode extends AssistStructure.ViewNode {
    private static final long FLAGS_HAS_AUTOFILL_HINTS = 1L << 33;
    private static final long FLAGS_HAS_AUTOFILL_OPTIONS = 1L << 34;
    private static final long FLAGS_HAS_HINT_ID_ENTRY = 1L << 35;
    private static final long FLAGS_HAS_MIME_TYPES = 1L << 36;

    /** Flags used to optimize what's written to the parcel */
    private long mFlags;
@@ -113,6 +114,7 @@ public final class ViewNode extends AssistStructure.ViewNode {
    private String[] mAutofillHints;
    private AutofillValue mAutofillValue;
    private CharSequence[] mAutofillOptions;
    private String[] mOnReceiveContentMimeTypes;

    /** @hide */
    public ViewNode() {
@@ -169,6 +171,9 @@ public final class ViewNode extends AssistStructure.ViewNode {
        if ((nodeFlags & FLAGS_HAS_LOCALE_LIST) != 0) {
            mLocaleList = parcel.readParcelable(null);
        }
        if ((nodeFlags & FLAGS_HAS_MIME_TYPES) != 0) {
            mOnReceiveContentMimeTypes = parcel.readStringArray();
        }
        if ((nodeFlags & FLAGS_HAS_INPUT_TYPE) != 0) {
            mInputType = parcel.readInt();
        }
@@ -463,6 +468,12 @@ public final class ViewNode extends AssistStructure.ViewNode {
        return mAutofillOptions;
    }

    @Override
    @Nullable
    public String[] getOnReceiveContentMimeTypes() {
        return mOnReceiveContentMimeTypes;
    }

    @Nullable
    @Override
    public LocaleList getLocaleList() {
@@ -508,6 +519,9 @@ public final class ViewNode extends AssistStructure.ViewNode {
        if (mLocaleList != null) {
            nodeFlags |= FLAGS_HAS_LOCALE_LIST;
        }
        if (mOnReceiveContentMimeTypes != null) {
            nodeFlags |= FLAGS_HAS_MIME_TYPES;
        }
        if (mInputType != 0) {
            nodeFlags |= FLAGS_HAS_INPUT_TYPE;
        }
@@ -584,6 +598,9 @@ public final class ViewNode extends AssistStructure.ViewNode {
        if ((nodeFlags & FLAGS_HAS_LOCALE_LIST) != 0) {
            parcel.writeParcelable(mLocaleList, 0);
        }
        if ((nodeFlags & FLAGS_HAS_MIME_TYPES) != 0) {
            parcel.writeStringArray(mOnReceiveContentMimeTypes);
        }
        if ((nodeFlags & FLAGS_HAS_INPUT_TYPE) != 0) {
            parcel.writeInt(mInputType);
        }
@@ -911,6 +928,11 @@ public final class ViewNode extends AssistStructure.ViewNode {
            mNode.mAutofillType = type;
        }

        @Override
        public void setOnReceiveContentMimeTypes(@Nullable String[] mimeTypes) {
            mNode.mOnReceiveContentMimeTypes = mimeTypes;
        }

        @Override
        public void setAutofillHints(String[] hints) {
            mNode.mAutofillHints = hints;
Loading