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

Commit 811e0a7a authored by Vaibhav Devmurari's avatar Vaibhav Devmurari Committed by Automerger Merge Worker
Browse files

Merge "In new PK settings don't set Keyboard layout before device added" into...

Merge "In new PK settings don't set Keyboard layout before device added" into udc-dev am: d71a10e3

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21787101



Change-Id: Ia299723158d9cf85660514dc98e2ec5c6dbea20c
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 32ac5399 d71a10e3
Loading
Loading
Loading
Loading
+17 −9
Original line number Diff line number Diff line
@@ -483,16 +483,18 @@ final class KeyboardLayoutManager implements InputManager.InputDeviceListener {
        key.append("vendor:").append(identifier.getVendorId()).append(",product:").append(
                identifier.getProductId());

        if (useNewSettingsUi()) {
            InputDevice inputDevice = getInputDevice(identifier);
            Objects.requireNonNull(inputDevice, "Input device must not be null");
        // Some keyboards can have same product ID and vendor ID but different Keyboard info like
        // language tag and layout type.
            // Some keyboards can have same product ID and vendor ID but different Keyboard info
            // like language tag and layout type.
            if (!TextUtils.isEmpty(inputDevice.getKeyboardLanguageTag())) {
                key.append(",languageTag:").append(inputDevice.getKeyboardLanguageTag());
            }
            if (!TextUtils.isEmpty(inputDevice.getKeyboardLayoutType())) {
                key.append(",layoutType:").append(inputDevice.getKeyboardLanguageTag());
            }
        }
        return key.toString();
    }

@@ -669,6 +671,12 @@ final class KeyboardLayoutManager implements InputManager.InputDeviceListener {
    public String[] getKeyboardLayoutOverlay(InputDeviceIdentifier identifier) {
        String keyboardLayoutDescriptor;
        if (useNewSettingsUi()) {
            InputDevice inputDevice = getInputDevice(identifier);
            if (inputDevice == null) {
                // getKeyboardLayoutOverlay() called before input device added completely. Need
                // to wait till the device is added which will call reloadKeyboardLayouts()
                return null;
            }
            if (mCurrentImeInfo == null) {
                // Haven't received onInputMethodSubtypeChanged() callback from IMMS. Will reload
                // keyboard layouts once we receive the callback.