Skip to content
Commit a35ebcf8 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

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
parent 3dfc4cd4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment