diff options
author | Jeff Brown <jeffbrown@google.com> | 2010-10-24 14:31:41 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-10-24 14:31:41 -0700 |
commit | 2ef36763700eff5679d6012e7f078c57f1a4c465 (patch) | |
tree | 3b36010de56350d0b88914c4fbd729afa38acd00 /include | |
parent | b34fe2f0258eb1ed512b682206b7fe65116f1dbd (diff) | |
parent | 860c2df4132a2a0be9bcb0e91bfb7e79588c000f (diff) | |
download | frameworks_base-2ef36763700eff5679d6012e7f078c57f1a4c465.zip frameworks_base-2ef36763700eff5679d6012e7f078c57f1a4c465.tar.gz frameworks_base-2ef36763700eff5679d6012e7f078c57f1a4c465.tar.bz2 |
am 860c2df4: Merge "Add unit tests for native input and fix bugs identified." into gingerbread
Merge commit '860c2df4132a2a0be9bcb0e91bfb7e79588c000f' into gingerbread-plus-aosp
* commit '860c2df4132a2a0be9bcb0e91bfb7e79588c000f':
Add unit tests for native input and fix bugs identified.
Diffstat (limited to 'include')
-rw-r--r-- | include/ui/InputReader.h | 28 |
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. |