summaryrefslogtreecommitdiff
path: root/libs/ui/Input.cpp
diff options
context:
space:
mode:
author Jeff Brown <jeffbrown@google.com> 2010-07-23 21:28:06 -0700
committer Jeff Brown <jeffbrown@google.com> 2010-07-28 14:16:15 -0700
commit6d0fec2de3601821f4f44eeb7d7deedebb2b7117 (patch)
tree9fdea32c5691a6d0bcb3085df47f42a8e6ecd565 /libs/ui/Input.cpp
parentb350bec514eb9fee473e4ef62680c53e992dc49b (diff)
Refactor input reader to support new device types more easily.
Refactored the input reader so that each raw input protocol is handled by a separate subclass of the new InputMapper type. This way, behaviors pertaining to keyboard, trackballs, touchscreens, switches and other devices are clearly distinguished for improved maintainability. Added partial support for describing capabilities of input devices (incomplete and untested for now, will be fleshed out in later commits). Simplified EventHub interface somewhat since InputReader is taking over more of the work. Cleaned up some of the interactions between InputManager and WindowManagerService related to reading input state. Fixed swiping finger from screen edge into display area. Added logging of device information to 'dumpsys window'. Change-Id: I17faffc33e3aec3a0f33f0b37e81a70609378612
Diffstat (limited to 'libs/ui/Input.cpp')
-rw-r--r--libs/ui/Input.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/libs/ui/Input.cpp b/libs/ui/Input.cpp
index 5253c72aa382..5fbaf0961bfb 100644
--- a/libs/ui/Input.cpp
+++ b/libs/ui/Input.cpp
@@ -168,4 +168,63 @@ void MotionEvent::offsetLocation(float xOffset, float yOffset) {
mYOffset += yOffset;
}
+// class InputDeviceInfo
+
+InputDeviceInfo::InputDeviceInfo() {
+ initialize(-1, String8("uninitialized device info"));
+}
+
+InputDeviceInfo::InputDeviceInfo(const InputDeviceInfo& other) :
+ mId(other.mId), mName(other.mName), mSources(other.mSources),
+ mKeyboardType(other.mKeyboardType),
+ mMotionRanges(other.mMotionRanges) {
+}
+
+InputDeviceInfo::~InputDeviceInfo() {
+}
+
+void InputDeviceInfo::initialize(int32_t id, const String8& name) {
+ mId = id;
+ mName = name;
+ mSources = 0;
+ mKeyboardType = AINPUT_KEYBOARD_TYPE_NONE;
+ mMotionRanges.clear();
+}
+
+const InputDeviceInfo::MotionRange* InputDeviceInfo::getMotionRange(int32_t rangeType) const {
+ ssize_t index = mMotionRanges.indexOfKey(rangeType);
+ return index >= 0 ? & mMotionRanges.valueAt(index) : NULL;
+}
+
+void InputDeviceInfo::addSource(uint32_t source) {
+ mSources |= source;
+}
+
+void InputDeviceInfo::addMotionRange(int32_t rangeType, float min, float max,
+ float flat, float fuzz) {
+ MotionRange range = { min, max, flat, fuzz };
+ addMotionRange(rangeType, range);
+}
+
+void InputDeviceInfo::addMotionRange(int32_t rangeType, const MotionRange& range) {
+ mMotionRanges.add(rangeType, range);
+}
+
+// class InputDeviceProxy
+
+InputDeviceProxy::InputDeviceProxy() {
+}
+
+InputDeviceProxy::~InputDeviceProxy() {
+}
+
+void InputDeviceProxy::getDeviceIds(Vector<int32_t>& outIds) {
+ // TODO use Binder
+}
+
+sp<InputDeviceProxy> InputDeviceProxy::getDevice(int32_t id) {
+ // TODO use Binder
+ return NULL;
+}
+
} // namespace android