summaryrefslogtreecommitdiff
path: root/include/androidfw/Input.h
diff options
context:
space:
mode:
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 {