Skip to content

Refactor BackgroundService

Albert Vaca Cintora requested to merge work/refactor-backgroundservice into master

Added a new KdeConnect Application class that holds the Devices now, while BackgroundService "only" takes care of the LinkProviders.

Since KdeConnect subclasses Application we have the guarantee that it will exist as long as our process does, so we can use it as a singleton. This removes the "BackgroundService.RunCommand" hack (which sent an Intent that would awake BackgroundService in case it wasn't running already and then call our code in a callback). This saves lots of round trips between the system and us and makes things simpler (and stack traces useful) by making the code sequential. Performance should also be better.

We already had an Application subclass that I moved to a new helper, which now the KdeConnect class initializes together with all the other helpers.

Mixed in there are some minor renamings that I did while trying to understand all the code I had to change, sorry about that.

Edited by Albert Vaca Cintora

Merge request reports