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
This commit is contained in:
@@ -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 */);
|
||||
|
||||
Reference in New Issue
Block a user