From 4993f4ed1e5d7ce0658fd528de63a02375c61910 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Tue, 1 May 2018 15:22:27 -0700 Subject: [PATCH] Fix a condition to reset the current spell checker 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 --- .../core/java/com/android/server/TextServicesManagerService.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/TextServicesManagerService.java b/services/core/java/com/android/server/TextServicesManagerService.java index 26a8cf74d245..12693dc2b1b1 100644 --- a/services/core/java/com/android/server/TextServicesManagerService.java +++ b/services/core/java/com/android/server/TextServicesManagerService.java @@ -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 -- 2.11.0