Previously our code assumed that g_cancellable_cancel() the async DBus
calls to libfeedback would guarantee that the underlying operation would
not be performed (i.e. triggering or ending a feedback).
However the endless ringing exhibited in #470 shows this assumption not
to hold. Therefore we avoid using g_cancellable_cancel () completely and
default to waiting for the async operation to finish.
update_ring () now sets the target state by inspecting managed calls and
the main logic will now step towards the target state:
Changing from regular/loud to soft/quiet ringing (or vice versa)
requires we first end feedback before (re)triggering it.
Additionally the "is-quiet" and "is-ringing" properties are replaced by
a new "state" property to allow changing the combination atomically.
Closes: #470
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