More touch logging

Reviewed By: andreicoman11

Differential Revision: D3298518

fbshipit-source-id: 0ddbba5c05848ac164f6f1562b26609924978169
This commit is contained in:
Dave Miller 2016-05-16 02:33:50 -07:00 committed by Facebook Github Bot 8
parent fa5d1fefa1
commit ccef1b2941
2 changed files with 17 additions and 1 deletions

View File

@ -18,6 +18,7 @@ import com.facebook.react.common.ReactConstants;
import com.facebook.react.common.SystemClock;
import com.facebook.react.uimanager.events.EventDispatcher;
import com.facebook.react.uimanager.events.TouchEvent;
import com.facebook.react.uimanager.events.TouchEventCoalescingKeyHelper;
import com.facebook.react.uimanager.events.TouchEventType;
/**
@ -137,7 +138,14 @@ public class JSTouchDispatcher {
mTargetCoordinates[0],
mTargetCoordinates[1]));
} else if (action == MotionEvent.ACTION_CANCEL) {
dispatchCancelEvent(ev, eventDispatcher);
if (TouchEventCoalescingKeyHelper.hasCoalescingKey(ev.getDownTime())) {
dispatchCancelEvent(ev, eventDispatcher);
} else {
FLog.e(
ReactConstants.TAG,
"Received an ACTION_CANCEL touch event for which we have no corresponding ACTION_DOWN"
);
}
mTargetTag = -1;
} else {
FLog.w(

View File

@ -83,4 +83,12 @@ public class TouchEventCoalescingKeyHelper {
public static void removeCoalescingKey(long downTime) {
sDownTimeToCoalescingKey.delete((int) downTime);
}
public static boolean hasCoalescingKey(long downTime) {
int currentValue = sDownTimeToCoalescingKey.get((int) downTime, -1);
if (currentValue == -1) {
return false;
}
return true;
}
}