1*bf47c682SAndroid Build Coastguard Worker## Tap latency 2*bf47c682SAndroid Build Coastguard Worker 3*bf47c682SAndroid Build Coastguard Worker * [Video demonstration of tap latency measurement](https://www.youtube.com/watch?v=1xAReF75Cts&list=PLd6Fi7WgXfcCEJg1FDqNCoQfpWo7W3J5a&index=2) 4*bf47c682SAndroid Build Coastguard Worker * [Detailed instructions on how to perform the measurement in usage doc](usage/WALT_usage.md#tap-latency). 5*bf47c682SAndroid Build Coastguard Worker 6*bf47c682SAndroid Build Coastguard WorkerWALT uses a “stylus” equipped with an accelerometer. The finger is imitated by a flat metal 7*bf47c682SAndroid Build Coastguard Workertip that is grounded, pretty much any rigid tip can be used as long as it triggers the touch sensor. 8*bf47c682SAndroid Build Coastguard WorkerWhen the stylus “collides” with touch screen the accelerometer senses a shock (above 3g) which is 9*bf47c682SAndroid Build Coastguard Workertimestamped by the Teensy. In order to generate a similar shock when picking the stylus up from the 10*bf47c682SAndroid Build Coastguard Workerscreen, the conductive surface and the accelerometer are mounted on a button of a retractable pen. 11*bf47c682SAndroid Build Coastguard WorkerOn the way up, the spring keeps the button in contact with the touch screen for the first few mm of 12*bf47c682SAndroid Build Coastguard Workermotion. This allows the hand holding the main part of the pen to gain some speed to which the button is 13*bf47c682SAndroid Build Coastguard Workerthen abruptly accelerated generating an easily detectable shock. 14*bf47c682SAndroid Build Coastguard Worker 15*bf47c682SAndroid Build Coastguard WorkerLinux [Multi Touch (MT)](https://www.kernel.org/doc/Documentation/input/multi-touch-protocol.txt) 16*bf47c682SAndroid Build Coastguard Workerimplementation timestamps touch events in the kernel as they arrive from the hardware. On Android 17*bf47c682SAndroid Build Coastguard Workerthe MT events are then exposed in Java as 18*bf47c682SAndroid Build Coastguard Worker[MotionEvent](http://developer.android.com/reference/android/view/MotionEvent.html) 19*bf47c682SAndroid Build Coastguard Workerand include the kernel timestamp. For tap, the relevant MotionEvent types are 20*bf47c682SAndroid Build Coastguard WorkerACTION_DOWN and ACTION_UP. 21*bf47c682SAndroid Build Coastguard Worker 22*bf47c682SAndroid Build Coastguard WorkerSample measurements 23*bf47c682SAndroid Build Coastguard Worker 24*bf47c682SAndroid Build Coastguard Worker| Device | OS version | ACTION_DOWN [ms]| ACTION_UP [ms]| Kernel to Java [ms] | 25*bf47c682SAndroid Build Coastguard Worker| :--- | :--- | ---: | ---: | ---: | 26*bf47c682SAndroid Build Coastguard Worker| Nexus 5 | M4B30Z (6.0.1) | 26.9 | 15.9 | 3.3 | 27*bf47c682SAndroid Build Coastguard Worker| Nexus 5X | NRD91P (7.0) | 25.0 | 22.5 | 2.4 | 28*bf47c682SAndroid Build Coastguard Worker| Nexus 7 | LMY47Q (5.1) | 29.6 | 31.0 | 1.4 | 29*bf47c682SAndroid Build Coastguard Worker| Nexus 9 | MMB29K (6.0.1) | 18.7 | 19.9 | 1.3 | 30*bf47c682SAndroid Build Coastguard Worker| Pixel C | NMF26H (7.1.1) | 23.8 | 24.3 | 1.1 | 31*bf47c682SAndroid Build Coastguard Worker| Pixel | NHG47K (7.1.2) | 9.6 | 28.1 | 2.0 | 32*bf47c682SAndroid Build Coastguard Worker| Pixel XL | NHG47K (7.1.2) | 14.2 | 14.4 | 1.8 | 33*bf47c682SAndroid Build Coastguard Worker 34*bf47c682SAndroid Build Coastguard Worker 35*bf47c682SAndroid Build Coastguard Worker 36*bf47c682SAndroid Build Coastguard Worker 37*bf47c682SAndroid Build Coastguard Worker 38