diff options
| author | 2018-12-19 11:21:04 -0800 | |
|---|---|---|
| committer | 2018-12-19 11:21:04 -0800 | |
| commit | 7b1c8d717fffa72fdb19243f7a4d438fdf9bbe48 (patch) | |
| tree | 81b182b009ac0e831377a0fb6ec8dc648bc4ac72 | |
| parent | 1386358988892d9296fb71fde5071d59ef43e3a5 (diff) | |
Remove <imi> entries with zero <subtype> from subtype.xml
As mentioned in its JavaDoc, the way to remove additional subtypes
from the IME is passing an empty InputMethodSubtype array as folows:
imm#setAdditionalInputMethodSubtypes(imi, new InputMethodSubtype[]);
While there is no problem from the viewpoint of IME developers, a
harmless but redundant entry for that IME remains in subtype.xml.
<subtypes>
<imi id="com.android.inputmethod.latin/.LatinIME" />
</subtypes>
With this CL, such a redundant entry will be removed.
Bug: 121223050
Test: Manually verified as follows
1. Build and flash aosp_taimen-userdebug into taimen
2. Make sure that the device fully boots up
3. adb reboot # to avoid Bug 121259290
4. adb root
5. adb shell cat /data/system/inputmethod/subtypes.xml
-> make sure the content looks as follows:
<subtypes>
<imi id="com.android.inputmethod.latin/.LatinIME">
<subtype ....>
<subtype ....>
</imi/>
</subtypes>
6. Open AOSP Keyboard settings
7. Go to "Appearance & Layouts" -> "Custom input styles"
8. Remove all layouts.
9. adb shell cat /data/system/inputmethod/subtypes.xml
-> make sure the content looks as follows:
<subtypes>
</subtypes>
Change-Id: I30820e570e42d5dbc4fd1b6e311b2a8d2553be6d
| -rw-r--r-- | services/core/java/com/android/server/inputmethod/InputMethodManagerService.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index 67293b9c9ea0..47c5f492a7e0 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -3274,7 +3274,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub final int packageNum = packageInfos.length; for (int i = 0; i < packageNum; ++i) { if (packageInfos[i].equals(imi.getPackageName())) { - mFileManager.addInputMethodSubtypes(imi, subtypes); + if (subtypes.length > 0) { + mFileManager.addInputMethodSubtypes(imi, subtypes); + } else { + mFileManager.deleteAllInputMethodSubtypes(imi.getId()); + } final long ident = Binder.clearCallingIdentity(); try { buildInputMethodListLocked(false /* resetDefaultEnabledIme */); |