Skip to content
Commit 787aa8c0 authored by Guliz Tuncay's avatar Guliz Tuncay
Browse files

Eliminate the inconsistency between the states of AMS and TSMS

If spell checker service (SCS) is killed for some reason, TSMS
accidentally clears the internal bindings to SCS even though it does not
programmatically unbind them. When SCS is restarted, the seemingly-dead
connections are re-established but TSMS’s internal bind groups
structures do not keep track of them anymore. This results in
inconsistency between the internal data structures of activity manager
services (AMS) and TSMS. TSMS shows no bindings anymore, whereas AMS
shows there is active spell checker service connections. The fix is to
not remove a bind group at onServiceDisconnect and only set the bind
group's connected state to false.

Fixes: 37434113
Test: Manual as follows.
      1. Build and flash an OS image.
      2. Complete the setup wizard (if any).
      3. Make sure AOSP Keyboard (com.android.inputmethod.latin)
       is installed.
      4. adb shell settings put secure selected_spell_checker com.android.inputmethod.latin/.spellcheck.AndroidSpellCheckerService
      5. Observe that there are no bindings to spell
       checker service (SCS) by running
       adb shell dumpsys textservices
      6. Observe that there is no connection to SCS by running
       adb shell dumpsys activity services com.android.inputmethod.latin
       There should be no ConnectionRecord for
       AndroidSpellCheckerService
      7. Run a test program that has TextView and tap on one of the
       TextViews and type some text.
      8. Repeat steps 5 and 6 to observe there are now bindings and
       connection to SCS.
      9. Kill SCS
        adb shell ps -A | grep com.android.inputmethod.latin | awk '{print $2}' | xargs adb shell kill -KILL
      10. Repeat steps 5 and 6 to observe that the bindings are the
       same as of Step 8 and there is still a connection to SCS.
Change-Id: I66de244f184ab0618944c129db4062d09f72e6d1
parent 984bc9cb
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