Fixes the bug described in !359. Since we made sending packets sequential
in !90 (including the payload part of the packet) we could be blocking the
queue for up to 10 seconds if the other end didn't fetch our payload.
This makes the payload part async by default but keeps the option to make
it sync, since we want that behavior in CompositeUploadFileJob.
Removes conditional code for older Android versions (IceCreamSandwitch, JellyBean, KitKat, Lollipop) since we no longer support Android older than Lollipop (5.0).
This doesn't remove KitKat support in the SFTP plugin since it's a bit more convoluted. It will be done in a separate MR.
## Summary
Spawning new threads in Java is costly. This MR aims to use a common thread pool instead.
I've replaced all cases where a new thread is started just to perform a task in the background. This does not include cases where a reference to the newly created thread is kept as a part of application logic – this is probably a problem in itself, but it exceeds the scope of this quick optimization. ;)
There was a couple of cases where a new thread was spawned just to sleep for a while an then change the state on a View on the main thread. I've replaced those with posting those deferred tasks to the View's message queue.
## Test Plan
Everything should work the same as it has before, just a bit faster and easier on the memory.
Summary: KDE Connect, now with correct naming!
Test Plan: It still builds.
Reviewers: #kde_connect, apol, nicolasfella
Reviewed By: #kde_connect, apol, nicolasfella
Subscribers: nicolasfella, apol
Differential Revision: https://phabricator.kde.org/D11035
Summary: Sorry for the huge diff, but all I did was applying Android Studio's 'Reformat Code' to all files. If everyone does that before submitting a patch we can keep it clean easily.
Test Plan: Compiles
Reviewers: #kde_connect, mtijink
Reviewed By: #kde_connect, mtijink
Subscribers: mtijink, sredman, #kde_connect
Tags: #kde_connect
Differential Revision: https://phabricator.kde.org/D10905