Files
frameworks_base/core/java/android
Yohei Yukawa a35ebcf88e 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
      c486acc4d2

Fix: 161330778
Test: atest CtsInputMethodTestCases:EditTextImeSupportTest
Change-Id: Iee3b754eea319861b2eb955d6cc95ba13006b55e
2021-04-27 19:20:16 -07:00
..
…
…
2021-04-25 06:49:42 +00:00