xref: /aosp_15_r20/external/walt/docs/usage/WALT_usage.md (revision bf47c6829f95be9dd55f4c5bbc44a71c90aad403)
1*bf47c682SAndroid Build Coastguard Worker# WALT Setup
2*bf47c682SAndroid Build Coastguard Worker
3*bf47c682SAndroid Build Coastguard WorkerWALT (**W**hat an **A**wesome **L**atency **T**ester) is a tool for testing latency on Android devices.
4*bf47c682SAndroid Build Coastguard WorkerThis document will show you how to set up and use your WALT.
5*bf47c682SAndroid Build Coastguard Worker
6*bf47c682SAndroid Build Coastguard WorkerAbout WALT:
7*bf47c682SAndroid Build Coastguard Worker
8*bf47c682SAndroid Build Coastguard Worker * Source code: https://github.com/google/walt
9*bf47c682SAndroid Build Coastguard Worker * YouTube [playlist 1](https://www.youtube.com/playlist?list=PLd6Fi7WgXfcCEJg1FDqNCoQfpWo7W3J5a) and [playlist 2](https://www.youtube.com/playlist?list=PLd6Fi7WgXfcB4Ma6A-5rPlr1jptNR3RxQ)
10*bf47c682SAndroid Build Coastguard Worker * [Android Developers blog post](http://android-developers.blogspot.com/2016/04/a-new-method-to-measure-touch-and-audio.html)
11*bf47c682SAndroid Build Coastguard Worker
12*bf47c682SAndroid Build Coastguard Worker## Prerequisites
13*bf47c682SAndroid Build Coastguard Worker
14*bf47c682SAndroid Build Coastguard WorkerWALT kit:
15*bf47c682SAndroid Build Coastguard Worker * Assembled WALT PCB and base, with DIP socket for Teensy LC
16*bf47c682SAndroid Build Coastguard Worker * [Teensy LC](http://www.pjrc.com/teensy/teensyLC.html) inserted into DIP socket
17*bf47c682SAndroid Build Coastguard Worker * 3.5mm male-to-male TRRS cable
18*bf47c682SAndroid Build Coastguard Worker    ([like this](http://www.infinitecables.com/audio-and-pro-audio-cables/3.5mm-cables/3.5mm-male-to-3.5mm-male-4c/3.5mm-male-to-3.5mm-male-4c-black/2ft-3.5mm-4c-male-to-male-28awg-ft4-black/))
19*bf47c682SAndroid Build Coastguard Worker * Pen modified to replace the top button by a male TS
20*bf47c682SAndroid Build Coastguard Worker * Optional: laser pointer for measuring touch drag latency
21*bf47c682SAndroid Build Coastguard Worker
22*bf47c682SAndroid Build Coastguard WorkerIf anything is missing from the list above, please contact the person from whom you received your WALT.
23*bf47c682SAndroid Build Coastguard Worker
24*bf47c682SAndroid Build Coastguard WorkerA test device and cables:
25*bf47c682SAndroid Build Coastguard Worker * Android device with USB micro-B female or type C female and a 3.5mm headset jack
26*bf47c682SAndroid Build Coastguard Worker * USB OTG (On-The-Go) adapter for your Android device (Examples: [A female to C male](https://store.google.com/product/usb_type_c_to_usb_standard_a_adapter), [A female to micro-B male](https://www.amazon.com/Cable-Matters-Micro-USB-Adapter-6-Inch/dp/B00GM0OZ4O))
27*bf47c682SAndroid Build Coastguard Worker * USB [Micro-B male to A male](http://www.staples.com/Staples-6-USB-to-Micro-B-Cable-18809-/product_837384) (the usual one we used for everything before type-C)
28*bf47c682SAndroid Build Coastguard Worker * Laser pointer, if not supplied in the kit
29*bf47c682SAndroid Build Coastguard Worker
30*bf47c682SAndroid Build Coastguard Worker![WALT setup](images/WALT_setup.png)
31*bf47c682SAndroid Build Coastguard Worker
32*bf47c682SAndroid Build Coastguard Worker
33*bf47c682SAndroid Build Coastguard Worker## Setup
34*bf47c682SAndroid Build Coastguard Worker
35*bf47c682SAndroid Build Coastguard Worker[Video demonstration](https://www.youtube.com/watch?v=qR48GPepyxU&list=PLd6Fi7WgXfcB4Ma6A-5rPlr1jptNR3RxQ&index=2)
36*bf47c682SAndroid Build Coastguard Worker
37*bf47c682SAndroid Build Coastguard Worker * Install and run the [WALT Android App](https://play.google.com/store/apps/details?id=org.kamrik.latency.walt&hl=en)
38*bf47c682SAndroid Build Coastguard Worker * Connect WALT to the Android headset using the 3.5mm male to male TRRS cable
39*bf47c682SAndroid Build Coastguard Worker * Connect WALT to the Android USB port using the cables above. (see photo at top of doc)
40*bf47c682SAndroid Build Coastguard Worker * You may be prompted to grant the WALT app permission to use the USB, tap "OK"
41*bf47c682SAndroid Build Coastguard Worker * All 3 LEDs will light up when WALT receives power (see photo below), they will be turned off once the app synchronizes clocks with WALT.
42*bf47c682SAndroid Build Coastguard Worker
43*bf47c682SAndroid Build Coastguard Worker
44*bf47c682SAndroid Build Coastguard Worker## Programming the WALT firmware
45*bf47c682SAndroid Build Coastguard Worker
46*bf47c682SAndroid Build Coastguard Worker1.  Launch the app, the main screen is pictured below.
47*bf47c682SAndroid Build Coastguard Worker1.  Verify you have the [latest version](https://github.com/google/walt/blob/master/android/WALT/app/build.gradle#L13) installed by tapping on "View log"
48*bf47c682SAndroid Build Coastguard Worker1.  Tap "Clock sync" on main menu.
49*bf47c682SAndroid Build Coastguard Worker1.  Press the Teensy reset button (see photo below)
50*bf47c682SAndroid Build Coastguard Worker1.  Tap "Reprogram WALT"
51*bf47c682SAndroid Build Coastguard Worker1.  At this stage you will see several USB permission dialogs. Confirm them all by pressing OK. This is due to WALT presenting itself as different USB devices during reprogramming and normal operation
52*bf47c682SAndroid Build Coastguard Worker1.  All 3 LEDs will light briefly (see photo below)
53*bf47c682SAndroid Build Coastguard Worker1.  Tap "Reconnect"
54*bf47c682SAndroid Build Coastguard Worker1.  Verify that the WALT device has been programmed correctly by running one of the tests below
55*bf47c682SAndroid Build Coastguard Worker
56*bf47c682SAndroid Build Coastguard Worker![WALT app screenshot](images/screenshot.png "WALT app main screen")
57*bf47c682SAndroid Build Coastguard Worker![Teensy reset and reprogram](images/reprogram.jpg "Click Teensy reset button then reprogram WALT from the app")
58*bf47c682SAndroid Build Coastguard Worker
59*bf47c682SAndroid Build Coastguard Worker
60*bf47c682SAndroid Build Coastguard WorkerBelow is an example of WALT app log when it starts and successfully connects
61*bf47c682SAndroid Build Coastguard Workerto a WALT device. Note the first line and make sure that you use the latest
62*bf47c682SAndroid Build Coastguard Workerversion. The last line means that the WALT device clock is behind the Android
63*bf47c682SAndroid Build Coastguard Workerclock but by no more than 161 microseconds. Values about about 1000 us are a
64*bf47c682SAndroid Build Coastguard Workersign of clock synchronization problems.
65*bf47c682SAndroid Build Coastguard Worker
66*bf47c682SAndroid Build Coastguard Worker
67*bf47c682SAndroid Build Coastguard Worker```
68*bf47c682SAndroid Build Coastguard WorkerWALT v0.1.5  (versionCode=6)
69*bf47c682SAndroid Build Coastguard WorkerWALT protocol version 4
70*bf47c682SAndroid Build Coastguard WorkerDEVICE INFO:
71*bf47c682SAndroid Build Coastguard Worker  google/volantis/flounder:6.0.1/MMB29K/2419427:user/release-keys
72*bf47c682SAndroid Build Coastguard Worker  Build.SDK_INT=23
73*bf47c682SAndroid Build Coastguard Worker  os.version=3.10.40-ga54a4f4
74*bf47c682SAndroid Build Coastguard WorkerRequesting permission for USB device.
75*bf47c682SAndroid Build Coastguard WorkerInterface claimed successfully
76*bf47c682SAndroid Build Coastguard Worker
77*bf47c682SAndroid Build Coastguard WorkerSynced clocks, maxE=161us
78*bf47c682SAndroid Build Coastguard Worker```
79*bf47c682SAndroid Build Coastguard Worker
80*bf47c682SAndroid Build Coastguard Worker# Running the latency tests
81*bf47c682SAndroid Build Coastguard Worker
82*bf47c682SAndroid Build Coastguard WorkerThis section describes how to run each test and interpret the results.
83*bf47c682SAndroid Build Coastguard Worker
84*bf47c682SAndroid Build Coastguard Worker
85*bf47c682SAndroid Build Coastguard Worker## Audio input latency (microphone)
86*bf47c682SAndroid Build Coastguard Worker
87*bf47c682SAndroid Build Coastguard WorkerThe Teensy will generate a pulse of audio data which will be received at the 3.5mm headset jack. The time delta between the audio pulse being generated and being received by the WALT application is measured.
88*bf47c682SAndroid Build Coastguard Worker
89*bf47c682SAndroid Build Coastguard Worker * Tap "Audio latency"
90*bf47c682SAndroid Build Coastguard Worker * Tap the microphone icon in the top left
91*bf47c682SAndroid Build Coastguard Worker * Wait for results
92*bf47c682SAndroid Build Coastguard Worker
93*bf47c682SAndroid Build Coastguard Worker
94*bf47c682SAndroid Build Coastguard WorkerBelow is the output of a test on Nexus 9. The last two lines show the 6 individual measurements and their median. The time measured here is the time that passed from the recording of the _last_ frame in the buffer and until the software callback fired. The length of the optimal buffer in time units can be calculated using the first two lines: 128 frames divided by 48kHz frame rate is about 2.67 ms.
95*bf47c682SAndroid Build Coastguard Worker
96*bf47c682SAndroid Build Coastguard Worker
97*bf47c682SAndroid Build Coastguard Worker```
98*bf47c682SAndroid Build Coastguard WorkerOptimal frame rate is: 48000
99*bf47c682SAndroid Build Coastguard WorkerOptimal frames per buffer is: 128
100*bf47c682SAndroid Build Coastguard WorkerAudio engine created
101*bf47c682SAndroid Build Coastguard WorkerAudio recorder created; starting test
102*bf47c682SAndroid Build Coastguard WorkerSynced clocks, maxE=154us
103*bf47c682SAndroid Build Coastguard WorkerBeeped, reply: 1039241
104*bf47c682SAndroid Build Coastguard WorkerProcessed: L_cb = 1.167 ms, L_eq = 171.558 ms, noisy frame = 16799
105*bf47c682SAndroid Build Coastguard Worker...
106*bf47c682SAndroid Build Coastguard WorkerBeeped, reply: 13621259
107*bf47c682SAndroid Build Coastguard WorkerProcessed: L_cb = 0.907 ms, L_eq = 203.991 ms, noisy frame = 14465
108*bf47c682SAndroid Build Coastguard WorkerRemote clock delayed between -30 and 892 us
109*bf47c682SAndroid Build Coastguard Workerdeltas: [1.1671666666666278, 1.1871666666666278, 0.984, 0.9981666666666279, 1.7278333333333722, 0.9071666666666278]
110*bf47c682SAndroid Build Coastguard WorkerMedian audio recording latency 1.1 ms
111*bf47c682SAndroid Build Coastguard Worker```
112*bf47c682SAndroid Build Coastguard Worker
113*bf47c682SAndroid Build Coastguard Worker## Audio output latency
114*bf47c682SAndroid Build Coastguard Worker
115*bf47c682SAndroid Build Coastguard WorkerThe WALT app will generate a pulse of audio data which will be transmitted over the 3.5mm headset jack and received by the Teensy. The time delta between audio being transmitted by the app and received by the Teensy is measured
116*bf47c682SAndroid Build Coastguard Worker
117*bf47c682SAndroid Build Coastguard Worker * Set volume to maximum in Settings -> Sound
118*bf47c682SAndroid Build Coastguard Worker * Tap "Audio latency"
119*bf47c682SAndroid Build Coastguard Worker * Tap the play button ▶ in the top right
120*bf47c682SAndroid Build Coastguard Worker * Results are displayed in the log window, example below.
121*bf47c682SAndroid Build Coastguard Worker
122*bf47c682SAndroid Build Coastguard Worker```
123*bf47c682SAndroid Build Coastguard WorkerBeeping...
124*bf47c682SAndroid Build Coastguard WorkerBeeped, dtJ2N = 0.059 ms
125*bf47c682SAndroid Build Coastguard Workerbeep detected, total latency = 10.44, normal latency = 10.09, mInitiatedBeeps = 1, mDetectedBeeps = 1
126*bf47c682SAndroid Build Coastguard Worker...
127*bf47c682SAndroid Build Coastguard WorkerRemote clock delayed between -53 and 349 us
128*bf47c682SAndroid Build Coastguard Workerdeltas: [10.439, 12.272, 11.708, 12.194, 12.919, 11.458, 12.985, 10.914, 10.935, 10.631]
129*bf47c682SAndroid Build Coastguard WorkerMedian Java to native latency 0.006 ms
130*bf47c682SAndroid Build Coastguard WorkerMedian total audio latency 11.6 ms
131*bf47c682SAndroid Build Coastguard WorkerMedian callback to output time 9.9 ms
132*bf47c682SAndroid Build Coastguard Worker```
133*bf47c682SAndroid Build Coastguard Worker
134*bf47c682SAndroid Build Coastguard WorkerThe callback to output time on the last line, 9.9 ms is the time from the execution of the
135*bf47c682SAndroid Build Coastguard Worker[OpenSLES BufferQueue callback that enqueued the buffer](https://github.com/google/walt/blob/master/android/WALT/app/src/main/jni/player.c#L107)
136*bf47c682SAndroid Build Coastguard Workeruntil the first frames of that buffer were detected by WALT device via the headphone jack.
137*bf47c682SAndroid Build Coastguard Worker
138*bf47c682SAndroid Build Coastguard Worker
139*bf47c682SAndroid Build Coastguard Worker## Screen response latency
140*bf47c682SAndroid Build Coastguard Worker
141*bf47c682SAndroid Build Coastguard Worker[Video demonstration](https://www.youtube.com/watch?v=FePSFTxBux4&list=PLd6Fi7WgXfcB4Ma6A-5rPlr1jptNR3RxQ&index=3)
142*bf47c682SAndroid Build Coastguard Worker
143*bf47c682SAndroid Build Coastguard Worker * Tap screen response
144*bf47c682SAndroid Build Coastguard Worker * Set screen brightness to maximum. On phones using PWM for screen backlight brightness control, yo man need to turn adaptive brightness off (settings -> Display -> Adaptive Brightness)
145*bf47c682SAndroid Build Coastguard Worker * Position WALT with the screen sensor looking at the screen (the light sensor recessed into the large plastic surface).
146*bf47c682SAndroid Build Coastguard Worker * Click start  ▶
147*bf47c682SAndroid Build Coastguard Worker * The screen will blink some 20 times. The orange LED on the Teensy will also blink every time the bottom light sensor detects a change.
148*bf47c682SAndroid Build Coastguard Worker * Results are displayed in the log window
149*bf47c682SAndroid Build Coastguard Worker
150*bf47c682SAndroid Build Coastguard Worker```
151*bf47c682SAndroid Build Coastguard WorkerStarting screen response measurement
152*bf47c682SAndroid Build Coastguard WorkerSynced clocks, maxE=162us
153*bf47c682SAndroid Build Coastguard WorkerBlink count was: 0
154*bf47c682SAndroid Build Coastguard WorkerSynced clocks, maxE=857us
155*bf47c682SAndroid Build Coastguard WorkerStarting Listener
156*bf47c682SAndroid Build Coastguard Worker======
157*bf47c682SAndroid Build Coastguard WorkerdoBlink.run(), mInitiatedBlinks = 0 mDetectedBlinks = 0
158*bf47c682SAndroid Build Coastguard Workerblink counts 1 1
159*bf47c682SAndroid Build Coastguard Worker======
160*bf47c682SAndroid Build Coastguard Worker...
161*bf47c682SAndroid Build Coastguard Worker======
162*bf47c682SAndroid Build Coastguard WorkerdoBlink.run(), mInitiatedBlinks = 20 mDetectedBlinks = 20
163*bf47c682SAndroid Build Coastguard WorkerStopping Listener
164*bf47c682SAndroid Build Coastguard WorkerListener stopped
165*bf47c682SAndroid Build Coastguard WorkerRemote clock delayed between -16 and 628 us
166*bf47c682SAndroid Build Coastguard Workerdeltas: [69.908, 53.902, 54.715, 50.867, 70.73, 50.188, 71.344, 85.259, 40.691, 68.554, 72.016, 51.666, 71.826, 51.234, 71.896, 52.131, 68.943, 51.768, 71.919, 48.812]
167*bf47c682SAndroid Build Coastguard WorkerMedian latency 61.6 ms
168*bf47c682SAndroid Build Coastguard Worker```
169*bf47c682SAndroid Build Coastguard Worker
170*bf47c682SAndroid Build Coastguard WorkerAt the time of this writing (WALT v0.1.5) the number reported on the last line
171*bf47c682SAndroid Build Coastguard Workerof the log above is the time from a call to View.setBackgroundColor() until
172*bf47c682SAndroid Build Coastguard Workerthe measured screen brightness crosses a threshold
173*bf47c682SAndroid Build Coastguard Worker[hard coded in WALT firmware](https://github.com/google/walt/blob/master/arduino/walt/walt.ino#L70).
174*bf47c682SAndroid Build Coastguard WorkerThis has significant drawbacks and will change in future versions.
175*bf47c682SAndroid Build Coastguard Worker
176*bf47c682SAndroid Build Coastguard Worker
177*bf47c682SAndroid Build Coastguard Worker
178*bf47c682SAndroid Build Coastguard Worker## Tap latency
179*bf47c682SAndroid Build Coastguard Worker
180*bf47c682SAndroid Build Coastguard Worker[Video demonstration](https://www.youtube.com/watch?v=1xAReF75Cts&list=PLd6Fi7WgXfcCEJg1FDqNCoQfpWo7W3J5a&index=2)
181*bf47c682SAndroid Build Coastguard Worker
182*bf47c682SAndroid Build Coastguard Worker * Disconnect the audio cable
183*bf47c682SAndroid Build Coastguard Worker * Insert the supplied stylus (pen with audio jack) into the WALT's audio connector
184*bf47c682SAndroid Build Coastguard Worker * Click "Tap Latency"
185*bf47c682SAndroid Build Coastguard Worker * Tap the black part of the screen with WALT's copper tape tip while holding by the pen (photo below). Repeat some 20-30 times. Try to keep WALT pressed against the screen for a bit longer than you would usually keep the finger on the glass during a momentary tap.
186*bf47c682SAndroid Build Coastguard Worker * Click the checkmark button (top left of the screen), results will be calculated and displayed
187*bf47c682SAndroid Build Coastguard Worker
188*bf47c682SAndroid Build Coastguard WorkerWALT has an accelerometer that is used to detect when the copper tip collides with the glass. The copper tip is grounded and triggers the touch sensor. The stylus springy action helps generate a collision shock detectable by accelerometer on the way back, away from the glass.
189*bf47c682SAndroid Build Coastguard Worker
190*bf47c682SAndroid Build Coastguard Worker![Tap latency measurement](images/tap.png)
191*bf47c682SAndroid Build Coastguard Worker
192*bf47c682SAndroid Build Coastguard WorkerIn the log below the following abbreviations are used:
193*bf47c682SAndroid Build Coastguard Worker - p2k - physical to kernel - in most cases this is the interesting time.
194*bf47c682SAndroid Build Coastguard Worker - k2c - kernel to (java) callback
195*bf47c682SAndroid Build Coastguard Worker
196*bf47c682SAndroid Build Coastguard Worker
197*bf47c682SAndroid Build Coastguard Worker```
198*bf47c682SAndroid Build Coastguard Worker## Restarting tap latency  measurement. Re-sync clocks ...
199*bf47c682SAndroid Build Coastguard WorkerSynced clocks, maxE=158us
200*bf47c682SAndroid Build Coastguard Worker
201*bf47c682SAndroid Build Coastguard Worker...
202*bf47c682SAndroid Build Coastguard Worker
203*bf47c682SAndroid Build Coastguard WorkerACTION_DOWN event received: Event: t=10269422 x=871.7 y=1026.1 slot=-1 num=0 ACTION_DOWN
204*bf47c682SAndroid Build Coastguard WorkerReceived S reply: 10247405
205*bf47c682SAndroid Build Coastguard Worker
206*bf47c682SAndroid Build Coastguard WorkerACTION_DOWN: dt_p2k = 22.0 ms
207*bf47c682SAndroid Build Coastguard WorkerIgnoring ACTION_MOVE 11
208*bf47c682SAndroid Build Coastguard WorkerIgnoring ACTION_MOVE 12
209*bf47c682SAndroid Build Coastguard WorkerIgnoring ACTION_MOVE 13
210*bf47c682SAndroid Build Coastguard WorkerIgnoring ACTION_MOVE 14
211*bf47c682SAndroid Build Coastguard WorkerIgnoring ACTION_MOVE 15
212*bf47c682SAndroid Build Coastguard Worker
213*bf47c682SAndroid Build Coastguard WorkerACTION_UP event received: Event: t=10365071 x=871.7 y=1026.1 slot=-1 num=0 ACTION_UP
214*bf47c682SAndroid Build Coastguard WorkerReceived S reply: 10348526
215*bf47c682SAndroid Build Coastguard Worker
216*bf47c682SAndroid Build Coastguard WorkerACTION_UP: dt_p2k = 16.5 ms
217*bf47c682SAndroid Build Coastguard Worker
218*bf47c682SAndroid Build Coastguard Worker...
219*bf47c682SAndroid Build Coastguard Worker
220*bf47c682SAndroid Build Coastguard Worker## Processing tap latency data
221*bf47c682SAndroid Build Coastguard WorkerRemote clock delayed between -60 and 93 us
222*bf47c682SAndroid Build Coastguard WorkerCounts: ACTION_DOWN 20 (bad 1), ACTION_UP 21 (bad 0), ACTION_MOVE 162
223*bf47c682SAndroid Build Coastguard Worker
224*bf47c682SAndroid Build Coastguard WorkerACTION_DOWN:
225*bf47c682SAndroid Build Coastguard Worker[26.515, 22.017, 26.952, 29.363, 29.63, 26.624, 31.581, 26.565, 31.335, 26.83, 31.786, 14.702, 19.796, 20.626, 16.688, 18.001, 19.044, 20.261, 17.66, 26.044]
226*bf47c682SAndroid Build Coastguard Worker[1.774, 0.872, 0.888, 0.948, 1.749, 1.781, 1.698, 1.375, 1.709, 1.985, 2.522, 0.994, 1.008, 0.813, 0.746, 1.289, 1.158, 1.093, 0.891, 3.755]
227*bf47c682SAndroid Build Coastguard WorkerMedians, p2k & k2c [ms]: 26.3    1.2
228*bf47c682SAndroid Build Coastguard Worker
229*bf47c682SAndroid Build Coastguard WorkerACTION_UP:
230*bf47c682SAndroid Build Coastguard Worker[16.572, 19.515, 16.545, 18.724, 15.188, 14.682, 18.156, 11.69, 20.367, 15.135, 20.601, 44.948, 17.517, 129.513, 24.681, 21.21, 21.979, 22.805, 133.306, 23.876, 17.579]
231*bf47c682SAndroid Build Coastguard Worker[2.161, 2.02, 1.761, 2.222, 1.228, 1.24, 1.48, 1.42, 1.315, 4.034, 1.279, 1.957, 1.041, 2.058, 2.903, 1.725, 0.99, 2.124, 1.398, 3.018, 0.945]
232*bf47c682SAndroid Build Coastguard WorkerMedians, p2k & k2c [ms]: 19.5    1.7
233*bf47c682SAndroid Build Coastguard Worker
234*bf47c682SAndroid Build Coastguard Worker```
235*bf47c682SAndroid Build Coastguard Worker
236*bf47c682SAndroid Build Coastguard Worker## Drag/scroll latency
237*bf47c682SAndroid Build Coastguard Worker
238*bf47c682SAndroid Build Coastguard Worker[Video demonstration](https://www.youtube.com/watch?v=pVy5AYVzf7Q&list=PLd6Fi7WgXfcB4Ma6A-5rPlr1jptNR3RxQ&index=4)
239*bf47c682SAndroid Build Coastguard Worker
240*bf47c682SAndroid Build Coastguard WorkerDrag latency is measured by dragging a finger up and down along the screen. The finger interrupts a laser beam positioned across the screen. By comparing the timings of those beam interruptions with Android touch events the WALT app calculates the delay.
241*bf47c682SAndroid Build Coastguard Worker
242*bf47c682SAndroid Build Coastguard Worker
243*bf47c682SAndroid Build Coastguard Worker * Position a laser pointer so that the beam crosses the screen roughly in the middle. A convenient method for positioning the laser pointer is by using modeling clay (plasticine)
244*bf47c682SAndroid Build Coastguard Worker * Place WALT on the other side so that the beam hits the WALT optical sensor looking sideways. A green LED (marked D3) will light up whenever the beam hits the sensor
245*bf47c682SAndroid Build Coastguard Worker * Click the start button ▶, a green animated line will start going up and down the screen
246*bf47c682SAndroid Build Coastguard Worker * Drag your finger on the screen, following the animated line
247*bf47c682SAndroid Build Coastguard Worker * The green counter in the top right corner counts how many times the laser sensor changed state. Each crossing of the beam add 2 to that counter. Continue until the counter shows at least 60
248*bf47c682SAndroid Build Coastguard Worker * Click the finish **✓**(check mark) button, results will be displayed in the black window
249*bf47c682SAndroid Build Coastguard Worker
250*bf47c682SAndroid Build Coastguard Worker![Drag/scroll latency measurement](images/drag.png)
251*bf47c682SAndroid Build Coastguard Worker
252*bf47c682SAndroid Build Coastguard Worker# Collecting Systrace logs
253*bf47c682SAndroid Build Coastguard Worker
254*bf47c682SAndroid Build Coastguard WorkerWALT is able to log physical events as well as system events into systrace. This allows us to look at the system-level calls that occur between the application triggering a change and the WALT device receiving a physical response.
255*bf47c682SAndroid Build Coastguard Worker
256*bf47c682SAndroid Build Coastguard Worker  * In the WALT app go to Settings->General and check `Enable systrace logging`.
257*bf47c682SAndroid Build Coastguard Worker  * On your workstation, follow the [instructions for systrace](https://developer.android.com/studio/profile/systrace-commandline.html) on the command line
258*bf47c682SAndroid Build Coastguard Worker  * From the `android-sdk/platform-tools/systrace` directory, run `python systrace.py --walt`. If `--walt` is not recognized as an option, clone the latest version of [systrace repo](https://github.com/catapult-project/catapult) and from the `catapult/systrace/systrace` directory run `python run_systrace.py --walt`.
259*bf47c682SAndroid Build Coastguard Worker  * Conduct a test through the WALT app. When the test is complete, you should see that TraceLogger wrote some events to a file.
260*bf47c682SAndroid Build Coastguard Worker  * Press enter on your workstation to end the trace and pull the logs from the phone, and the traceview will be generated as HTML.
261*bf47c682SAndroid Build Coastguard Worker
262*bf47c682SAndroid Build Coastguard Worker
263*bf47c682SAndroid Build Coastguard Worker# Troubleshooting
264*bf47c682SAndroid Build Coastguard Worker
265*bf47c682SAndroid Build Coastguard Worker  * Make sure your micro-USB cable is not power-only (can carry data). If it has a button to switch between data and no-data modes (e.g. the KAA cable), click the button.
266*bf47c682SAndroid Build Coastguard Worker  * Make sure volume control on Android DUT is at maximum (update in settings -> sound while TRRS cable is inserted).
267*bf47c682SAndroid Build Coastguard Worker  * Some devices use pulse width modulation (PWM) to control screen brightness. Disable adaptive screen brightness and set brightness manually to maximum.
268