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

Commit 2e58b167 authored by Felipe Leme's avatar Felipe Leme
Browse files

Move cursor to end of text when autofilling.

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

Fixes: 62669787

Change-Id: I70a583c71057804334e86ed3f7dd2aca8da20922
parent 988c6c89
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -10320,7 +10320,16 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
            return;
        }

        setText(value.getTextValue(), mBufferType, true, 0);
        final CharSequence autofilledValue = value.getTextValue();

        // First autofill it...
        setText(autofilledValue, mBufferType, true, 0);

        // ...then move cursor to the end.
        final CharSequence text = getText();
        if ((text instanceof Spannable)) {
            Selection.setSelection((Spannable) text, text.length());
        }
    }

    @Override