Copied from libfeedback as of 2e081602f627505e566cc0bdb6cd96c7642d8b65
and adjusted for our mocking needs.
The mocked library will be LD_PRELOADED for the moment,
but further changes to the build should allow us to simply link
to it in the future.
This will get removed soon while refactoring the ringer as cancelling
the async methods would not guarantee that the requested operation would
not be performed.
It could actually already be started (e.g. starting or stopping the
feedback), but we have not yet received the reply, so it was always a
bit flaky.
15 ms does not seem to be enough time for phosh-antispam to be able
to hang up before the incoming call screen shows up. In my experiement,
90 looks to be the minimum time needed for the incoming call to not show up.
I put it to 100 ms just to be safe.
We only have a single source of settings, so we should reflect that by
using a singleton. This also reduces our LoC.
This doesn't impair our ability to run tests because there we run with
GSETTINGS_BACKEND=memory
This let's us get rid of a lot of duplication in the derived classes.
Additionally we set the initial state to CALLS_CALL_STATE_INCOMING if
inbound is TRUE and CALLS_CALL_STATE_DIALING otherwise.
We mock libfeedback and CallsCall to test the ringer for the following
scenarios:
- Call state changes
- User requested silencing of ringer
- Multiple calls