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

Commit da52c2c9 authored by Vaibhav Devmurari's avatar Vaibhav Devmurari
Browse files

Correctly setup IME subtypes in KeyboardLayoutManager in multi-user case

Bug: 354333072
Test: atest KeyboardLayoutManagerTests
Flag: com.android.hardware.input.keyboard_layout_manager_multi_user_ime_setup
Change-Id: I494a2ab5bd7c2fead341a9821144594efb068909
parent 4da3a94f
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -75,3 +75,13 @@ flag {
    description: "Enables a developer overlay that displays raw touchpad input data and gesture recognition status in real-time."
    bug: "286551975"
}

flag {
    namespace: "input_native"
    name: "keyboard_layout_manager_multi_user_ime_setup"
    description: "Update KeyboardLayoutManager to work correctly with multi-user IME setup"
    bug: "354333072"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}
+11 −3
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@ import static android.hardware.input.KeyboardLayoutSelectionResult.LAYOUT_SELECT
import static android.hardware.input.KeyboardLayoutSelectionResult.LAYOUT_SELECTION_CRITERIA_VIRTUAL_KEYBOARD;
import static android.hardware.input.KeyboardLayoutSelectionResult.LAYOUT_SELECTION_CRITERIA_DEFAULT;

import static com.android.hardware.input.Flags.keyboardLayoutManagerMultiUserImeSetup;

import android.annotation.AnyThread;
import android.annotation.MainThread;
import android.annotation.NonNull;
@@ -1066,9 +1068,15 @@ class KeyboardLayoutManager implements InputManager.InputDeviceListener {
            for (InputMethodInfo imeInfo :
                    inputMethodManagerInternal.getEnabledInputMethodListAsUser(
                            userId)) {
                for (InputMethodSubtype imeSubtype :
                        inputMethodManager.getEnabledInputMethodSubtypeList(
                                imeInfo, true /* allowsImplicitlyEnabledSubtypes */)) {
                final List<InputMethodSubtype> imeSubtypes;
                if (keyboardLayoutManagerMultiUserImeSetup()) {
                    imeSubtypes = inputMethodManagerInternal.getEnabledInputMethodSubtypeListAsUser(
                            imeInfo.getId(), true /* allowsImplicitlyEnabledSubtypes */, userId);
                } else {
                    imeSubtypes = inputMethodManager.getEnabledInputMethodSubtypeList(imeInfo,
                            true /* allowsImplicitlyEnabledSubtypes */);
                }
                for (InputMethodSubtype imeSubtype : imeSubtypes) {
                    if (!imeSubtype.isSuitableForPhysicalKeyboardLayoutMapping()) {
                        continue;
                    }