Loading voip/java/com/android/server/sip/SipHelper.java +1 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ import javax.sip.message.Response; */ class SipHelper { private static final String TAG = SipHelper.class.getSimpleName(); private static final boolean DEBUG = true; private static final boolean DEBUG = false; private static final boolean DEBUG_PING = false; private SipStack mSipStack; Loading voip/java/com/android/server/sip/SipService.java +15 −14 Original line number Diff line number Diff line Loading @@ -68,8 +68,7 @@ import javax.sip.SipException; */ public final class SipService extends ISipService.Stub { static final String TAG = "SipService"; static final boolean DEBUGV = false; static final boolean DEBUG = true; static final boolean DEBUG = false; private static final int EXPIRY_TIME = 3600; private static final int SHORT_EXPIRY_TIME = 10; private static final int MIN_EXPIRY_TIME = 60; Loading Loading @@ -581,7 +580,7 @@ public final class SipService extends ISipService.Stub { @Override public void onRinging(ISipSession s, SipProfile caller, String sessionDescription) { if (DEBUGV) Log.d(TAG, "<<<<< onRinging()"); if (DEBUG) Log.d(TAG, "<<<<< onRinging()"); SipSessionGroup.SipSessionImpl session = (SipSessionGroup.SipSessionImpl) s; synchronized (SipService.this) { Loading Loading @@ -778,7 +777,6 @@ public final class SipService extends ISipService.Stub { private void restartLater() { synchronized (SipService.this) { int interval = NAT_MEASUREMENT_RETRY_INTERVAL; Log.d(TAG, "Retry measurement " + interval + "s later."); mTimer.cancel(this); mTimer.set(interval * 1000, this); } Loading @@ -788,7 +786,7 @@ public final class SipService extends ISipService.Stub { private class AutoRegistrationProcess extends SipSessionAdapter implements Runnable, SipSessionGroup.KeepAliveProcessCallback { private static final int MIN_KEEPALIVE_SUCCESS_COUNT = 10; private String TAG = "SipAudoReg"; private String TAG = "SipAutoReg"; private SipSessionGroup.SipSessionImpl mSession; private SipSessionGroup.SipSessionImpl mKeepAliveSession; Loading Loading @@ -820,13 +818,12 @@ public final class SipService extends ISipService.Stub { // in registration to avoid adding duplicate entries to server mMyWakeLock.acquire(mSession); mSession.unregister(); if (DEBUG) TAG = mSession.getLocalProfile().getUriString(); if (DEBUG) Log.d(TAG, "start AutoRegistrationProcess"); TAG = "SipAutoReg:" + mSession.getLocalProfile().getUriString(); } } private void startKeepAliveProcess(int interval) { Log.d(TAG, "start keepalive w interval=" + interval); if (DEBUG) Log.d(TAG, "start keepalive w interval=" + interval); if (mKeepAliveSession == null) { mKeepAliveSession = mSession.duplicate(); } else { Loading Loading @@ -864,9 +861,11 @@ public final class SipService extends ISipService.Stub { mKeepAliveSuccessCount = 0; } } else { if (DEBUG) { Log.i(TAG, "keep keepalive going with interval " + interval + ", past success count=" + mKeepAliveSuccessCount); } mKeepAliveSuccessCount /= 2; } } else { Loading Loading @@ -894,7 +893,9 @@ public final class SipService extends ISipService.Stub { // SipSessionGroup.KeepAliveProcessCallback @Override public void onError(int errorCode, String description) { if (DEBUG) { Log.e(TAG, "keepalive error: " + description); } onResponse(true); // re-register immediately } Loading @@ -917,7 +918,7 @@ public final class SipService extends ISipService.Stub { public void onKeepAliveIntervalChanged() { if (mKeepAliveSession != null) { int newInterval = getKeepAliveInterval(); if (DEBUGV) { if (DEBUG) { Log.v(TAG, "restart keepalive w interval=" + newInterval); } mKeepAliveSuccessCount = 0; Loading Loading @@ -987,7 +988,7 @@ public final class SipService extends ISipService.Stub { } private void restart(int duration) { if (DEBUG) Log.d(TAG, "Refresh registration " + duration + "s later."); Log.d(TAG, "Refresh registration " + duration + "s later."); mTimer.cancel(this); mTimer.set(duration * 1000, this); } Loading voip/java/com/android/server/sip/SipSessionGroup.java +26 −18 Original line number Diff line number Diff line Loading @@ -89,8 +89,8 @@ import javax.sip.message.Response; */ class SipSessionGroup implements SipListener { private static final String TAG = "SipSession"; private static final boolean DEBUG = true; private static final boolean DEBUG_PING = DEBUG && false; private static final boolean DEBUG = false; private static final boolean DEBUG_PING = false; private static final String ANONYMOUS = "anonymous"; // Limit the size of thread pool to 1 for the order issue when the phone is // waken up from sleep and there are many packets to be processed in the SIP Loading Loading @@ -205,7 +205,9 @@ class SipSessionGroup implements SipListener { } synchronized void resetExternalAddress() { if (DEBUG) { Log.d(TAG, " reset external addr on " + mSipStack); } mExternalIp = null; mExternalPort = 0; } Loading Loading @@ -362,7 +364,7 @@ class SipSessionGroup implements SipListener { + SipSession.State.toString(session.mState)); } } catch (Throwable e) { Log.w(TAG, "event process error: " + event, e); Log.w(TAG, "event process error: " + event, getRootCause(e)); session.onError(e); } } Loading Loading @@ -393,10 +395,21 @@ class SipSessionGroup implements SipListener { if ((rport > 0) && (externalIp != null)) { mExternalIp = externalIp; mExternalPort = rport; if (DEBUG) { Log.d(TAG, " got external addr " + externalIp + ":" + rport + " on " + mSipStack); } } } private Throwable getRootCause(Throwable exception) { Throwable cause = exception.getCause(); while (cause != null) { exception = cause; cause = exception.getCause(); } return exception; } private SipSessionImpl createNewSession(RequestEvent event, ISipSessionListener listener, ServerTransaction transaction, Loading Loading @@ -890,7 +903,9 @@ class SipSessionGroup implements SipListener { if (expires != null && time < expires.getExpires()) { time = expires.getExpires(); } if (DEBUG) { Log.v(TAG, "Expiry time = " + time); } return time; } Loading Loading @@ -1409,15 +1424,6 @@ class SipSessionGroup implements SipListener { } } private Throwable getRootCause(Throwable exception) { Throwable cause = exception.getCause(); while (cause != null) { exception = cause; cause = exception.getCause(); } return exception; } private int getErrorCode(Throwable exception) { String message = exception.getMessage(); if (exception instanceof UnknownHostException) { Loading Loading @@ -1555,8 +1561,10 @@ class SipSessionGroup implements SipListener { try { sendKeepAlive(); } catch (Throwable t) { if (DEBUG) { Log.w(TAG, "keepalive error: " + mLocalProfile.getUriString(), getRootCause(t)); } // It's possible that the keepalive process is being stopped // during session.sendKeepAlive() so need to check mRunning // again here. Loading voip/java/com/android/server/sip/SipWakeLock.java +5 −7 Original line number Diff line number Diff line Loading @@ -22,8 +22,8 @@ import android.util.Log; import java.util.HashSet; class SipWakeLock { private static final boolean DEBUGV = SipService.DEBUGV; private static final String TAG = SipService.TAG; private static final boolean DEBUG = false; private static final String TAG = "SipWakeLock"; private PowerManager mPowerManager; private PowerManager.WakeLock mWakeLock; private PowerManager.WakeLock mTimerWakeLock; Loading @@ -34,9 +34,9 @@ class SipWakeLock { } synchronized void reset() { if (DEBUG) Log.v(TAG, "reset count=" + mHolders.size()); mHolders.clear(); release(null); if (DEBUGV) Log.v(TAG, "~~~ hard reset wakelock"); } synchronized void acquire(long timeout) { Loading @@ -55,8 +55,7 @@ class SipWakeLock { PowerManager.PARTIAL_WAKE_LOCK, "SipWakeLock"); } if (!mWakeLock.isHeld()) mWakeLock.acquire(); if (DEBUGV) Log.v(TAG, "acquire wakelock: holder count=" + mHolders.size()); if (DEBUG) Log.v(TAG, "acquire count=" + mHolders.size()); } synchronized void release(Object holder) { Loading @@ -65,7 +64,6 @@ class SipWakeLock { && mWakeLock.isHeld()) { mWakeLock.release(); } if (DEBUGV) Log.v(TAG, "release wakelock: holder count=" + mHolders.size()); if (DEBUG) Log.v(TAG, "release count=" + mHolders.size()); } } Loading
voip/java/com/android/server/sip/SipHelper.java +1 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ import javax.sip.message.Response; */ class SipHelper { private static final String TAG = SipHelper.class.getSimpleName(); private static final boolean DEBUG = true; private static final boolean DEBUG = false; private static final boolean DEBUG_PING = false; private SipStack mSipStack; Loading
voip/java/com/android/server/sip/SipService.java +15 −14 Original line number Diff line number Diff line Loading @@ -68,8 +68,7 @@ import javax.sip.SipException; */ public final class SipService extends ISipService.Stub { static final String TAG = "SipService"; static final boolean DEBUGV = false; static final boolean DEBUG = true; static final boolean DEBUG = false; private static final int EXPIRY_TIME = 3600; private static final int SHORT_EXPIRY_TIME = 10; private static final int MIN_EXPIRY_TIME = 60; Loading Loading @@ -581,7 +580,7 @@ public final class SipService extends ISipService.Stub { @Override public void onRinging(ISipSession s, SipProfile caller, String sessionDescription) { if (DEBUGV) Log.d(TAG, "<<<<< onRinging()"); if (DEBUG) Log.d(TAG, "<<<<< onRinging()"); SipSessionGroup.SipSessionImpl session = (SipSessionGroup.SipSessionImpl) s; synchronized (SipService.this) { Loading Loading @@ -778,7 +777,6 @@ public final class SipService extends ISipService.Stub { private void restartLater() { synchronized (SipService.this) { int interval = NAT_MEASUREMENT_RETRY_INTERVAL; Log.d(TAG, "Retry measurement " + interval + "s later."); mTimer.cancel(this); mTimer.set(interval * 1000, this); } Loading @@ -788,7 +786,7 @@ public final class SipService extends ISipService.Stub { private class AutoRegistrationProcess extends SipSessionAdapter implements Runnable, SipSessionGroup.KeepAliveProcessCallback { private static final int MIN_KEEPALIVE_SUCCESS_COUNT = 10; private String TAG = "SipAudoReg"; private String TAG = "SipAutoReg"; private SipSessionGroup.SipSessionImpl mSession; private SipSessionGroup.SipSessionImpl mKeepAliveSession; Loading Loading @@ -820,13 +818,12 @@ public final class SipService extends ISipService.Stub { // in registration to avoid adding duplicate entries to server mMyWakeLock.acquire(mSession); mSession.unregister(); if (DEBUG) TAG = mSession.getLocalProfile().getUriString(); if (DEBUG) Log.d(TAG, "start AutoRegistrationProcess"); TAG = "SipAutoReg:" + mSession.getLocalProfile().getUriString(); } } private void startKeepAliveProcess(int interval) { Log.d(TAG, "start keepalive w interval=" + interval); if (DEBUG) Log.d(TAG, "start keepalive w interval=" + interval); if (mKeepAliveSession == null) { mKeepAliveSession = mSession.duplicate(); } else { Loading Loading @@ -864,9 +861,11 @@ public final class SipService extends ISipService.Stub { mKeepAliveSuccessCount = 0; } } else { if (DEBUG) { Log.i(TAG, "keep keepalive going with interval " + interval + ", past success count=" + mKeepAliveSuccessCount); } mKeepAliveSuccessCount /= 2; } } else { Loading Loading @@ -894,7 +893,9 @@ public final class SipService extends ISipService.Stub { // SipSessionGroup.KeepAliveProcessCallback @Override public void onError(int errorCode, String description) { if (DEBUG) { Log.e(TAG, "keepalive error: " + description); } onResponse(true); // re-register immediately } Loading @@ -917,7 +918,7 @@ public final class SipService extends ISipService.Stub { public void onKeepAliveIntervalChanged() { if (mKeepAliveSession != null) { int newInterval = getKeepAliveInterval(); if (DEBUGV) { if (DEBUG) { Log.v(TAG, "restart keepalive w interval=" + newInterval); } mKeepAliveSuccessCount = 0; Loading Loading @@ -987,7 +988,7 @@ public final class SipService extends ISipService.Stub { } private void restart(int duration) { if (DEBUG) Log.d(TAG, "Refresh registration " + duration + "s later."); Log.d(TAG, "Refresh registration " + duration + "s later."); mTimer.cancel(this); mTimer.set(duration * 1000, this); } Loading
voip/java/com/android/server/sip/SipSessionGroup.java +26 −18 Original line number Diff line number Diff line Loading @@ -89,8 +89,8 @@ import javax.sip.message.Response; */ class SipSessionGroup implements SipListener { private static final String TAG = "SipSession"; private static final boolean DEBUG = true; private static final boolean DEBUG_PING = DEBUG && false; private static final boolean DEBUG = false; private static final boolean DEBUG_PING = false; private static final String ANONYMOUS = "anonymous"; // Limit the size of thread pool to 1 for the order issue when the phone is // waken up from sleep and there are many packets to be processed in the SIP Loading Loading @@ -205,7 +205,9 @@ class SipSessionGroup implements SipListener { } synchronized void resetExternalAddress() { if (DEBUG) { Log.d(TAG, " reset external addr on " + mSipStack); } mExternalIp = null; mExternalPort = 0; } Loading Loading @@ -362,7 +364,7 @@ class SipSessionGroup implements SipListener { + SipSession.State.toString(session.mState)); } } catch (Throwable e) { Log.w(TAG, "event process error: " + event, e); Log.w(TAG, "event process error: " + event, getRootCause(e)); session.onError(e); } } Loading Loading @@ -393,10 +395,21 @@ class SipSessionGroup implements SipListener { if ((rport > 0) && (externalIp != null)) { mExternalIp = externalIp; mExternalPort = rport; if (DEBUG) { Log.d(TAG, " got external addr " + externalIp + ":" + rport + " on " + mSipStack); } } } private Throwable getRootCause(Throwable exception) { Throwable cause = exception.getCause(); while (cause != null) { exception = cause; cause = exception.getCause(); } return exception; } private SipSessionImpl createNewSession(RequestEvent event, ISipSessionListener listener, ServerTransaction transaction, Loading Loading @@ -890,7 +903,9 @@ class SipSessionGroup implements SipListener { if (expires != null && time < expires.getExpires()) { time = expires.getExpires(); } if (DEBUG) { Log.v(TAG, "Expiry time = " + time); } return time; } Loading Loading @@ -1409,15 +1424,6 @@ class SipSessionGroup implements SipListener { } } private Throwable getRootCause(Throwable exception) { Throwable cause = exception.getCause(); while (cause != null) { exception = cause; cause = exception.getCause(); } return exception; } private int getErrorCode(Throwable exception) { String message = exception.getMessage(); if (exception instanceof UnknownHostException) { Loading Loading @@ -1555,8 +1561,10 @@ class SipSessionGroup implements SipListener { try { sendKeepAlive(); } catch (Throwable t) { if (DEBUG) { Log.w(TAG, "keepalive error: " + mLocalProfile.getUriString(), getRootCause(t)); } // It's possible that the keepalive process is being stopped // during session.sendKeepAlive() so need to check mRunning // again here. Loading
voip/java/com/android/server/sip/SipWakeLock.java +5 −7 Original line number Diff line number Diff line Loading @@ -22,8 +22,8 @@ import android.util.Log; import java.util.HashSet; class SipWakeLock { private static final boolean DEBUGV = SipService.DEBUGV; private static final String TAG = SipService.TAG; private static final boolean DEBUG = false; private static final String TAG = "SipWakeLock"; private PowerManager mPowerManager; private PowerManager.WakeLock mWakeLock; private PowerManager.WakeLock mTimerWakeLock; Loading @@ -34,9 +34,9 @@ class SipWakeLock { } synchronized void reset() { if (DEBUG) Log.v(TAG, "reset count=" + mHolders.size()); mHolders.clear(); release(null); if (DEBUGV) Log.v(TAG, "~~~ hard reset wakelock"); } synchronized void acquire(long timeout) { Loading @@ -55,8 +55,7 @@ class SipWakeLock { PowerManager.PARTIAL_WAKE_LOCK, "SipWakeLock"); } if (!mWakeLock.isHeld()) mWakeLock.acquire(); if (DEBUGV) Log.v(TAG, "acquire wakelock: holder count=" + mHolders.size()); if (DEBUG) Log.v(TAG, "acquire count=" + mHolders.size()); } synchronized void release(Object holder) { Loading @@ -65,7 +64,6 @@ class SipWakeLock { && mWakeLock.isHeld()) { mWakeLock.release(); } if (DEBUGV) Log.v(TAG, "release wakelock: holder count=" + mHolders.size()); if (DEBUG) Log.v(TAG, "release count=" + mHolders.size()); } }