From af9e8d38184c6ba4d2d3eb5bde7014a66dd8a78b Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Thu, 12 Apr 2012 17:32:48 -0700 Subject: Notify applications when input devices change. This change allows the InputManager to keep track of what input devices are registered with the system and when they change. It needs to do this so that it can properly clear its cache of input device properties (especially the key map!) when changes occur. Added new API so that applications can register listeners for input device changes. Fixed a minor bug in EventHub where it didn't handle EPOLLHUP properly so it would spam the log about unsupposed epoll events until inotify noticed that the device was gone and removed it. Change-Id: I937d8c601f7185d4299038bce6a2934fe4fdd2b3 --- libs/androidfw/InputDevice.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'libs/androidfw/InputDevice.cpp') diff --git a/libs/androidfw/InputDevice.cpp b/libs/androidfw/InputDevice.cpp index 698feb695bf5..6bb06a929592 100644 --- a/libs/androidfw/InputDevice.cpp +++ b/libs/androidfw/InputDevice.cpp @@ -127,11 +127,12 @@ String8 getInputDeviceConfigurationFilePathByName( // --- InputDeviceInfo --- InputDeviceInfo::InputDeviceInfo() { - initialize(-1, String8("uninitialized device info"), String8("unknown")); + initialize(-1, -1, String8("uninitialized device info"), String8("unknown")); } InputDeviceInfo::InputDeviceInfo(const InputDeviceInfo& other) : - mId(other.mId), mName(other.mName), mDescriptor(other.mDescriptor), + mId(other.mId), mGeneration(other.mGeneration), + mName(other.mName), mDescriptor(other.mDescriptor), mSources(other.mSources), mKeyboardType(other.mKeyboardType), mKeyCharacterMap(other.mKeyCharacterMap), @@ -141,8 +142,10 @@ InputDeviceInfo::InputDeviceInfo(const InputDeviceInfo& other) : InputDeviceInfo::~InputDeviceInfo() { } -void InputDeviceInfo::initialize(int32_t id, const String8& name, const String8& descriptor) { +void InputDeviceInfo::initialize(int32_t id, int32_t generation, + const String8& name, const String8& descriptor) { mId = id; + mGeneration = generation; mName = name; mDescriptor = descriptor; mSources = 0; -- cgit v1.2.3-59-g8ed1b