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

Commit 66b43763 authored by Daniel Kim's avatar Daniel Kim Committed by Android (Google) Code Review
Browse files

Merge "Add isCredential method to ViewNode" into main

parents 80d40316 d3d9bfb1
Loading
Loading
Loading
Loading
+24 −1
Original line number Diff line number Diff line
@@ -651,6 +651,7 @@ public class AssistStructure implements Parcelable {
        // POJO used to override some autofill-related values when the node is parcelized.
        // Not written to parcel.
        AutofillOverlay mAutofillOverlay;
        boolean mIsCredential;

        int mX;
        int mY;
@@ -799,6 +800,7 @@ public class AssistStructure implements Parcelable {

            if (autofillFlags != 0) {
                mSanitized = in.readInt() == 1;
                mIsCredential = in.readInt() == 1;
                mImportantForAutofill = in.readInt();

                if ((autofillFlags & AUTOFILL_FLAGS_HAS_AUTOFILL_VIEW_ID) != 0) {
@@ -1033,6 +1035,7 @@ public class AssistStructure implements Parcelable {

            if (autofillFlags != 0) {
                out.writeInt(mSanitized ? 1 : 0);
                out.writeInt(mIsCredential ? 1 : 0);
                out.writeInt(mImportantForAutofill);
                writeSensitive = mSanitized || !sanitizeOnWrite;
                if ((autofillFlags & AUTOFILL_FLAGS_HAS_AUTOFILL_VIEW_ID) != 0) {
@@ -1245,6 +1248,19 @@ public class AssistStructure implements Parcelable {
            return mAutofillOptions;
        }

        /**
         * @return whether the node is a credential.
         *
         * <p>It's only relevant when the {@link AssistStructure} is used for autofill purposes,
         * not for assist purposes.
         * TODO(b/303677885): add TestApi
         *
         * @hide
         */
        public boolean isCredential() {
            return mIsCredential;
        }

        /**
         * Gets the {@link android.text.InputType} bits of this structure.
         *
@@ -2182,6 +2198,11 @@ public class AssistStructure implements Parcelable {
            mNode.mImportantForAutofill = mode;
        }

        @Override
        public void setIsCredential(boolean isCredential) {
            mNode.mIsCredential = isCredential;
        }

        @Override
        public void setReceiveContentMimeTypes(@Nullable String[] mimeTypes) {
            mNode.mReceiveContentMimeTypes = mimeTypes;
@@ -2498,7 +2519,9 @@ public class AssistStructure implements Parcelable {
                    + ", value=" + node.getAutofillValue()
                    + ", sanitized=" + node.isSanitized()
                    + ", important=" + node.getImportantForAutofill()
                    + ", visibility=" + node.getVisibility());
                    + ", visibility=" + node.getVisibility()
                    + ", isCredential=" + node.isCredential()
            );
        }

        final int NCHILDREN = node.getChildCount();
+1 −0
Original line number Diff line number Diff line
@@ -9308,6 +9308,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                structure.setAutofillType(autofillType);
                structure.setAutofillHints(getAutofillHints());
                structure.setAutofillValue(getAutofillValue());
                structure.setIsCredential(isCredential());
            }
            structure.setImportantForAutofill(getImportantForAutofill());
            structure.setReceiveContentMimeTypes(getReceiveContentMimeTypes());
+7 −0
Original line number Diff line number Diff line
@@ -396,6 +396,13 @@ public abstract class ViewStructure {
     */
    public void setImportantForAutofill(@AutofillImportance int mode) {}

    /**
     * Sets whether the node is a credential. See {@link View#isCredential}.
     *
     * @hide
     */
    public void setIsCredential(boolean isCredential) {}

    /**
     * Sets the MIME types accepted by this view. See {@link View#getReceiveContentMimeTypes()}.
     *