Merge "Fix: Show string "Layout" if only single valid IME exists" into main

This commit is contained in:
Treehugger Robot
2024-09-05 11:15:59 +00:00
committed by Android (Google) Code Review

View File

@@ -169,6 +169,19 @@ public class NewKeyboardLayoutEnabledLocalesFragment extends DashboardFragment
preferenceScreen.removeAll();
List<InputMethodInfo> infoList =
mImm.getEnabledInputMethodListAsUser(UserHandle.of(mUserId));
// Remove IMEs with no suitable ime subtypes
infoList.removeIf(imeInfo -> {
List<InputMethodSubtype> subtypes =
mImm.getEnabledInputMethodSubtypeListAsUser(imeInfo.getId(), true,
UserHandle.of(mUserId));
for (InputMethodSubtype subtype : subtypes) {
if (subtype.isSuitableForPhysicalKeyboardLayoutMapping()) {
return false;
}
}
return true;
});
Collections.sort(infoList, new Comparator<InputMethodInfo>() {
public int compare(InputMethodInfo o1, InputMethodInfo o2) {
String s1 = o1.loadLabel(mContext.getPackageManager()).toString();