diff options
author | Jeff Brown <jeffbrown@google.com> | 2010-10-24 14:36:23 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-10-24 14:36:23 -0700 |
commit | 3ae4ac8538765d6cf5b8aceea8c81b21854321bd (patch) | |
tree | d0e8ae9e1117ce1aeebf375a2807de5ed95c0655 /include/ui/InputReader.h | |
parent | 4761b176ed241a88394968b983f06c5ae1aad26a (diff) | |
parent | 2ef36763700eff5679d6012e7f078c57f1a4c465 (diff) | |
download | frameworks_base-3ae4ac8538765d6cf5b8aceea8c81b21854321bd.zip frameworks_base-3ae4ac8538765d6cf5b8aceea8c81b21854321bd.tar.gz frameworks_base-3ae4ac8538765d6cf5b8aceea8c81b21854321bd.tar.bz2 |
am 2ef36763: am 860c2df4: Merge "Add unit tests for native input and fix bugs identified." into gingerbread
Merge commit '2ef36763700eff5679d6012e7f078c57f1a4c465'
* commit '2ef36763700eff5679d6012e7f078c57f1a4c465':
Add unit tests for native input and fix bugs identified.
Diffstat (limited to 'include/ui/InputReader.h')
-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 2d4bf8b..f3a2dd2 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; @@ -546,6 +549,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. |