diff options
| author | 2023-03-06 12:03:44 +0000 | |
|---|---|---|
| committer | 2023-03-06 12:03:44 +0000 | |
| commit | 370a76b2a2d0349d73345a0ff1a68d275f35a21c (patch) | |
| tree | 40c74588b0e069814e573c3a441a8cf7039f1a6d | |
| parent | c39455c2b33305c260cdb50fe902ed0f2f0b8828 (diff) | |
| parent | 69ec4e4e078673f9ff0f135d8757ed3ff9c720ba (diff) | |
Merge "Fix KeyboardLayoutTest when new_settings flag is on" into udc-dev
| -rw-r--r-- | services/core/java/com/android/server/input/KeyboardLayoutManager.java | 3 | ||||
| -rw-r--r-- | services/tests/servicestests/src/com/android/server/input/KeyboardLayoutManagerTests.kt | 16 |
2 files changed, 12 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/input/KeyboardLayoutManager.java b/services/core/java/com/android/server/input/KeyboardLayoutManager.java index e0253fc3d30c..c1c8af2fd9e0 100644 --- a/services/core/java/com/android/server/input/KeyboardLayoutManager.java +++ b/services/core/java/com/android/server/input/KeyboardLayoutManager.java @@ -283,7 +283,8 @@ final class KeyboardLayoutManager implements InputManager.InputDeviceListener { public KeyboardLayout[] getKeyboardLayoutsForInputDevice( final InputDeviceIdentifier identifier) { if (useNewSettingsUi()) { - return new KeyboardLayout[0]; + // Provide all supported keyboard layouts since Ime info is not provided + return getKeyboardLayouts(); } final String[] enabledLayoutDescriptors = getEnabledKeyboardLayoutsForInputDevice(identifier); diff --git a/services/tests/servicestests/src/com/android/server/input/KeyboardLayoutManagerTests.kt b/services/tests/servicestests/src/com/android/server/input/KeyboardLayoutManagerTests.kt index b2bfd2bf720c..b660926f1394 100644 --- a/services/tests/servicestests/src/com/android/server/input/KeyboardLayoutManagerTests.kt +++ b/services/tests/servicestests/src/com/android/server/input/KeyboardLayoutManagerTests.kt @@ -256,12 +256,16 @@ class KeyboardLayoutManagerTests { @Test fun testNewUi_getKeyboardLayoutsForInputDevice() { NewSettingsApiFlag(true).use { - val keyboardLayouts = - keyboardLayoutManager.getKeyboardLayoutsForInputDevice(keyboardDevice.identifier) - assertEquals( - "New UI: getKeyboardLayoutsForInputDevice API should always return empty array", - 0, - keyboardLayouts.size + val keyboardLayouts = keyboardLayoutManager.keyboardLayouts + assertNotEquals( + "New UI: getKeyboardLayoutsForInputDevice API should not return empty array", + 0, + keyboardLayouts.size + ) + assertTrue( + "New UI: getKeyboardLayoutsForInputDevice API should provide English(US) " + + "layout", + hasLayout(keyboardLayouts, ENGLISH_US_LAYOUT_DESCRIPTOR) ) } } |