From fb290df3c9a6f37ec050163029e25844de2f8590 Mon Sep 17 00:00:00 2001 From: RoboErik Date: Mon, 16 Dec 2013 11:27:55 -0800 Subject: b/12068020 Make kb layouts only unique to vendor/product Instead of storing a kb layout per device descriptor (which is expected to be unique), store it for each vendor/product. This way we can keep a consistent layout between identical but physically different keyboards. There are some corner cases this is expected to fail on, namely devices that incorrectly have the same vendor/product id. Devices that don't define a vendor/product id will continue to use the descriptor to store layout files. Change-Id: Id0890d13e1c859eaf993d4831b7b1acbaf5df80f --- libs/input/InputReader.cpp | 2 +- libs/input/InputReader.h | 3 ++- libs/input/tests/InputReader_test.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'libs/input') diff --git a/libs/input/InputReader.cpp b/libs/input/InputReader.cpp index a683c4b..94e2a80 100644 --- a/libs/input/InputReader.cpp +++ b/libs/input/InputReader.cpp @@ -911,7 +911,7 @@ void InputDevice::configure(nsecs_t when, const InputReaderConfiguration* config if (!changes || (changes & InputReaderConfiguration::CHANGE_KEYBOARD_LAYOUTS)) { if (!(mClasses & INPUT_DEVICE_CLASS_VIRTUAL)) { sp keyboardLayout = - mContext->getPolicy()->getKeyboardLayoutOverlay(mIdentifier.descriptor); + mContext->getPolicy()->getKeyboardLayoutOverlay(mIdentifier); if (mContext->getEventHub()->setKeyboardLayoutOverlay(mId, keyboardLayout)) { bumpGeneration(); } diff --git a/libs/input/InputReader.h b/libs/input/InputReader.h index e6f45b6..674f67d 100644 --- a/libs/input/InputReader.h +++ b/libs/input/InputReader.h @@ -281,7 +281,8 @@ public: virtual void notifyInputDevicesChanged(const Vector& inputDevices) = 0; /* Gets the keyboard layout for a particular input device. */ - virtual sp getKeyboardLayoutOverlay(const String8& inputDeviceDescriptor) = 0; + virtual sp getKeyboardLayoutOverlay( + const InputDeviceIdentifier& identifier) = 0; /* Gets a user-supplied alias for a particular input device, or an empty string if none. */ virtual String8 getDeviceAlias(const InputDeviceIdentifier& identifier) = 0; diff --git a/libs/input/tests/InputReader_test.cpp b/libs/input/tests/InputReader_test.cpp index f068732..aaa973d 100644 --- a/libs/input/tests/InputReader_test.cpp +++ b/libs/input/tests/InputReader_test.cpp @@ -186,7 +186,7 @@ private: mInputDevices = inputDevices; } - virtual sp getKeyboardLayoutOverlay(const String8& inputDeviceDescriptor) { + virtual sp getKeyboardLayoutOverlay(const InputDeviceIdentifier& identifier) { return NULL; } -- cgit v1.1