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
This commit is contained in:
Hung-ying Tyan
2010-09-20 10:06:31 +08:00
parent b17eae9e22
commit 8544560ccc
2 changed files with 11 additions and 9 deletions

View File

@ -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

View File

@ -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,