Query input device for initial slot index.
This fixes a problem where touches can get stuck because the
driver and the framework have different ideas of what the
initial slot index is. The framework assumed it was slot 0
but it could in principle be any slot, such as slot 1. When
that happened, the framework would start tracking the first
touch as slot 0, but it might never receive an "up" for that slot.
Change-Id: Idaffc4534b275d66b9d4360987b28dc2d0f63218
diff --git a/services/input/InputDispatcher.cpp b/services/input/InputDispatcher.cpp
index 85ce38a..10b9083 100644
--- a/services/input/InputDispatcher.cpp
+++ b/services/input/InputDispatcher.cpp
@@ -1239,8 +1239,9 @@
const InputWindow* newHoverWindow = NULL;
bool isSplit = mTouchState.split;
- bool switchedDevice = mTouchState.deviceId != entry->deviceId
- || mTouchState.source != entry->source;
+ bool switchedDevice = mTouchState.deviceId >= 0
+ && (mTouchState.deviceId != entry->deviceId
+ || mTouchState.source != entry->source);
bool isHoverAction = (maskedAction == AMOTION_EVENT_ACTION_HOVER_MOVE
|| maskedAction == AMOTION_EVENT_ACTION_HOVER_ENTER
|| maskedAction == AMOTION_EVENT_ACTION_HOVER_EXIT);