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

Commit cbf3ace2 authored by Adnan Begovic's avatar Adnan Begovic
Browse files

Telecomm: Bandaid possible NPE on call waiting scenarios.

  Since the CallWaitingDialog can be created numerous times
  within the scope of answering a call object via the callsmanager,
  it's possible that the active call object can be discarded from a
  separate thread and thus can cause an NPE when being handled.

  Similarly to I1b4c251a9419991fe96ee0951e4a14a6f25ccc8d, mitigate
  the symptom until the original implementation can be revamped.

TICKET: CYNGNOS-2688
Change-Id: I7332e97f7ed03a23c8d8d33e34379154e3dce215
parent 6c7dd773
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -2505,10 +2505,13 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx
                heldCall.disconnect();
            }

            // TODO: This active call reference can be nullified and discarded from another thread,
            // Fix this by reworking the state machine surrounding calls within telecomm.
            if (mActiveCall != null) {
                Log.v(this, "Holding active/dialing call %s before answering incoming call %s.",
                        mLocalCallsManager.mForegroundCall, mNewCall);

                mActiveCall.hold();
            }
            // TODO: Wait until we get confirmation of
            // the active call being
            // on-hold before answering the new call.
@@ -2520,10 +2523,13 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx
        private void handleEndCallAndAnswer() {
            // We don't want to hold, just disconnect

            // TODO: This active call reference can be nullified and discarded from another thread,
            // Fix this by reworking the state machine surrounding calls within telecomm.
            if (mActiveCall != null) {
                Log.v(this, "Holding active/dialing call %s for termination before answering incoming call %s.",
                        mLocalCallsManager.mForegroundCall, mNewCall);

                mActiveCall.hold();
            }
            // TODO: Wait until we get confirmation of
            // the active call being
            // on-hold before answering the new call.