Merge "Show all KCMs if IME doesn't provide language tag information" into udc-dev am: d2ca40f78d am: 5f1c72239d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22799639 Change-Id: I3e8e2bc66268bf72ab2c755d36d425df8912bb89 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -1313,7 +1313,7 @@ final class KeyboardLayoutManager implements InputManager.InputDeviceListener {
|
|||||||
private static boolean isLayoutCompatibleWithLanguageTag(KeyboardLayout layout,
|
private static boolean isLayoutCompatibleWithLanguageTag(KeyboardLayout layout,
|
||||||
@NonNull String languageTag) {
|
@NonNull String languageTag) {
|
||||||
LocaleList layoutLocales = layout.getLocales();
|
LocaleList layoutLocales = layout.getLocales();
|
||||||
if (layoutLocales.isEmpty()) {
|
if (layoutLocales.isEmpty() || TextUtils.isEmpty(languageTag)) {
|
||||||
// KCM file doesn't have an associated language tag. This can be from
|
// KCM file doesn't have an associated language tag. This can be from
|
||||||
// a 3rd party app so need to include it as a potential layout.
|
// a 3rd party app so need to include it as a potential layout.
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -633,6 +633,30 @@ class KeyboardLayoutManagerTests {
|
|||||||
0,
|
0,
|
||||||
keyboardLayouts.size
|
keyboardLayouts.size
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// If IME doesn't have a corresponding language tag, then should show all available
|
||||||
|
// layouts no matter the script code.
|
||||||
|
keyboardLayouts =
|
||||||
|
keyboardLayoutManager.getKeyboardLayoutListForInputDevice(
|
||||||
|
keyboardDevice.identifier, USER_ID, imeInfo, null
|
||||||
|
)
|
||||||
|
assertNotEquals(
|
||||||
|
"New UI: getKeyboardLayoutListForInputDevice API should return all layouts if" +
|
||||||
|
"language tag or subtype not provided",
|
||||||
|
0,
|
||||||
|
keyboardLayouts.size
|
||||||
|
)
|
||||||
|
assertTrue("New UI: getKeyboardLayoutListForInputDevice API should contain Latin " +
|
||||||
|
"layouts if language tag or subtype not provided",
|
||||||
|
containsLayout(keyboardLayouts, ENGLISH_US_LAYOUT_DESCRIPTOR)
|
||||||
|
)
|
||||||
|
assertTrue("New UI: getKeyboardLayoutListForInputDevice API should contain Cyrillic " +
|
||||||
|
"layouts if language tag or subtype not provided",
|
||||||
|
containsLayout(
|
||||||
|
keyboardLayouts,
|
||||||
|
createLayoutDescriptor("keyboard_layout_russian")
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user