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

Commit ec053e07 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "New autofill APIs to get importantForAutofill mode on ViewNodes."

parents cbc4d36d 53308c14
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -6874,6 +6874,7 @@ package android.app.assist {
    method public java.lang.String getIdEntry();
    method public java.lang.String getIdPackage();
    method public java.lang.String getIdType();
    method public int getImportantForAutofill();
    method public int getInputType();
    method public int getLeft();
    method public android.os.LocaleList getLocaleList();
@@ -48421,6 +48422,7 @@ package android.view {
    method public abstract void setHint(java.lang.CharSequence);
    method public abstract void setHtmlInfo(android.view.ViewStructure.HtmlInfo);
    method public abstract void setId(int, java.lang.String, java.lang.String, java.lang.String);
    method public void setImportantForAutofill(int);
    method public abstract void setInputType(int);
    method public abstract void setLocaleList(android.os.LocaleList);
    method public abstract void setLongClickable(boolean);
+21 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
import android.view.View;
import android.view.View.AutofillImportance;
import android.view.ViewRootImpl;
import android.view.ViewStructure;
import android.view.ViewStructure.HtmlInfo;
@@ -632,6 +633,7 @@ public class AssistStructure implements Parcelable {
        int mMaxEms = -1;
        int mMaxLength = -1;
        @Nullable String mTextIdEntry;
        @AutofillImportance int mImportantForAutofill;

        // POJO used to override some autofill-related values when the node is parcelized.
        // Not written to parcel.
@@ -733,6 +735,7 @@ public class AssistStructure implements Parcelable {
                mMaxEms = in.readInt();
                mMaxLength = in.readInt();
                mTextIdEntry = preader.readString();
                mImportantForAutofill = in.readInt();
            }
            if ((flags&FLAGS_HAS_LARGE_COORDS) != 0) {
                mX = in.readInt();
@@ -900,6 +903,7 @@ public class AssistStructure implements Parcelable {
                out.writeInt(mMaxEms);
                out.writeInt(mMaxLength);
                pwriter.writeString(mTextIdEntry);
                out.writeInt(mImportantForAutofill);
            }
            if ((flags&FLAGS_HAS_LARGE_COORDS) != 0) {
                out.writeInt(mX);
@@ -1512,6 +1516,16 @@ public class AssistStructure implements Parcelable {
        public int getMaxTextLength() {
            return mMaxLength;
        }

        /**
         * Gets the {@link View#setImportantForAutofill(int) importantForAutofill mode} of
         * the view associated with this node.
         *
         * <p>It's only relevant when the {@link AssistStructure} is used for autofill purposes.
         */
        public @AutofillImportance int getImportantForAutofill() {
            return mImportantForAutofill;
        }
    }

    /**
@@ -1843,6 +1857,11 @@ public class AssistStructure implements Parcelable {
            mNode.mAutofillOptions = options;
        }

        @Override
        public void setImportantForAutofill(@AutofillImportance int mode) {
            mNode.mImportantForAutofill = mode;
        }

        @Override
        public void setInputType(int inputType) {
            mNode.mInputType = inputType;
@@ -2144,7 +2163,8 @@ public class AssistStructure implements Parcelable {
                    + ", options=" + Arrays.toString(node.getAutofillOptions())
                    + ", hints=" + Arrays.toString(node.getAutofillHints())
                    + ", value=" + node.getAutofillValue()
                    + ", sanitized=" + node.isSanitized());
                    + ", sanitized=" + node.isSanitized()
                    + ", importantFor=" + node.getImportantForAutofill());
        }

        final int NCHILDREN = node.getChildCount();
+1 −0
Original line number Diff line number Diff line
@@ -7871,6 +7871,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                structure.setAutofillHints(getAutofillHints());
                structure.setAutofillValue(getAutofillValue());
            }
            structure.setImportantForAutofill(getImportantForAutofill());
        }
        int ignoredParentLeft = 0;
+8 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ import android.graphics.Rect;
import android.os.Bundle;
import android.os.LocaleList;
import android.util.Pair;
import android.view.View.AutofillImportance;
import android.view.ViewStructure.HtmlInfo;
import android.view.autofill.AutofillId;
import android.view.autofill.AutofillValue;

@@ -346,6 +348,12 @@ public abstract class ViewStructure {
     */
    public abstract void setAutofillOptions(CharSequence[] options);

    /**
     * Sets the {@link View#setImportantForAutofill(int) importantForAutofill mode} of the
     * view associated with this node.
     */
    public void setImportantForAutofill(@AutofillImportance int mode) {}

    /**
     * Sets the {@link android.text.InputType} bits of this node.
     *