Add some defensive loggin in Android touch handling
Reviewed By: andreicoman11 Differential Revision: D3292369 fbshipit-source-id: 43315f7d8e81f1a0ec238c08c3cb689e6648fd0b
This commit is contained in:
parent
f2c1868b56
commit
31c8b3bd61
|
@ -81,6 +81,10 @@ public class TouchEventCoalescingKeyHelper {
|
||||||
* Stops tracking a new coalescing key corresponding to the gesture with this down time.
|
* Stops tracking a new coalescing key corresponding to the gesture with this down time.
|
||||||
*/
|
*/
|
||||||
public static void removeCoalescingKey(long downTime) {
|
public static void removeCoalescingKey(long downTime) {
|
||||||
|
int currentValue = sDownTimeToCoalescingKey.get((int) downTime, -1);
|
||||||
|
if (currentValue == -1) {
|
||||||
|
throw new RuntimeException("Tried to remove non-existent cookie");
|
||||||
|
}
|
||||||
sDownTimeToCoalescingKey.delete((int) downTime);
|
sDownTimeToCoalescingKey.delete((int) downTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,7 @@ public class RootViewTest {
|
||||||
ArgumentCaptor.forClass(JavaOnlyArray.class);
|
ArgumentCaptor.forClass(JavaOnlyArray.class);
|
||||||
|
|
||||||
rootView.onTouchEvent(
|
rootView.onTouchEvent(
|
||||||
MotionEvent.obtain(50, ts, MotionEvent.ACTION_UP, 0, 0, 0));
|
MotionEvent.obtain(100, ts, MotionEvent.ACTION_UP, 0, 0, 0));
|
||||||
verify(eventDispatcher).dispatchEvent(upEventCaptor.capture());
|
verify(eventDispatcher).dispatchEvent(upEventCaptor.capture());
|
||||||
verifyNoMoreInteractions(eventDispatcher);
|
verifyNoMoreInteractions(eventDispatcher);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue