summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2010-10-20 15:33:38 -0700
committerJeff Brown <jeffbrown@google.com>2010-10-23 03:52:57 -0700
commit3c3cc62e243a7796f5c1e88773d34e2054cc26c6 (patch)
tree48004ee9a8dcdcbb625d8fcc0ac3d2c45973d806 /include
parent48a862ef5f1a9fe9f646f0862d676170fd8dc51d (diff)
downloadframeworks_native-3c3cc62e243a7796f5c1e88773d34e2054cc26c6.zip
frameworks_native-3c3cc62e243a7796f5c1e88773d34e2054cc26c6.tar.gz
frameworks_native-3c3cc62e243a7796f5c1e88773d34e2054cc26c6.tar.bz2
Add unit tests for native input and fix bugs identified.
Fixed a bug where we would lose the first touch point when swiping out of the virtual key area. Fixed a bug where we would not send an ACTION_MOVE event in cases where individual pointers went down/up and the remaining pointers actually moved. This is important since many applications do not handle pointer movements during ACTION_POINTER_DOWN or ACTION_POINTER_UP. In the case of ACTION_POINTER_UP the movement was completely lost since all pointers were dispatched using their old location rather than the new location. Improved motion event validation to check for duplicate pointer ids. Added an input source constant that was missing from the NDK api but defined in the framework api. Added a timestamp when reporting added/removed devices in EventHub. Bug: 3070082 Change-Id: I3206a030f43b7616e2f48006e5a9d522c4d92e56
Diffstat (limited to 'include')
-rw-r--r--include/ui/InputReader.h28
1 files changed, 23 insertions, 5 deletions
diff --git a/include/ui/InputReader.h b/include/ui/InputReader.h
index 923cdbf..49351b0 100644
--- a/include/ui/InputReader.h
+++ b/include/ui/InputReader.h
@@ -170,11 +170,10 @@ public:
* and parameters maintained by the input reader.
*/
class InputReaderContext {
-protected:
+public:
InputReaderContext() { }
virtual ~InputReaderContext() { }
-public:
virtual void updateGlobalMetaState() = 0;
virtual int32_t getGlobalMetaState() = 0;
@@ -193,7 +192,7 @@ public:
* the input reader, the input reader never calls into other components while holding
* an exclusive internal lock whenever re-entrance can happen.
*/
-class InputReader : public InputReaderInterface, private InputReaderContext {
+class InputReader : public InputReaderInterface, protected InputReaderContext {
public:
InputReader(const sp<EventHubInterface>& eventHub,
const sp<InputReaderPolicyInterface>& policy,
@@ -219,6 +218,11 @@ public:
virtual bool hasKeys(int32_t deviceId, uint32_t sourceMask,
size_t numCodes, const int32_t* keyCodes, uint8_t* outFlags);
+protected:
+ // These methods are protected virtual so they can be overridden and instrumented
+ // by test cases.
+ virtual InputDevice* createDevice(int32_t deviceId, const String8& name, uint32_t classes);
+
private:
sp<EventHubInterface> mEventHub;
sp<InputReaderPolicyInterface> mPolicy;
@@ -244,12 +248,11 @@ private:
void addDevice(int32_t deviceId);
void removeDevice(int32_t deviceId);
- InputDevice* createDevice(int32_t deviceId, const String8& name, uint32_t classes);
void configureExcludedDevices();
void consumeEvent(const RawEvent* rawEvent);
- void handleConfigurationChanged();
+ void handleConfigurationChanged(nsecs_t when);
// state management for all devices
Mutex mStateLock;
@@ -533,6 +536,21 @@ protected:
int32_t toolMajor;
int32_t toolMinor;
int32_t orientation;
+
+ inline bool operator== (const PointerData& other) const {
+ return id == other.id
+ && x == other.x
+ && y == other.y
+ && pressure == other.pressure
+ && touchMajor == other.touchMajor
+ && touchMinor == other.touchMinor
+ && toolMajor == other.toolMajor
+ && toolMinor == other.toolMinor
+ && orientation == other.orientation;
+ }
+ inline bool operator!= (const PointerData& other) const {
+ return !(*this == other);
+ }
};
// Raw data for a collection of pointers including a pointer id mapping table.