OSDN Git Service

Fix a condition to reset the current spell checker
authorYohei Yukawa <yukawa@google.com>
Tue, 1 May 2018 22:22:27 +0000 (15:22 -0700)
committerYohei Yukawa <yukawa@google.com>
Tue, 1 May 2018 22:22:27 +0000 (15:22 -0700)
TextServicesManagerService has had a logic to reset
Settings.Secure.SELECTED_SPELL_CHECKER when the current spell checker
service is uninstalled, but it had not been working until we fixed a
bug that had prevented that logic from running [1].  However, there
has been another bug in that logic itself that resets
Settings.Secure.SELECTED_SPELL_CHECKER also when the current spell
checker service APK is updated.

With this CL, Settings.Secure.SELECTED_SPELL_CHECKER will be reset
only when the package disappears, not when it is just being replaced
with a new APK.

 [1]: I30902a3d94f2ddef33f4a8067799e98322ae3a03
      34a04e40bd1f4a2e5aa7f15def0da626137fc64a

Fix: 79110151
Test: Manually verified as follows.
      1. adb install -r SampleSpellCheckerService.apk
      2. adb shell settings get secure selected_spell_checker
        -> com.android.inputmethod.latin/.spellcheck.AndroidSpellCheckerService
      3. adb shell "settings put secure selected_spell_checker 'com.example.android.samplespellcheckerservice/.SampleSpellCheckerService'"
      4. adb shell settings get secure selected_spell_checker
        -> com.example.android.samplespellcheckerservice/.SampleSpellCheckerService
      5. adb install -r SampleSpellCheckerService.apk
      6. adb shell settings get secure selected_spell_checker
        -> com.example.android.samplespellcheckerservice/.SampleSpellCheckerService
Test: Manually verified that Bug 67412078 is still fixed.
Change-Id: Ic07fc2f418f051b2825d993fa959ed36f9b0f3c7

services/core/java/com/android/server/TextServicesManagerService.java

index 26a8cf7..12693dc 100644 (file)
@@ -396,10 +396,7 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
                     final String packageName = sci.getPackageName();
                     final int change = isPackageDisappearing(packageName);
                     if (DBG) Slog.d(TAG, "Changing package name: " + packageName);
-                    if (// Package disappearing
-                            change == PACKAGE_PERMANENT_CHANGE || change == PACKAGE_TEMPORARY_CHANGE
-                                    // Package modified
-                                    || isPackageModified(packageName)) {
+                    if (change == PACKAGE_PERMANENT_CHANGE || change == PACKAGE_TEMPORARY_CHANGE) {
                         SpellCheckerInfo availSci =
                                 findAvailSystemSpellCheckerLocked(packageName, tsd);
                         // Set the spell checker settings if different than before