am 421c34c1: SipPhone: revise hangup() in SipCall and SipConnection.

Merge commit '421c34c162098efe870574844a7ee49812bbb929' into gingerbread-plus-aosp

* commit '421c34c162098efe870574844a7ee49812bbb929':
  SipPhone: revise hangup() in SipCall and SipConnection.
This commit is contained in:
Hung-ying Tyan
2010-09-30 10:09:33 -07:00
committed by Android Git Automerger

View File

@@ -444,6 +444,7 @@ public class SipPhone extends SipPhoneBase {
if (state.isAlive()) { if (state.isAlive()) {
Log.d(LOG_TAG, "hang up call: " + getState() + ": " + this Log.d(LOG_TAG, "hang up call: " + getState() + ": " + this
+ " on phone " + getPhone()); + " on phone " + getPhone());
setState(State.DISCONNECTING);
CallStateException excp = null; CallStateException excp = null;
for (Connection c : connections) { for (Connection c : connections) {
try { try {
@@ -453,7 +454,6 @@ public class SipPhone extends SipPhoneBase {
} }
} }
if (excp != null) throw excp; if (excp != null) throw excp;
setState(State.DISCONNECTING);
} else { } else {
Log.d(LOG_TAG, "hang up dead call: " + getState() + ": " Log.d(LOG_TAG, "hang up dead call: " + getState() + ": "
+ this + " on phone " + getPhone()); + this + " on phone " + getPhone());
@@ -630,13 +630,20 @@ public class SipPhone extends SipPhoneBase {
} }
synchronized (SipPhone.class) { synchronized (SipPhone.class) {
setState(Call.State.DISCONNECTED); setState(Call.State.DISCONNECTED);
mSipAudioCall.close(); SipAudioCall sipAudioCall = mSipAudioCall;
mOwner.onConnectionEnded(SipConnection.this); mSipAudioCall = null;
Log.v(LOG_TAG, "-------- connection ended: " String sessionState = (sipAudioCall == null)
+ mPeer.getUriString() + ": " ? ""
+ mSipAudioCall.getState() + ", cause: " : (sipAudioCall.getState() + ", ");
+ getDisconnectCause() + ", on phone " Log.v(LOG_TAG, "--- connection ended: "
+ mPeer.getUriString() + ": " + sessionState
+ "cause: " + getDisconnectCause() + ", on phone "
+ getPhone()); + getPhone());
if (sipAudioCall != null) {
sipAudioCall.setListener(null);
sipAudioCall.close();
}
mOwner.onConnectionEnded(SipConnection.this);
} }
} }
@@ -790,14 +797,17 @@ public class SipPhone extends SipPhoneBase {
synchronized (SipPhone.class) { synchronized (SipPhone.class) {
Log.v(LOG_TAG, "hangup conn: " + mPeer.getUriString() + ": " Log.v(LOG_TAG, "hangup conn: " + mPeer.getUriString() + ": "
+ mState + ": on phone " + getPhone().getPhoneName()); + mState + ": on phone " + getPhone().getPhoneName());
if (!mState.isAlive()) return;
try { try {
if (mState.isAlive()) { SipAudioCall sipAudioCall = mSipAudioCall;
if (mSipAudioCall != null) mSipAudioCall.endCall(); if (sipAudioCall != null) {
setState(Call.State.DISCONNECTING); sipAudioCall.setListener(null);
setDisconnectCause(DisconnectCause.LOCAL); sipAudioCall.endCall();
} }
} catch (SipException e) { } catch (SipException e) {
throw new CallStateException("hangup(): " + e); throw new CallStateException("hangup(): " + e);
} finally {
mAdapter.onCallEnded(DisconnectCause.LOCAL);
} }
} }
} }