From 3fb8aa6375786a96293a309185c59b900897c8e1 Mon Sep 17 00:00:00 2001 From: Vaibhav Devmurari Date: Tue, 21 Feb 2023 17:42:44 +0000 Subject: [PATCH] Fix keyboard not configured properly The native callback getKeyboardLayoutOverlay() occurs before device added, we don't set layout properly, then call reload layouts on device added that will force native callback again. Long term solution: Include all necessary information for auto- detection of layout in InputDeviceIdentifier so that we don't need to wait for onInputDeviceAdded() to auto-select layout. InputDeviceIdentifier is sent with the native callback as parameter so we don't need to rely on getInputDevice() method to get the necessary information for auto-detection. Test: manual Bug: 259530132 Change-Id: I941bb8544cee8fee736e9cedcff10030361e45c9 --- .../java/com/android/server/input/KeyboardLayoutManager.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/core/java/com/android/server/input/KeyboardLayoutManager.java b/services/core/java/com/android/server/input/KeyboardLayoutManager.java index e0253fc3d30cb..7c3b8d612283e 100644 --- a/services/core/java/com/android/server/input/KeyboardLayoutManager.java +++ b/services/core/java/com/android/server/input/KeyboardLayoutManager.java @@ -150,6 +150,10 @@ final class KeyboardLayoutManager implements InputManager.InputDeviceListener { @Override public void onInputDeviceAdded(int deviceId) { onInputDeviceChanged(deviceId); + if (useNewSettingsUi()) { + // Force native callback to set up keyboard layout overlay for newly added keyboards + reloadKeyboardLayouts(); + } } @Override