summaryrefslogtreecommitdiff
path: root/include/androidfw/Input.h
diff options
context:
space:
mode:
author Jeff Brown <jeffbrown@google.com> 2012-03-13 15:15:48 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2012-03-13 15:15:48 -0700
commit9dc348d75688faba645c03ecd6e72de7cecc87ba (patch)
tree5bf27444139c7889bcb966823c54c7da296410a2 /include/androidfw/Input.h
parentf2fbd2eda54cc6083d302ab00367af3db2b7e793 (diff)
parent2b6c32ca4177f1a97307f9cbd81ca485df28762c (diff)
Merge "Fix spurious ANRs in native activities."
Diffstat (limited to 'include/androidfw/Input.h')
-rw-r--r--include/androidfw/Input.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/androidfw/Input.h b/include/androidfw/Input.h
index f5db6e24e5d5..a4ebd95db552 100644
--- a/include/androidfw/Input.h
+++ b/include/androidfw/Input.h
@@ -616,6 +616,26 @@ private:
};
/*
+ * An input event factory implementation that maintains a pool of input events.
+ */
+class PooledInputEventFactory : public InputEventFactoryInterface {
+public:
+ PooledInputEventFactory(size_t maxPoolSize = 20);
+ virtual ~PooledInputEventFactory();
+
+ virtual KeyEvent* createKeyEvent();
+ virtual MotionEvent* createMotionEvent();
+
+ void recycle(InputEvent* event);
+
+private:
+ const size_t mMaxPoolSize;
+
+ Vector<KeyEvent*> mKeyEventPool;
+ Vector<MotionEvent*> mMotionEventPool;
+};
+
+/*
* Calculates the velocity of pointer movements over time.
*/
class VelocityTracker {