OSDN Git Service

Select only preinstalled Spell Checker Services
authorGuliz Tuncay <gulizseray@google.com>
Wed, 16 Aug 2017 19:02:31 +0000 (12:02 -0700)
committerJP Sugarbroad <jpsugar@google.com>
Mon, 14 Jan 2019 22:55:15 +0000 (14:55 -0800)
commitb6685b3e85da4c4e7931cc3a459b8402f3572799
tree52e29e9dc808d7cbab4bc4beeb0afb5db609561c
parent6ad3c58ba2f448a9a3750780136fe2c75de665d5
Select only preinstalled Spell Checker Services

When we are setting a new spell checker as the default one in
Secure.Settings, TSMS#findAvailSpellCheckerLocked can pick up
any available spell checker service. This violates the principle
that user should be warned whenever we are setting an untrusted
spell checker service as the default service, since the warning
dialog is never shown.

Fixes: 64764051
Bug: 118694079
Test: Manually as follows:
1. Open 'packages/inputmethods/LatinIME/java/AndroidManifest.xml'
     and remove 'AndroidSpellCheckerService'
2. lunch aosp_buillhead-userdebug && make -j
3. Flash the image
4. adb shell dumpsys textservices
    -> no spell checker is recognized
5. adb shell settings get secure selected_spell_checker
    -> null
6. tapas SampleSpellCheckerService
7. make -j
8. adb install -r $OUT/system/app/SampleSpellCheckerService/SampleSpellCheckerService.apk
9. adb shell dumpsys textservices
    -> SampleSpellCheckerService is recognized
10. adb shell settings get secure selected_spell_checker
    -> null

Change-Id: I16f12293d15258c9148677c7ee09fe6dcf81e81d
Merged-In: Idab3ecc246fe9344a09e6907a0ba39f8ea6506f9
(cherry picked from commit ed5973b8a8a2c0f0fc1f39c59c33f81882f41405)
services/core/java/com/android/server/TextServicesManagerService.java