summaryrefslogtreecommitdiffstats
path: root/voip/java/android
diff options
context:
space:
mode:
authorHung-ying Tyan <tyanh@google.com>2010-11-03 11:50:05 +0800
committerHung-ying Tyan <tyanh@google.com>2010-11-03 18:09:31 +0800
commit8d1b2a17d9935819ec96f1b5fca0e9945f564eaa (patch)
treeb81d8d442b304f7ba59241025d0297452bc66600 /voip/java/android
parent70a2c15ecfd4e8cd8581699d5df8a219c7d5cdb1 (diff)
downloadframeworks_base-8d1b2a17d9935819ec96f1b5fca0e9945f564eaa.zip
frameworks_base-8d1b2a17d9935819ec96f1b5fca0e9945f564eaa.tar.gz
frameworks_base-8d1b2a17d9935819ec96f1b5fca0e9945f564eaa.tar.bz2
Throw proper exceptions in SipManager
instead of silently returning null and causing NPE in applications as returning null is not documented in the javadoc. Add connection to the connection list in SipCall after dial() succeeds so that we don't need to clean up if it fails. The original code will cause the failed connection to continue to live in the SipCall and in next dial() attempt, a new connection is created and the in-call screen sees two connections in the call and thus shows conference call UI. Bug: 3157234, 3157387 Change-Id: Iabc3235f781c4f1e09384a67ad56b09ad2c12e5e
Diffstat (limited to 'voip/java/android')
-rw-r--r--voip/java/android/net/sip/SipManager.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/voip/java/android/net/sip/SipManager.java b/voip/java/android/net/sip/SipManager.java
index 8aaa805..2e38662 100644
--- a/voip/java/android/net/sip/SipManager.java
+++ b/voip/java/android/net/sip/SipManager.java
@@ -314,10 +314,6 @@ public class SipManager {
SipAudioCall call = new SipAudioCall(mContext, localProfile);
call.setListener(listener);
SipSession s = createSipSession(localProfile, null);
- if (s == null) {
- throw new SipException(
- "Failed to create SipSession; network available?");
- }
call.makeCall(peerProfile, s, timeout);
return call;
}
@@ -366,7 +362,9 @@ public class SipManager {
*/
public SipAudioCall takeAudioCall(Intent incomingCallIntent,
SipAudioCall.Listener listener) throws SipException {
- if (incomingCallIntent == null) return null;
+ if (incomingCallIntent == null) {
+ throw new SipException("Cannot retrieve session with null intent");
+ }
String callId = getCallId(incomingCallIntent);
if (callId == null) {
@@ -381,7 +379,9 @@ public class SipManager {
try {
ISipSession session = mSipService.getPendingSession(callId);
- if (session == null) return null;
+ if (session == null) {
+ throw new SipException("No pending session for the call");
+ }
SipAudioCall call = new SipAudioCall(
mContext, session.getLocalProfile());
call.attachCall(new SipSession(session), offerSd);
@@ -526,6 +526,10 @@ public class SipManager {
SipSession.Listener listener) throws SipException {
try {
ISipSession s = mSipService.createSession(localProfile, null);
+ if (s == null) {
+ throw new SipException(
+ "Failed to create SipSession; network unavailable?");
+ }
return new SipSession(s, listener);
} catch (RemoteException e) {
throw new SipException("createSipSession()", e);
@@ -541,7 +545,7 @@ public class SipManager {
try {
return mSipService.getListOfProfiles();
} catch (RemoteException e) {
- return null;
+ return new SipProfile[0];
}
}