diff options
author | Hung-ying Tyan <tyanh@google.com> | 2010-09-30 12:01:56 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-09-30 12:01:56 -0700 |
commit | db9e87b98874bba9f26c8d0745639dfbe11195df (patch) | |
tree | 2f9cc85bf6023c7ecdf1e8dad8022d22a4eedd69 /telephony | |
parent | bd407edc473778685c26d1c76a13671bf948eb83 (diff) | |
parent | 49c13e512c675b27099783ccf2d20c9ef46c99db (diff) | |
download | frameworks_base-db9e87b98874bba9f26c8d0745639dfbe11195df.zip frameworks_base-db9e87b98874bba9f26c8d0745639dfbe11195df.tar.gz frameworks_base-db9e87b98874bba9f26c8d0745639dfbe11195df.tar.bz2 |
am 49c13e51: am 0e412304: Catch exceptions in SipPhone.canTake().
Merge commit '49c13e512c675b27099783ccf2d20c9ef46c99db'
* commit '49c13e512c675b27099783ccf2d20c9ef46c99db':
Catch exceptions in SipPhone.canTake().
Diffstat (limited to 'telephony')
-rwxr-xr-x | telephony/java/com/android/internal/telephony/sip/SipPhone.java | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/telephony/java/com/android/internal/telephony/sip/SipPhone.java b/telephony/java/com/android/internal/telephony/sip/SipPhone.java index d52cbd0..37dd971 100755 --- a/telephony/java/com/android/internal/telephony/sip/SipPhone.java +++ b/telephony/java/com/android/internal/telephony/sip/SipPhone.java @@ -133,14 +133,27 @@ public class SipPhone extends SipPhoneBase { return false; } - SipAudioCall sipAudioCall = (SipAudioCall) incomingCall; - Log.v(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); - return true; + try { + SipAudioCall sipAudioCall = (SipAudioCall) incomingCall; + 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; } @@ -361,6 +374,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(); |