OSDN Git Service

Avoid sync IPCs from TSMS to SpellCheckerService
authorYohei Yukawa <yukawa@google.com>
Wed, 8 Feb 2017 19:54:05 +0000 (11:54 -0800)
committerYohei Yukawa <yukawa@google.com>
Wed, 8 Feb 2017 19:54:05 +0000 (11:54 -0800)
commit7fa65eef203c4ed3ce00ddef96ccf311d3bfb58c
tree8ad2efdf2380996ecb8a2d731790fb30268e8a04
parentfd62c58ede768be5830a052ee2d5ee6ade787839
Avoid sync IPCs from TSMS to SpellCheckerService

Currently, TextServicesManagerServices uses an AIDL interface called
ISpellCheckerService when binding to a spell-checking service.
However, this interface uses synchronous (blocking) binder calls
rather than asynchronous (oneway) calls.  As a result, there are
situations where the system process has made a blocking binder call
into untrusted application code from its main looper thread.

As general policy, the system process must never allow its looper
threads to block on application code.

This CL addresses the above issue by converting ISpellCheckerService
into oneway interface, which instead takes a result receiver
ISpellCheckerServiceCallback so that spell-checking services can
return results asynchronously.

Note that the above protocol issue was also the root cause of
Bug 5471520.  Hence we can also logically revert the previous CL [1]
for Bug 5471520.

 [1]: Iedf2c2cdd8d4834545d06d72ade3ce211b104b1d
      4e713f14419a37f385cf1509b011982bdcf67edc

Test: Ran `adb shell dumpsys textservices` to check the
      "Spell Checker Bind Groups:" section in the following three
      steps.
      1. Before apps start requesting spell checker sessions.
      2. While apps are owning active spell checker sessions.
      3. After all the apps that owned spell checker sessions are
         gone.
      Made sure that spell checker service is not running when
      there is not spell checker bind group.
Bug: 7254002
Change-Id: I92e7aa40dc9ea14f67d355f0bfa15325b775d27b
Android.mk
core/java/android/service/textservice/SpellCheckerService.java
core/java/com/android/internal/textservice/ISpellCheckerService.aidl
core/java/com/android/internal/textservice/ISpellCheckerServiceCallback.aidl [new file with mode: 0644]
core/java/com/android/internal/textservice/ITextServicesSessionListener.aidl
services/core/java/com/android/server/TextServicesManagerService.java