Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fb5560d6 authored by Ihab Awad's avatar Ihab Awad
Browse files

ConnectionService API has only one completed callback (2/3)

Refactor ConnectionService API so it has only one "completed"
callback, and connection state and failure codes indicates what
happened. Previous design where we had separate callbacks for failure,
cancellation and success was error prone because it was easy to forget
to implement one of them.

This particular change in this set of changes also makes one crucial
fix. The Call object, when it is notified of an unsuccessful attempt
to make a connection, previously told itself:

  setState(CallState.DISCONNECTED);

But that led to its DISCONNECTED state never being published to
anyone, while on the other hand it was now removed from the
CallIdMapper, so nobody could talk to it (symptom: InCall UI hangup
button becomes a no-op). The correct thing to do is:

  CallsManager.getInstance().
      markCallAsDisconnected(this, code, msg);

which goes through the CallsManager to set the appropriate states. I
think that, post-L, our code here is really ripe for a refactoring
that prioritizes encapsulation and more ubiquitous use of the
"listener" pattern, otherwise we're going to have a bunch more of
these kinds of bugs. :)

Bug: 16993846
Bug: 17070939

Change-Id: Ie79e585dfbc2a1b79a3721d749855704cd8270ed
parent 0ef3eee3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment