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

Commit 49c13e51 authored by Hung-ying Tyan's avatar Hung-ying Tyan Committed by Android Git Automerger
Browse files

am 0e412304: Catch exceptions in SipPhone.canTake().

Merge commit '0e412304' into gingerbread-plus-aosp

* commit '0e412304':
  Catch exceptions in SipPhone.canTake().
parents 2c457326 0e412304
Loading
Loading
Loading
Loading
+26 −8
Original line number Diff line number Diff line
@@ -126,15 +126,28 @@ public class SipPhone extends SipPhoneBase {
                return false;
            }

            try {
                SipAudioCall sipAudioCall = (SipAudioCall) incomingCall;
            Log.v(LOG_TAG, "  ++++++ taking call from: "
                Log.d(LOG_TAG, "+++ taking call from: "
                        + sipAudioCall.getPeerProfile().getUriString());
                String localUri = sipAudioCall.getLocalProfile().getUriString();
                if (localUri.equals(mProfile.getUriString())) {
                    boolean makeCallWait = foregroundCall.getState().isAlive();
                    ringingCall.initIncomingCall(sipAudioCall, makeCallWait);
                    if (sipAudioCall.getState()
                            != SipSession.State.INCOMING_CALL) {
                        // Peer cancelled the call!
                        Log.d(LOG_TAG, "    call cancelled !!");
                        ringingCall.reset();
                    }
                    return true;
                }
            } catch (Exception e) {
                // Peer may cancel the call at any time during the time we hook
                // up ringingCall with sipAudioCall. Clean up ringingCall when
                // that happens.
                ringingCall.reset();
            }
            return false;
        }
    }
@@ -358,6 +371,11 @@ public class SipPhone extends SipPhoneBase {
    }

    private class SipCall extends SipCallBase {
        void reset() {
            connections.clear();
            setState(Call.State.IDLE);
        }

        void switchWith(SipCall that) {
            synchronized (SipPhone.class) {
                SipCall tmp = new SipCall();