Switch to using TelephonyConnection#hangup instead of onDisconnect.
Where there is an ongoing call on one sim and an incoming call is answered
on the other sim, we used TelephonyConnection#onDisconnect to terminate
the ongoing call. The problem is that onDisconnect posts the operation
to a handler, so in reality the order of operation would be to answer the
incoming call and THEN disconnect the ongoing call.
Using the hangup method does NOT post to a handler and ensures that we
disconnect the ongoing call BEFORE answering the incoming one.
Test: Manual test to verify through log inspection the ordering of
the operations.
Test: Live network test.
Test: Modify unit tests to verify hangup is called.
Bug: 178649879
Change-Id: I499a19dffa2504fc33a6d2528be17746a56580bc
3 files changed