Loading src/java/com/android/internal/telephony/RetryManager.java +8 −3 Original line number Diff line number Diff line Loading @@ -498,9 +498,10 @@ public class RetryManager { // If the modem had suggested a retry delay, we should retry the current APN again // (up to MAX_SAME_APN_RETRY times) instead of getting the next APN setting from // our own list. if (mModemSuggestedDelay != NO_SUGGESTED_RETRY_DELAY && mSameApnRetryCount < MAX_SAME_APN_RETRY) { // our own list. If the APN waiting list has been reset before a setup data responses // arrive (i.e. mCurrentApnIndex=-1), then ignore the modem suggested retry. if (mCurrentApnIndex != -1 && mModemSuggestedDelay != NO_SUGGESTED_RETRY_DELAY && mSameApnRetryCount < MAX_SAME_APN_RETRY) { mSameApnRetryCount++; return mWaitingApns.get(mCurrentApnIndex); } Loading Loading @@ -665,6 +666,10 @@ public class RetryManager { * @param delay The delay in milliseconds */ public void setModemSuggestedDelay(long delay) { if (mCurrentApnIndex == -1) { log("Waiting APN list has been reset. Ignore the value from modem."); return; } mModemSuggestedDelay = delay; } Loading tests/telephonytests/src/com/android/internal/telephony/dataconnection/RetryManagerTest.java +27 −0 Original line number Diff line number Diff line Loading @@ -1026,4 +1026,31 @@ public class RetryManagerTest extends TelephonyTest { delay = rm.getDelayForNextApn(false); assertEquals(4000, delay); } /** * Test the scenario where reset happens before modem suggests retry. */ @Test @SmallTest public void testRetryManagerResetBeforeModemSuggestedRetry() throws Exception { mBundle.putStringArray(CarrierConfigManager.KEY_CARRIER_DATA_CALL_RETRY_CONFIG_STRINGS, new String[]{"others:1000,4000,7000,9000"}); ArrayList<ApnSetting> waitingApns = new ArrayList<ApnSetting>(); ApnSetting myApn1 = ApnSetting.makeApnSetting(mApn1); ApnSetting myApn2 = ApnSetting.makeApnSetting(mApn2); waitingApns.add(myApn1); waitingApns.add(myApn2); RetryManager rm = new RetryManager(mPhone, "mms"); rm.setWaitingApns(waitingApns); rm.setModemSuggestedDelay(10); ApnSetting nextApn = rm.getNextApnSetting(); assertTrue(nextApn.equals(mApn1)); long delay = rm.getDelayForNextApn(false); assertEquals(20000, delay); } } Loading
src/java/com/android/internal/telephony/RetryManager.java +8 −3 Original line number Diff line number Diff line Loading @@ -498,9 +498,10 @@ public class RetryManager { // If the modem had suggested a retry delay, we should retry the current APN again // (up to MAX_SAME_APN_RETRY times) instead of getting the next APN setting from // our own list. if (mModemSuggestedDelay != NO_SUGGESTED_RETRY_DELAY && mSameApnRetryCount < MAX_SAME_APN_RETRY) { // our own list. If the APN waiting list has been reset before a setup data responses // arrive (i.e. mCurrentApnIndex=-1), then ignore the modem suggested retry. if (mCurrentApnIndex != -1 && mModemSuggestedDelay != NO_SUGGESTED_RETRY_DELAY && mSameApnRetryCount < MAX_SAME_APN_RETRY) { mSameApnRetryCount++; return mWaitingApns.get(mCurrentApnIndex); } Loading Loading @@ -665,6 +666,10 @@ public class RetryManager { * @param delay The delay in milliseconds */ public void setModemSuggestedDelay(long delay) { if (mCurrentApnIndex == -1) { log("Waiting APN list has been reset. Ignore the value from modem."); return; } mModemSuggestedDelay = delay; } Loading
tests/telephonytests/src/com/android/internal/telephony/dataconnection/RetryManagerTest.java +27 −0 Original line number Diff line number Diff line Loading @@ -1026,4 +1026,31 @@ public class RetryManagerTest extends TelephonyTest { delay = rm.getDelayForNextApn(false); assertEquals(4000, delay); } /** * Test the scenario where reset happens before modem suggests retry. */ @Test @SmallTest public void testRetryManagerResetBeforeModemSuggestedRetry() throws Exception { mBundle.putStringArray(CarrierConfigManager.KEY_CARRIER_DATA_CALL_RETRY_CONFIG_STRINGS, new String[]{"others:1000,4000,7000,9000"}); ArrayList<ApnSetting> waitingApns = new ArrayList<ApnSetting>(); ApnSetting myApn1 = ApnSetting.makeApnSetting(mApn1); ApnSetting myApn2 = ApnSetting.makeApnSetting(mApn2); waitingApns.add(myApn1); waitingApns.add(myApn2); RetryManager rm = new RetryManager(mPhone, "mms"); rm.setWaitingApns(waitingApns); rm.setModemSuggestedDelay(10); ApnSetting nextApn = rm.getNextApnSetting(); assertTrue(nextApn.equals(mApn1)); long delay = rm.getDelayForNextApn(false); assertEquals(20000, delay); } }