Fix stale EditorInfo upon EditText#setText()
This is a follow up to our previous CL [1], which added initial surrounding text support into EditorInfo and let TextView support it. What we overlooked was that calling TextView#setText() would trigger TextView#onCreateInputConnection() before TextView#mText is updated to the new value. As a result, EditorInfo is initialized with a stale surrounding text information. With this CL, EditorInfo will correctly be initialized with the new text specified to TextView#setText(). One complicated thing in this CL is InputMethodManager also has some issues about how to drop spurious InputMethodService#onUpdateSelection() while InputConnection is being replaced with a new instance. I ended up having to introduce a hacky boolean Editor#mHasPendingRestartInputForSetText to work around this in the TextView/EditText. This workaround is expected to be removed/revisited as part of Bug 186582769. [1]: Ie04f2349b1157408aa8ed9044aea12ce99132cb4 c486acc4 Fix: 161330778 Test: atest CtsInputMethodTestCases:EditTextImeSupportTest Change-Id: Iee3b754eea319861b2eb955d6cc95ba13006b55e
Loading
Please register or sign in to comment