It contains all the properties we need to instantiate a Device: id, name,
type, cert, capabilities and protocol version. Before, we had a mix of
passing those around as arguments or passing identity packets (ie: json).
This simplifies the Device class quite a bit.
Now, the BaseLink subclasses need to implement getDeviceInfo() interface
that returns a DeviceInfo, which is what we will pass around and eventually
use to instantiate a Device.
This means that identity packets are an implementation detail of the
LanLinkProvider and that other implementations could get the DeviceInfo
in a different way.
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.
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.
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.
Summary:
The methods in Device.java can be used from any thread, while
the methods in BaseLink (and its subclasses) should only run
on a background thread. These annotations are picked up by Lint
to show warnings and have no effect at runtime.
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