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

Commit 53308c14 authored by felipeal's avatar felipeal
Browse files

New autofill APIs to get importantForAutofill mode on ViewNodes.

Test: atest CtsAutoFillServiceTestCases:FatActivityTest

Fixes: 72834587

Change-Id: Ia30da4ba53175a5cc4da6837c60d379c8eda05a8
parent dd98087d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -6872,6 +6872,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();
@@ -48406,6 +48407,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);
+1 −1
Original line number Diff line number Diff line
@@ -30,8 +30,8 @@ package android {
    field public static final java.lang.String BIND_RUNTIME_PERMISSION_PRESENTER_SERVICE = "android.permission.BIND_RUNTIME_PERMISSION_PRESENTER_SERVICE";
    field public static final java.lang.String BIND_SETTINGS_SUGGESTIONS_SERVICE = "android.permission.BIND_SETTINGS_SUGGESTIONS_SERVICE";
    field public static final java.lang.String BIND_TELEPHONY_DATA_SERVICE = "android.permission.BIND_TELEPHONY_DATA_SERVICE";
    field public static final java.lang.String BIND_TEXTCLASSIFIER_SERVICE = "android.permission.BIND_TEXTCLASSIFIER_SERVICE";
    field public static final java.lang.String BIND_TELEPHONY_NETWORK_SERVICE = "android.permission.BIND_TELEPHONY_NETWORK_SERVICE";
    field public static final java.lang.String BIND_TEXTCLASSIFIER_SERVICE = "android.permission.BIND_TEXTCLASSIFIER_SERVICE";
    field public static final java.lang.String BIND_TRUST_AGENT = "android.permission.BIND_TRUST_AGENT";
    field public static final java.lang.String BIND_TV_REMOTE_SERVICE = "android.permission.BIND_TV_REMOTE_SERVICE";
    field public static final java.lang.String BLUETOOTH_PRIVILEGED = "android.permission.BLUETOOTH_PRIVILEGED";
+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();
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.view;
import static android.view.accessibility.AccessibilityEvent.CONTENT_CHANGE_TYPE_UNDEFINED;
import static java.lang.Math.max;
import android.animation.AnimatorInflater;
@@ -7860,6 +7861,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.
     *