Loading core/java/android/provider/Settings.java +8 −0 Original line number Diff line number Diff line Loading @@ -2008,6 +2008,13 @@ public final class Settings { */ public static final String SHOW_TOUCHES = "show_touches"; /** * The keylayout that will be used by EventHub instead of the default * one. * @hide */ public static final String KEYLAYOUT_OVERRIDES = "keylayout"; /** * Log raw orientation data from {@link WindowOrientationListener} for use with the * orientationplot.py tool. Loading Loading @@ -2458,6 +2465,7 @@ public final class Settings { QUIET_HOURS_MUTE, QUIET_HOURS_STILL, QUIET_HOURS_DIM, KEYLAYOUT_OVERRIDES, }; // Settings moved to Settings.Secure Loading services/input/EventHub.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -1016,6 +1016,16 @@ status_t EventHub::openDeviceLocked(const char *devicePath) { // We need to do this for joysticks too because the key layout may specify axes. status_t keyMapStatus = NAME_NOT_FOUND; if (device->classes & (INPUT_DEVICE_CLASS_KEYBOARD | INPUT_DEVICE_CLASS_JOYSTICK)) { String8 layout; if (mOrKeyLayouts.tryGetProperty(device->identifier.name, layout)) { LOGI("Replacing key layout and character map of %s with %s", device->identifier.name.string(), layout.string()); if (!device->configuration) { device->configuration = new PropertyMap(); } device->configuration->addProperty(String8("keyboard.layout"), layout); device->configuration->addProperty(String8("keyboard.characterMap"), layout); } // Load the keymap for the device. keyMapStatus = loadKeyMapLocked(device); } Loading Loading @@ -1333,5 +1343,9 @@ void EventHub::monitor() { mLock.unlock(); } void EventHub::setKeyLayout(const char* deviceName, const char* keyLayout) { mOrKeyLayouts.addProperty(String8(deviceName), String8(keyLayout)); } }; // namespace android services/input/EventHub.h +7 −0 Original line number Diff line number Diff line Loading @@ -221,6 +221,8 @@ public: /* Called by the heatbeat to ensures that the reader has not deadlocked. */ virtual void monitor() = 0; virtual void setKeyLayout(const char* deviceName, const char* keyLayout) = 0; }; class EventHub : public EventHubInterface Loading Loading @@ -275,6 +277,8 @@ public: virtual void dump(String8& dump); virtual void monitor(); virtual void setKeyLayout(const char* deviceName, const char* keyLayout); protected: virtual ~EventHub(); Loading Loading @@ -370,6 +374,9 @@ private: // Set to the number of CPUs. int32_t mNumCpus; // List of key layouts and character maps to be overridden PropertyMap mOrKeyLayouts; }; }; // namespace android Loading services/input/InputReader.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -700,6 +700,11 @@ void InputReader::requestRefreshConfiguration(uint32_t changes) { } } void InputReader::setKeyLayout(const char* deviceName, const char* keyLayout) { AutoMutex _l(mLock); mEventHub->setKeyLayout(deviceName, keyLayout); } void InputReader::dump(String8& dump) { AutoMutex _l(mLock); Loading services/input/InputReader.h +6 −0 Original line number Diff line number Diff line Loading @@ -267,6 +267,10 @@ public: * The changes flag is a bitfield that indicates what has changed and whether * the input devices must all be reopened. */ virtual void requestRefreshConfiguration(uint32_t changes) = 0; /* Sets a specific input device's keyLayout to be overridden by filename. */ virtual void setKeyLayout(const char* deviceName, const char* keyLayout) = 0; }; Loading Loading @@ -335,6 +339,8 @@ public: virtual void requestRefreshConfiguration(uint32_t changes); virtual void setKeyLayout(const char* deviceName, const char* keyLayout); protected: // These members are protected so they can be instrumented by test cases. virtual InputDevice* createDeviceLocked(int32_t deviceId, Loading Loading
core/java/android/provider/Settings.java +8 −0 Original line number Diff line number Diff line Loading @@ -2008,6 +2008,13 @@ public final class Settings { */ public static final String SHOW_TOUCHES = "show_touches"; /** * The keylayout that will be used by EventHub instead of the default * one. * @hide */ public static final String KEYLAYOUT_OVERRIDES = "keylayout"; /** * Log raw orientation data from {@link WindowOrientationListener} for use with the * orientationplot.py tool. Loading Loading @@ -2458,6 +2465,7 @@ public final class Settings { QUIET_HOURS_MUTE, QUIET_HOURS_STILL, QUIET_HOURS_DIM, KEYLAYOUT_OVERRIDES, }; // Settings moved to Settings.Secure Loading
services/input/EventHub.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -1016,6 +1016,16 @@ status_t EventHub::openDeviceLocked(const char *devicePath) { // We need to do this for joysticks too because the key layout may specify axes. status_t keyMapStatus = NAME_NOT_FOUND; if (device->classes & (INPUT_DEVICE_CLASS_KEYBOARD | INPUT_DEVICE_CLASS_JOYSTICK)) { String8 layout; if (mOrKeyLayouts.tryGetProperty(device->identifier.name, layout)) { LOGI("Replacing key layout and character map of %s with %s", device->identifier.name.string(), layout.string()); if (!device->configuration) { device->configuration = new PropertyMap(); } device->configuration->addProperty(String8("keyboard.layout"), layout); device->configuration->addProperty(String8("keyboard.characterMap"), layout); } // Load the keymap for the device. keyMapStatus = loadKeyMapLocked(device); } Loading Loading @@ -1333,5 +1343,9 @@ void EventHub::monitor() { mLock.unlock(); } void EventHub::setKeyLayout(const char* deviceName, const char* keyLayout) { mOrKeyLayouts.addProperty(String8(deviceName), String8(keyLayout)); } }; // namespace android
services/input/EventHub.h +7 −0 Original line number Diff line number Diff line Loading @@ -221,6 +221,8 @@ public: /* Called by the heatbeat to ensures that the reader has not deadlocked. */ virtual void monitor() = 0; virtual void setKeyLayout(const char* deviceName, const char* keyLayout) = 0; }; class EventHub : public EventHubInterface Loading Loading @@ -275,6 +277,8 @@ public: virtual void dump(String8& dump); virtual void monitor(); virtual void setKeyLayout(const char* deviceName, const char* keyLayout); protected: virtual ~EventHub(); Loading Loading @@ -370,6 +374,9 @@ private: // Set to the number of CPUs. int32_t mNumCpus; // List of key layouts and character maps to be overridden PropertyMap mOrKeyLayouts; }; }; // namespace android Loading
services/input/InputReader.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -700,6 +700,11 @@ void InputReader::requestRefreshConfiguration(uint32_t changes) { } } void InputReader::setKeyLayout(const char* deviceName, const char* keyLayout) { AutoMutex _l(mLock); mEventHub->setKeyLayout(deviceName, keyLayout); } void InputReader::dump(String8& dump) { AutoMutex _l(mLock); Loading
services/input/InputReader.h +6 −0 Original line number Diff line number Diff line Loading @@ -267,6 +267,10 @@ public: * The changes flag is a bitfield that indicates what has changed and whether * the input devices must all be reopened. */ virtual void requestRefreshConfiguration(uint32_t changes) = 0; /* Sets a specific input device's keyLayout to be overridden by filename. */ virtual void setKeyLayout(const char* deviceName, const char* keyLayout) = 0; }; Loading Loading @@ -335,6 +339,8 @@ public: virtual void requestRefreshConfiguration(uint32_t changes); virtual void setKeyLayout(const char* deviceName, const char* keyLayout); protected: // These members are protected so they can be instrumented by test cases. virtual InputDevice* createDeviceLocked(int32_t deviceId, Loading