Merge "Don't enter DISCONNECTING state when the call/connection is not alive" into gingerbread

This commit is contained in:
Hung-ying Tyan
2010-09-27 19:23:35 -07:00
committed by Android (Google) Code Review

View File

@@ -441,7 +441,8 @@ public class SipPhone extends SipPhoneBase {
@Override @Override
public void hangup() throws CallStateException { public void hangup() throws CallStateException {
synchronized (SipPhone.class) { synchronized (SipPhone.class) {
Log.v(LOG_TAG, "hang up call: " + getState() + ": " + this if (mState.isAlive()) {
Log.d(LOG_TAG, "hang up call: " + getState() + ": " + this
+ " on phone " + getPhone()); + " on phone " + getPhone());
CallStateException excp = null; CallStateException excp = null;
for (Connection c : connections) { for (Connection c : connections) {
@@ -453,6 +454,10 @@ public class SipPhone extends SipPhoneBase {
} }
if (excp != null) throw excp; if (excp != null) throw excp;
setState(State.DISCONNECTING); setState(State.DISCONNECTING);
} else {
Log.d(LOG_TAG, "hang up dead call: " + getState() + ": "
+ this + " on phone " + getPhone());
}
} }
} }
@@ -784,11 +789,13 @@ public class SipPhone extends SipPhoneBase {
public void hangup() throws CallStateException { public void hangup() throws CallStateException {
synchronized (SipPhone.class) { synchronized (SipPhone.class) {
Log.v(LOG_TAG, "hangup conn: " + mPeer.getUriString() + ": " Log.v(LOG_TAG, "hangup conn: " + mPeer.getUriString() + ": "
+ ": on phone " + getPhone().getPhoneName()); + mState + ": on phone " + getPhone().getPhoneName());
try { try {
if (mState.isAlive()) {
if (mSipAudioCall != null) mSipAudioCall.endCall(); if (mSipAudioCall != null) mSipAudioCall.endCall();
setState(Call.State.DISCONNECTING); setState(Call.State.DISCONNECTING);
setDisconnectCause(DisconnectCause.LOCAL); setDisconnectCause(DisconnectCause.LOCAL);
}
} catch (SipException e) { } catch (SipException e) {
throw new CallStateException("hangup(): " + e); throw new CallStateException("hangup(): " + e);
} }