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

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

Merge "Properly set input type on autofill compat mode." into pi-dev

parents 8d114ef8 c380e18e
Loading
Loading
Loading
Loading
+17 −14
Original line number Diff line number Diff line
@@ -8536,24 +8536,27 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            }
            structure.setHint(info.getHintText());
        }
        if ((info.getText() != null || info.getError() != null)) {
            structure.setText(info.getText(), info.getTextSelectionStart(),
                    info.getTextSelectionEnd());
        CharSequence text = info.getText();
        boolean hasText = text != null || info.getError() != null;
        if (hasText) {
            structure.setText(text, info.getTextSelectionStart(), info.getTextSelectionEnd());
        }
        if (forAutofill) {
            if (info.isEditable()) {
                structure.setDataIsSensitive(true);
                if (hasText) {
                    structure.setAutofillType(AUTOFILL_TYPE_TEXT);
                    final AutofillValue autofillValue = AutofillValue.forText(structure.getText());
                    structure.setAutofillValue(autofillValue);
                    if (info.isPassword()) {
                        structure.setInputType(InputType.TYPE_CLASS_TEXT
                                | InputType.TYPE_TEXT_VARIATION_PASSWORD);
                    structure.setAutofillValue(AutofillValue.forText(text));
                }
                int inputType = info.getInputType();
                if (inputType == 0 && info.isPassword()) {
                    inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD;
                }
                structure.setInputType(inputType);
            } else {
                structure.setDataIsSensitive(false);
            }
        }
        }
        final int NCHILDREN = info.getChildCount();
        if (NCHILDREN > 0) {
            structure.setChildCount(NCHILDREN);