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

Commit aa7e2294 authored by Felipe Leme's avatar Felipe Leme
Browse files

Added new ViewNode properties for Autofill (minEms, maxEms, maxLength).

Test: cts-tradefed run commandAndExit cts-dev -m CtsAutoFillServiceTestCases -t android.autofillservice.cts.LoginActivityTest#testNewTextAttributes
Test: cts-tradefed run commandAndExit cts-dev -m CtsAutoFillServiceTestCases

Fixes: 38323227

Change-Id: I6d8606f2d0668644ae1bd33e982edef0ec1e8e63
parent e38c42e6
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -6668,6 +6668,9 @@ package android.app.assist {
    method public int getInputType();
    method public int getLeft();
    method public android.os.LocaleList getLocaleList();
    method public int getMaxTextEms();
    method public int getMaxTextLength();
    method public int getMinTextEms();
    method public int getScrollX();
    method public int getScrollY();
    method public java.lang.CharSequence getText();
@@ -46969,6 +46972,9 @@ package android.view {
    method public abstract void setInputType(int);
    method public abstract void setLocaleList(android.os.LocaleList);
    method public abstract void setLongClickable(boolean);
    method public abstract void setMaxTextEms(int);
    method public abstract void setMaxTextLength(int);
    method public abstract void setMinTextEms(int);
    method public abstract void setOpaque(boolean);
    method public abstract void setSelected(boolean);
    method public abstract void setText(java.lang.CharSequence);
+6 −0
Original line number Diff line number Diff line
@@ -6918,6 +6918,9 @@ package android.app.assist {
    method public int getInputType();
    method public int getLeft();
    method public android.os.LocaleList getLocaleList();
    method public int getMaxTextEms();
    method public int getMaxTextLength();
    method public int getMinTextEms();
    method public int getScrollX();
    method public int getScrollY();
    method public java.lang.CharSequence getText();
@@ -50661,6 +50664,9 @@ package android.view {
    method public abstract void setInputType(int);
    method public abstract void setLocaleList(android.os.LocaleList);
    method public abstract void setLongClickable(boolean);
    method public abstract void setMaxTextEms(int);
    method public abstract void setMaxTextLength(int);
    method public abstract void setMinTextEms(int);
    method public abstract void setOpaque(boolean);
    method public abstract void setSelected(boolean);
    method public abstract void setText(java.lang.CharSequence);
+6 −0
Original line number Diff line number Diff line
@@ -6739,6 +6739,9 @@ package android.app.assist {
    method public int getInputType();
    method public int getLeft();
    method public android.os.LocaleList getLocaleList();
    method public int getMaxTextEms();
    method public int getMaxTextLength();
    method public int getMinTextEms();
    method public int getScrollX();
    method public int getScrollY();
    method public java.lang.CharSequence getText();
@@ -47518,6 +47521,9 @@ package android.view {
    method public abstract void setInputType(int);
    method public abstract void setLocaleList(android.os.LocaleList);
    method public abstract void setLongClickable(boolean);
    method public abstract void setMaxTextEms(int);
    method public abstract void setMaxTextLength(int);
    method public abstract void setMinTextEms(int);
    method public abstract void setOpaque(boolean);
    method public abstract void setSelected(boolean);
    method public abstract void setText(java.lang.CharSequence);
+57 −0
Original line number Diff line number Diff line
@@ -616,6 +616,9 @@ public class AssistStructure implements Parcelable {
        CharSequence[] mAutofillOptions;
        boolean mSanitized;
        HtmlInfo mHtmlInfo;
        int mMinEms = -1;
        int mMaxEms = -1;
        int mMaxLength = -1;

        // POJO used to override some autofill-related values when the node is parcelized.
        // Not written to parcel.
@@ -712,6 +715,9 @@ public class AssistStructure implements Parcelable {
                if (p instanceof HtmlInfo) {
                    mHtmlInfo = (HtmlInfo) p;
                }
                mMinEms = in.readInt();
                mMaxEms = in.readInt();
                mMaxLength = in.readInt();
            }
            if ((flags&FLAGS_HAS_LARGE_COORDS) != 0) {
                mX = in.readInt();
@@ -874,6 +880,9 @@ public class AssistStructure implements Parcelable {
                } else {
                    out.writeParcelable(null, 0);
                }
                out.writeInt(mMinEms);
                out.writeInt(mMaxEms);
                out.writeInt(mMaxLength);
            }
            if ((flags&FLAGS_HAS_LARGE_COORDS) != 0) {
                out.writeInt(mX);
@@ -1428,6 +1437,39 @@ public class AssistStructure implements Parcelable {
        public ViewNode getChildAt(int index) {
            return mChildren[index];
        }

        /**
         * Returns the minimum width in ems of the text associated with this node, or {@code -1}
         * if not supported by the node.
         *
         * <p>It's only relevant when the {@link AssistStructure} is used for autofill purposes,
         * not for assist purposes.
         */
        public int getMinTextEms() {
            return mMinEms;
        }

        /**
         * Returns the maximum width in ems of the text associated with this node, or {@code -1}
         * if not supported by the node.
         *
         * <p>It's only relevant when the {@link AssistStructure} is used for autofill purposes,
         * not for assist purposes.
         */
        public int getMaxTextEms() {
            return mMaxEms;
        }

        /**
         * Returns the maximum length of the text associated with this node node, or {@code -1}
         * if not supported by the node or not set.
         *
         * <p>It's only relevant when the {@link AssistStructure} is used for autofill purposes,
         * not for assist purposes.
         */
        public int getMaxTextLength() {
            return mMaxLength;
        }
    }

    /**
@@ -1759,6 +1801,21 @@ public class AssistStructure implements Parcelable {
            mNode.mInputType = inputType;
        }

        @Override
        public void setMinTextEms(int minEms) {
            mNode.mMinEms = minEms;
        }

        @Override
        public void setMaxTextEms(int maxEms) {
            mNode.mMaxEms = maxEms;
        }

        @Override
        public void setMaxTextLength(int maxLength) {
            mNode.mMaxLength = maxLength;
        }

        @Override
        public void setDataIsSensitive(boolean sensitive) {
            mNode.mSanitized = !sensitive;
+24 −0
Original line number Diff line number Diff line
@@ -364,6 +364,30 @@ public abstract class ViewStructure {
     */
    public abstract void setDataIsSensitive(boolean sensitive);

    /**
     * Sets the minimum width in ems of the text associated with this view, when supported.
     *
     * <p>Should only be set when the node is used for autofill purposes - it will be ignored
     * when used for Assist.
     */
    public abstract void setMinTextEms(int minEms);

    /**
     * Sets the maximum width in ems of the text associated with this view, when supported.
     *
     * <p>Should only be set when the node is used for autofill purposes - it will be ignored
     * when used for Assist.
     */
    public abstract void setMaxTextEms(int maxEms);

    /**
     * Sets the maximum length of the text associated with this view, when supported.
     *
     * <p>Should only be set when the node is used for autofill purposes - it will be ignored
     * when used for Assist.
     */
    public abstract void setMaxTextLength(int maxLength);

    /**
     * Call when done populating a {@link ViewStructure} returned by
     * {@link #asyncNewChild}.
Loading