When a user downloads files and presses "cancel all" button in the notification, there is a chance that the app will crash with ConcurrentModificationException because one thread (main) is iterating through tasks in "cleanup" method while another thread (executor) modifies collection in "startNextTask" method. Fix this by moving "iterator.remove" call to the main thread.
When a user downloads files and presses "cancel all" button in the notification, there is a chance that the app will crash with ConcurrentModificationException because one thread (main) is iterating through tasks in "cleanup" method while another thread (executor) modifies collection in "startNextTask" method. Fix this by moving "iterator.remove" call to the main thread.