Fix crash when IME not enabled

This is unexpected but happened to a user. Perhaps because the OS
returned bogus or fake results in imm.getEnabledInputMethodList ?
This commit is contained in:
Jules Aguillon 2022-05-01 00:00:15 +02:00
parent b72635b887
commit 8e0d38c257

View File

@ -20,6 +20,7 @@ import android.view.ViewGroup;
import android.view.ViewParent;
import android.util.Log;
import android.util.LogPrinter;
import java.util.Arrays;
import java.util.List;
import java.util.HashSet;
import java.util.Set;
@ -62,7 +63,7 @@ public class Keyboard2 extends InputMethodService
for (InputMethodInfo imi : imm.getEnabledInputMethodList())
if (imi.getPackageName().equals(pkg))
return imm.getEnabledInputMethodSubtypeList(imi, true);
return null;
return Arrays.asList();
}
private void refreshSubtypeLayout(InputMethodSubtype subtype)