2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-28 12:47:43 +00:00

4 Commits

Author SHA1 Message Date
Wojciech Matuszewski
70d70dcb33 Use a common thread pool instead of creating new threads manually
## 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.
2022-10-31 20:59:17 +00:00
Isira Seneviratne
847a949ace Use the Streams API in DevicePacketQueue. 2020-07-10 18:22:42 +05:30
Matthijs Tijink
d5b697f2c4 Don't remove packets from the queue without adding a replacing one 2019-07-20 22:28:54 +02:00
Matthijs Tijink
66aa6696cc Use a queue of unsent packets instead of threads
This also allows "unsending" packets (if they're still in the queue).
This patch does that for mouse move packets, so they get accumulated
together (sending less stuff over a congested link).
2019-07-20 20:21:44 +00:00