ilya.gorbunov
03/28/2017, 4:21 PMdownload
finishes its work the dispatcher posts the continuation (the rest of block after await
) to UI thread. Then after UI thread picks that continuation and it starts executing, the continuation checks whether it was cancelled. Since it happens on UI thread it may be cancelled at that moment or not, but its state doesn't change until it finishes its execution on UI thread, given that onPause
can only be called from UI thread.