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

Commit 8544560c authored by Hung-ying Tyan's avatar Hung-ying Tyan
Browse files

SipPhone: fix missing-call DisconnectCause feedback

also fix delivering bad news before closing a SipAudioCallImpl object so that
apps can get the current audio-call object state before it's closed:

http://b/issue?id=3009262

Change-Id: I94c19dae8b4f252de869e614ec462b19b4ff2077
parent b17eae9e
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -823,7 +823,9 @@ public class SipPhone extends SipPhoneBase {


        @Override
        @Override
        public void onCallEnded(SipAudioCall call) {
        public void onCallEnded(SipAudioCall call) {
            onCallEnded(Connection.DisconnectCause.NORMAL);
            onCallEnded(call.isInCall()
                    ? Connection.DisconnectCause.NORMAL
                    : Connection.DisconnectCause.INCOMING_MISSED);
        }
        }


        @Override
        @Override
+8 −8
Original line number Original line Diff line number Diff line
@@ -269,7 +269,6 @@ public class SipAudioCallImpl extends SipSessionAdapter
    @Override
    @Override
    public void onCallEnded(ISipSession session) {
    public void onCallEnded(ISipSession session) {
        Log.d(TAG, "sip call ended: " + session);
        Log.d(TAG, "sip call ended: " + session);
        close();
        Listener listener = mListener;
        Listener listener = mListener;
        if (listener != null) {
        if (listener != null) {
            try {
            try {
@@ -278,12 +277,12 @@ public class SipAudioCallImpl extends SipSessionAdapter
                Log.e(TAG, "onCallEnded()", t);
                Log.e(TAG, "onCallEnded()", t);
            }
            }
        }
        }
        close();
    }
    }


    @Override
    @Override
    public void onCallBusy(ISipSession session) {
    public void onCallBusy(ISipSession session) {
        Log.d(TAG, "sip call busy: " + session);
        Log.d(TAG, "sip call busy: " + session);
        close(false);
        Listener listener = mListener;
        Listener listener = mListener;
        if (listener != null) {
        if (listener != null) {
            try {
            try {
@@ -292,6 +291,7 @@ public class SipAudioCallImpl extends SipSessionAdapter
                Log.e(TAG, "onCallBusy()", t);
                Log.e(TAG, "onCallBusy()", t);
            }
            }
        }
        }
        close(false);
    }
    }


    @Override
    @Override
@@ -316,12 +316,6 @@ public class SipAudioCallImpl extends SipSessionAdapter
                + ": " + message);
                + ": " + message);
        mErrorCode = errorCode;
        mErrorCode = errorCode;
        mErrorMessage = message;
        mErrorMessage = message;
        synchronized (this) {
            if ((mErrorCode == SipErrorCode.DATA_CONNECTION_LOST)
                    || !isInCall()) {
                close(true);
            }
        }
        Listener listener = mListener;
        Listener listener = mListener;
        if (listener != null) {
        if (listener != null) {
            try {
            try {
@@ -330,6 +324,12 @@ public class SipAudioCallImpl extends SipSessionAdapter
                Log.e(TAG, "onError()", t);
                Log.e(TAG, "onError()", t);
            }
            }
        }
        }
        synchronized (this) {
            if ((errorCode == SipErrorCode.DATA_CONNECTION_LOST)
                    || !isInCall()) {
                close(true);
            }
        }
    }
    }


    public synchronized void attachCall(ISipSession session,
    public synchronized void attachCall(ISipSession session,