Loading voip/java/com/android/server/sip/SipService.java +32 −30 Original line number Diff line number Diff line Loading @@ -442,6 +442,7 @@ public final class SipService extends ISipService.Stub { if (wasConnected) { mLocalIp = null; stopPortMappingMeasurement(); for (SipSessionGroupExt group : mSipGroups.values()) { group.onConnectivityChanged(false); } Loading @@ -457,7 +458,6 @@ public final class SipService extends ISipService.Stub { if (isWifi && (mWifiLock != null)) stopWifiScanner(); } else { mMyWakeLock.reset(); // in case there's a leak stopPortMappingMeasurement(); if (isWifi && (mWifiLock != null)) startWifiScanner(); } } catch (SipException e) { Loading Loading @@ -784,52 +784,50 @@ public final class SipService extends ISipService.Stub { private static final int PASS_THRESHOLD = 10; private static final int MAX_RETRY_COUNT = 5; private static final int NAT_MEASUREMENT_RETRY_INTERVAL = 120; // in seconds private SipProfile mLocalProfile; private SipSessionGroupExt mGroup; private SipSessionGroup.SipSessionImpl mSession; private int mMinInterval; private int mMaxInterval; private int mInterval; private int mPassCount = 0; private int mPassCount; public IntervalMeasurementProcess(SipProfile localProfile, int minInterval, int maxInterval) { mMaxInterval = maxInterval; mMinInterval = minInterval; mInterval = (maxInterval + minInterval) / 2; mLocalProfile = localProfile; } // Don't start measurement if the interval is too small if (mInterval < DEFAULT_KEEPALIVE_INTERVAL) { Log.w(TAG, "interval is too small; measurement aborted; " + "maxInterval=" + mMaxInterval); public void start() { synchronized (SipService.this) { if (mSession != null) { return; } else if (checkTermination()) { Log.w(TAG, "interval is too small; measurement aborted; " + "interval=[" + mMinInterval + "," + mMaxInterval + "]"); } mInterval = (mMaxInterval + mMinInterval) / 2; mPassCount = 0; // Don't start measurement if the interval is too small if (mInterval < DEFAULT_KEEPALIVE_INTERVAL || checkTermination()) { Log.w(TAG, "measurement aborted; interval=[" + mMinInterval + "," + mMaxInterval + "]"); return; } try { mGroup = new SipSessionGroupExt(localProfile, null, null); Log.d(TAG, "start measurement w interval=" + mInterval); mGroup = new SipSessionGroupExt(mLocalProfile, null, null); // TODO: remove this line once SipWakeupTimer can better handle // variety of timeout values mGroup.setWakeupTimer(new SipWakeupTimer(mContext, mExecutor)); } catch (Exception e) { Log.w(TAG, "start interval measurement error: " + e); } } public void start() { synchronized (SipService.this) { Log.d(TAG, "start measurement w interval=" + mInterval); if (mSession == null) { mSession = (SipSessionGroup.SipSessionImpl) mGroup.createSession(null); } try { mSession.startKeepAliveProcess(mInterval, this); } catch (SipException e) { Log.e(TAG, "start()", e); } catch (Throwable t) { onError(SipErrorCode.CLIENT_ERROR, t.toString()); } } } Loading @@ -840,6 +838,10 @@ public final class SipService extends ISipService.Stub { mSession.stopKeepAliveProcess(); mSession = null; } if (mGroup != null) { mGroup.close(); mGroup = null; } mTimer.cancel(this); } } Loading voip/java/com/android/server/sip/SipSessionGroup.java +2 −2 Original line number Diff line number Diff line Loading @@ -100,7 +100,7 @@ class SipSessionGroup implements SipListener { private static final int EXPIRY_TIME = 3600; // in seconds private static final int CANCEL_CALL_TIMER = 3; // in seconds private static final int END_CALL_TIMER = 3; // in seconds private static final int KEEPALIVE_TIMEOUT = 3; // in seconds private static final int KEEPALIVE_TIMEOUT = 5; // in seconds private static final int INCALL_KEEPALIVE_INTERVAL = 10; // in seconds private static final long WAKE_LOCK_HOLDING_TIME = 500; // in milliseconds Loading Loading @@ -1555,7 +1555,7 @@ class SipSessionGroup implements SipListener { try { sendKeepAlive(); } catch (Throwable t) { Log.w(TAG, "keepalive error: " + ": " 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 Loading Loading
voip/java/com/android/server/sip/SipService.java +32 −30 Original line number Diff line number Diff line Loading @@ -442,6 +442,7 @@ public final class SipService extends ISipService.Stub { if (wasConnected) { mLocalIp = null; stopPortMappingMeasurement(); for (SipSessionGroupExt group : mSipGroups.values()) { group.onConnectivityChanged(false); } Loading @@ -457,7 +458,6 @@ public final class SipService extends ISipService.Stub { if (isWifi && (mWifiLock != null)) stopWifiScanner(); } else { mMyWakeLock.reset(); // in case there's a leak stopPortMappingMeasurement(); if (isWifi && (mWifiLock != null)) startWifiScanner(); } } catch (SipException e) { Loading Loading @@ -784,52 +784,50 @@ public final class SipService extends ISipService.Stub { private static final int PASS_THRESHOLD = 10; private static final int MAX_RETRY_COUNT = 5; private static final int NAT_MEASUREMENT_RETRY_INTERVAL = 120; // in seconds private SipProfile mLocalProfile; private SipSessionGroupExt mGroup; private SipSessionGroup.SipSessionImpl mSession; private int mMinInterval; private int mMaxInterval; private int mInterval; private int mPassCount = 0; private int mPassCount; public IntervalMeasurementProcess(SipProfile localProfile, int minInterval, int maxInterval) { mMaxInterval = maxInterval; mMinInterval = minInterval; mInterval = (maxInterval + minInterval) / 2; mLocalProfile = localProfile; } // Don't start measurement if the interval is too small if (mInterval < DEFAULT_KEEPALIVE_INTERVAL) { Log.w(TAG, "interval is too small; measurement aborted; " + "maxInterval=" + mMaxInterval); public void start() { synchronized (SipService.this) { if (mSession != null) { return; } else if (checkTermination()) { Log.w(TAG, "interval is too small; measurement aborted; " + "interval=[" + mMinInterval + "," + mMaxInterval + "]"); } mInterval = (mMaxInterval + mMinInterval) / 2; mPassCount = 0; // Don't start measurement if the interval is too small if (mInterval < DEFAULT_KEEPALIVE_INTERVAL || checkTermination()) { Log.w(TAG, "measurement aborted; interval=[" + mMinInterval + "," + mMaxInterval + "]"); return; } try { mGroup = new SipSessionGroupExt(localProfile, null, null); Log.d(TAG, "start measurement w interval=" + mInterval); mGroup = new SipSessionGroupExt(mLocalProfile, null, null); // TODO: remove this line once SipWakeupTimer can better handle // variety of timeout values mGroup.setWakeupTimer(new SipWakeupTimer(mContext, mExecutor)); } catch (Exception e) { Log.w(TAG, "start interval measurement error: " + e); } } public void start() { synchronized (SipService.this) { Log.d(TAG, "start measurement w interval=" + mInterval); if (mSession == null) { mSession = (SipSessionGroup.SipSessionImpl) mGroup.createSession(null); } try { mSession.startKeepAliveProcess(mInterval, this); } catch (SipException e) { Log.e(TAG, "start()", e); } catch (Throwable t) { onError(SipErrorCode.CLIENT_ERROR, t.toString()); } } } Loading @@ -840,6 +838,10 @@ public final class SipService extends ISipService.Stub { mSession.stopKeepAliveProcess(); mSession = null; } if (mGroup != null) { mGroup.close(); mGroup = null; } mTimer.cancel(this); } } Loading
voip/java/com/android/server/sip/SipSessionGroup.java +2 −2 Original line number Diff line number Diff line Loading @@ -100,7 +100,7 @@ class SipSessionGroup implements SipListener { private static final int EXPIRY_TIME = 3600; // in seconds private static final int CANCEL_CALL_TIMER = 3; // in seconds private static final int END_CALL_TIMER = 3; // in seconds private static final int KEEPALIVE_TIMEOUT = 3; // in seconds private static final int KEEPALIVE_TIMEOUT = 5; // in seconds private static final int INCALL_KEEPALIVE_INTERVAL = 10; // in seconds private static final long WAKE_LOCK_HOLDING_TIME = 500; // in milliseconds Loading Loading @@ -1555,7 +1555,7 @@ class SipSessionGroup implements SipListener { try { sendKeepAlive(); } catch (Throwable t) { Log.w(TAG, "keepalive error: " + ": " 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 Loading