1*bf47c682SAndroid Build Coastguard Worker## Screen latency 2*bf47c682SAndroid Build Coastguard Worker 3*bf47c682SAndroid Build Coastguard WorkerSee also: 4*bf47c682SAndroid Build Coastguard Worker * [Video demonstration](https://www.youtube.com/watch?v=FePSFTxBux4&list=PLd6Fi7WgXfcB4Ma6A-5rPlr1jptNR3RxQ&index=3) 5*bf47c682SAndroid Build Coastguard Worker * [Screen latency section in the usage doc](usage/WALT_usage.md#screen-response-latency) 6*bf47c682SAndroid Build Coastguard Worker 7*bf47c682SAndroid Build Coastguard WorkerWALT can detect when screen changes color between white and black using a photodiode. 8*bf47c682SAndroid Build Coastguard Worker 9*bf47c682SAndroid Build Coastguard Worker 10*bf47c682SAndroid Build Coastguard Worker 11*bf47c682SAndroid Build Coastguard WorkerBecause the screen refreshes at predefined intervals (typically 60 Hz), most drawing commands do not take effect immediately but are processes during the next frame render event. See [Choreographer.FrameCallback](https://developer.android.com/reference/android/view/Choreographer.FrameCallback.html). An in-depth explanation about Android graphics can be found in [this video](https://www.youtube.com/watch?v=Q8m9sHdyXnE). 12*bf47c682SAndroid Build Coastguard Worker 13*bf47c682SAndroid Build Coastguard WorkerWALT Android app uses View.setBackgroundColor to change the color and reports the time from the beginning of the next frame rendering until the screen changes physically. 14*bf47c682SAndroid Build Coastguard Worker 15*bf47c682SAndroid Build Coastguard WorkerThe physical transition between colors is not instantaneous and may look very different depending on the direction - from black to white or white to black. Moreover some sections of the screen may update several milliseconds later than others. These details vary considerably between screen technologies and device models. 16*bf47c682SAndroid Build Coastguard Worker 17*bf47c682SAndroid Build Coastguard WorkerExample of screen brightness as a function of time during transition from black to white (blue line) and from white to black (green line) on Nexus 5X. The horizontal lines show the thresholds used by WALT for timing the transition (see #80). 18*bf47c682SAndroid Build Coastguard Worker 19*bf47c682SAndroid Build Coastguard Worker 20*bf47c682SAndroid Build Coastguard Worker### Sample measurements 21*bf47c682SAndroid Build Coastguard Worker 22*bf47c682SAndroid Build Coastguard WorkerExample of log output on Nexus 7: 23*bf47c682SAndroid Build Coastguard Worker``` 24*bf47c682SAndroid Build Coastguard Worker------------------------------- 25*bf47c682SAndroid Build Coastguard WorkerMedian screen response latencies (N=100): 26*bf47c682SAndroid Build Coastguard WorkerBlack to white: 47.3 ms (N=50) 27*bf47c682SAndroid Build Coastguard WorkerWhite to black: 50.2 ms (N=50) 28*bf47c682SAndroid Build Coastguard WorkerAverage: 48.8 ms 29*bf47c682SAndroid Build Coastguard Worker------------------------------- 30*bf47c682SAndroid Build Coastguard Worker``` 31*bf47c682SAndroid Build Coastguard Worker 32*bf47c682SAndroid Build Coastguard Worker 33*bf47c682SAndroid Build Coastguard WorkerAll measurements below were taken with the device set to max brightness and WALT positioned in the middle of the screen. 34*bf47c682SAndroid Build Coastguard Worker 35*bf47c682SAndroid Build Coastguard Worker| Device | OS version | Blk->white [ms]| White->blk [ms]| Average [ms] | 36*bf47c682SAndroid Build Coastguard Worker| :--- | :--- | ---: | ---: | ---: | 37*bf47c682SAndroid Build Coastguard Worker| Nexus 5 | M4B30Z (6.0.1) | 53.5 | 62.6 | 58.1 | 38*bf47c682SAndroid Build Coastguard Worker| Nexus 5X | NRD91P (7.0) | 60.7 | 75.4 | 68.1 | 39*bf47c682SAndroid Build Coastguard Worker| Nexus 7 | LMY47Q (5.1) | 47.3 | 50.2 | 48.8 | 40*bf47c682SAndroid Build Coastguard Worker| Nexus 9 | MMB29K (6.0.1) | 49.0 | 53.8 | 51.4 | 41*bf47c682SAndroid Build Coastguard Worker 42*bf47c682SAndroid Build Coastguard Worker 43*bf47c682SAndroid Build Coastguard Worker 44