summaryrefslogtreecommitdiffstats
path: root/voip/java/com/android/server/sip/SipService.java
diff options
context:
space:
mode:
authorChia-chi Yeh <chiachi@android.com>2012-04-04 13:13:57 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-04-04 13:13:57 -0700
commit870085cce0fde0a44f0c28a5097b8c827cafb0e2 (patch)
tree199aa2f6e48b4d41d77986c812eb2cd4b97c39ce /voip/java/com/android/server/sip/SipService.java
parent689b741abc93a3b44d7a39e9b138162bad330f23 (diff)
parent2dd9134c6b2da47f4816bc0f72a0e4924aca4f84 (diff)
downloadframeworks_base-870085cce0fde0a44f0c28a5097b8c827cafb0e2.zip
frameworks_base-870085cce0fde0a44f0c28a5097b8c827cafb0e2.tar.gz
frameworks_base-870085cce0fde0a44f0c28a5097b8c827cafb0e2.tar.bz2
Merge "SIP: push the logic of finding local address down to SipSessionGroup."
Diffstat (limited to 'voip/java/com/android/server/sip/SipService.java')
-rw-r--r--voip/java/com/android/server/sip/SipService.java44
1 files changed, 3 insertions, 41 deletions
diff --git a/voip/java/com/android/server/sip/SipService.java b/voip/java/com/android/server/sip/SipService.java
index 97afc81..a477fd1 100644
--- a/voip/java/com/android/server/sip/SipService.java
+++ b/voip/java/com/android/server/sip/SipService.java
@@ -453,9 +453,8 @@ public final class SipService extends ISipService.Stub {
public SipSessionGroupExt(SipProfile localProfile,
PendingIntent incomingCallPendingIntent,
ISipSessionListener listener) throws SipException {
- String password = localProfile.getPassword();
- SipProfile p = duplicate(localProfile);
- mSipGroup = createSipSessionGroup(mLocalIp, p, password);
+ mSipGroup = new SipSessionGroup(duplicate(localProfile),
+ localProfile.getPassword(), mTimer, mMyWakeLock);
mIncomingCallPendingIntent = incomingCallPendingIntent;
mAutoRegistration.setListener(listener);
}
@@ -478,27 +477,6 @@ public final class SipService extends ISipService.Stub {
mSipGroup.setWakeupTimer(timer);
}
- // network connectivity is tricky because network can be disconnected
- // at any instant so need to deal with exceptions carefully even when
- // you think you are connected
- private SipSessionGroup createSipSessionGroup(String localIp,
- SipProfile localProfile, String password) throws SipException {
- try {
- return new SipSessionGroup(localIp, localProfile, password,
- mTimer, mMyWakeLock);
- } catch (IOException e) {
- // network disconnected
- Log.w(TAG, "createSipSessionGroup(): network disconnected?");
- if (localIp != null) {
- return createSipSessionGroup(null, localProfile, password);
- } else {
- // recursive
- Log.wtf(TAG, "impossible! recursive!");
- throw new RuntimeException("createSipSessionGroup");
- }
- }
- }
-
private SipProfile duplicate(SipProfile p) {
try {
return new SipProfile.Builder(p).setPassword("*").build();
@@ -530,7 +508,7 @@ public final class SipService extends ISipService.Stub {
throws SipException {
mSipGroup.onConnectivityChanged();
if (connected) {
- resetGroup(mLocalIp);
+ mSipGroup.reset();
if (mOpenedToReceiveCalls) openToReceiveCalls();
} else {
// close mSipGroup but remember mOpenedToReceiveCalls
@@ -541,22 +519,6 @@ public final class SipService extends ISipService.Stub {
}
}
- private void resetGroup(String localIp) throws SipException {
- try {
- mSipGroup.reset(localIp);
- } catch (IOException e) {
- // network disconnected
- Log.w(TAG, "resetGroup(): network disconnected?");
- if (localIp != null) {
- resetGroup(null); // reset w/o local IP
- } else {
- // recursive
- Log.wtf(TAG, "impossible!");
- throw new RuntimeException("resetGroup");
- }
- }
- }
-
public void close() {
mOpenedToReceiveCalls = false;
mSipGroup.close();