Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4bdbd619 authored by Vaibhav Devmurari's avatar Vaibhav Devmurari Committed by Automerger Merge Worker
Browse files

Merge "Show all KCMs if IME doesn't provide language tag information" into udc-dev am: d2ca40f7

parents ec0e5675 d2ca40f7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1313,7 +1313,7 @@ final class KeyboardLayoutManager implements InputManager.InputDeviceListener {
    private static boolean isLayoutCompatibleWithLanguageTag(KeyboardLayout layout,
            @NonNull String languageTag) {
        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
            // a 3rd party app so need to include it as a potential layout.
            return true;
+24 −0
Original line number Diff line number Diff line
@@ -633,6 +633,30 @@ class KeyboardLayoutManagerTests {
                0,
                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")
                )
            )
        }
    }