Fix race condition on call initiation
When a call initiates and the IMS stack reports some state that's
transmitted via the registrants from Phone, there's a chance that it
could be transmitted before setOriginalConnection is called. This
results in the message getting lost since setOriginalConnection is what
registers the message handler, and in the worst case can result in a
change in originalConnection being ignored.
Fix this by registering for the messages before dialing, and set the
originalConnection after dialing on the main thread so that it
doesn't race with anything else trying to set the originalConnection
Fixes: 183247792
Test: manual
Change-Id: I5413d5f651373ae857242c9d0a63b3513204b8ff
3 files changed