Fix: Show string "Layout" if only single valid IME exists
From UX mocks, we need to show IME names in heading if there are multiple IMEs. But in situation where we have multiple IMEs but one of the IMEs doesn't have any valid subtype for PK, it should work as if there is only a single IME. Bug: 361528038 Test: manual Flag: EXEMPT bugfix Change-Id: Idd03a224b300df31b3265a5d58f79c0fc5d1535a
This commit is contained in:
@@ -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();
|
||||
|
Reference in New Issue
Block a user