use of android.telephony.data.ApnSetting in project android_frameworks_opt_telephony by LineageOS.
the class RetryManagerTest method testRetryManagerModemSuggestedNoRetry.
/**
* Test the scenario where modem suggests not retrying
*/
@Test
@SmallTest
public void testRetryManagerModemSuggestedNoRetry() throws Exception {
mBundle.putStringArray(CarrierConfigManager.KEY_CARRIER_DATA_CALL_RETRY_CONFIG_STRINGS, new String[] { "default: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, "default");
rm.setWaitingApns(waitingApns);
ApnSetting nextApn = rm.getNextApnSetting();
assertTrue(nextApn.equals(mApn1));
long delay = rm.getDelayForNextApn(false);
assertEquals(20000, delay);
nextApn = rm.getNextApnSetting();
assertTrue(nextApn.equals(mApn2));
delay = rm.getDelayForNextApn(false);
assertEquals(1000, delay);
nextApn = rm.getNextApnSetting();
assertTrue(nextApn.equals(mApn1));
// Modem suggests retrying the current APN
rm.setModemSuggestedDelay(2500);
delay = rm.getDelayForNextApn(false);
assertEquals(2500, delay);
nextApn = rm.getNextApnSetting();
assertTrue(nextApn.equals(mApn1));
rm.setModemSuggestedDelay(RetryManager.NO_RETRY);
delay = rm.getDelayForNextApn(false);
assertEquals(RetryManager.NO_RETRY, delay);
}
use of android.telephony.data.ApnSetting in project android_frameworks_opt_telephony by LineageOS.
the class RetryManagerTest method testRetryManagerRetryForever.
/**
* Test the retry forever scenario
*/
@Test
@SmallTest
public void testRetryManagerRetryForever() throws Exception {
mBundle.putStringArray(CarrierConfigManager.KEY_CARRIER_DATA_CALL_RETRY_CONFIG_STRINGS, new String[] { "default:max_retries=infinite,1000,2000" });
ArrayList<ApnSetting> waitingApns = new ArrayList<ApnSetting>();
waitingApns.add(ApnSetting.makeApnSetting(mApn1));
waitingApns.add(ApnSetting.makeApnSetting(mApn2));
RetryManager rm = new RetryManager(mPhone, "default");
rm.setWaitingApns(waitingApns);
ApnSetting nextApn = rm.getNextApnSetting();
assertTrue(nextApn.equals(mApn1));
long delay = rm.getDelayForNextApn(false);
assertEquals(20000, delay);
nextApn = rm.getNextApnSetting();
assertTrue(nextApn.equals(mApn2));
delay = rm.getDelayForNextApn(false);
assertEquals(1000, delay);
nextApn = rm.getNextApnSetting();
assertTrue(nextApn.equals(mApn1));
delay = rm.getDelayForNextApn(false);
assertEquals(20000, delay);
nextApn = rm.getNextApnSetting();
assertTrue(nextApn.equals(mApn2));
delay = rm.getDelayForNextApn(false);
assertEquals(2000, delay);
nextApn = rm.getNextApnSetting();
assertTrue(nextApn.equals(mApn1));
delay = rm.getDelayForNextApn(false);
assertEquals(20000, delay);
nextApn = rm.getNextApnSetting();
assertTrue(nextApn.equals(mApn2));
delay = rm.getDelayForNextApn(false);
assertEquals(2000, delay);
nextApn = rm.getNextApnSetting();
assertTrue(nextApn.equals(mApn1));
delay = rm.getDelayForNextApn(false);
assertEquals(20000, delay);
nextApn = rm.getNextApnSetting();
assertTrue(nextApn.equals(mApn2));
delay = rm.getDelayForNextApn(false);
assertEquals(2000, delay);
}
use of android.telephony.data.ApnSetting in project android_frameworks_opt_telephony by LineageOS.
the class RetryManagerTest method testRetryManagerApnPermanentFailed.
/**
* Test the permanent fail scenario with one APN configured.
*/
@Test
@SmallTest
public void testRetryManagerApnPermanentFailed() throws Exception {
mBundle.putStringArray(CarrierConfigManager.KEY_CARRIER_DATA_CALL_RETRY_CONFIG_STRINGS, new String[] { "fota:1000,4000,7000" });
ArrayList<ApnSetting> waitingApns = new ArrayList<ApnSetting>();
ApnSetting apn = ApnSetting.makeApnSetting(mApn1);
waitingApns.add(apn);
RetryManager rm = new RetryManager(mPhone, "fota");
rm.setWaitingApns(waitingApns);
ApnSetting nextApn = rm.getNextApnSetting();
assertTrue(nextApn.equals(mApn1));
long delay = rm.getDelayForNextApn(false);
assertEquals(1000, delay);
nextApn = rm.getNextApnSetting();
assertTrue(nextApn.equals(mApn1));
delay = rm.getDelayForNextApn(false);
assertEquals(4000, delay);
rm.markApnPermanentFailed(apn);
nextApn = rm.getNextApnSetting();
assertTrue(nextApn == null);
}
use of android.telephony.data.ApnSetting in project android_frameworks_opt_telephony by LineageOS.
the class RetryManagerTest method testRetryManagerApnPermanentFailedWithThreeApns.
/**
* Test the permanent fail scenario with three APNs configured.
*/
@Test
@SmallTest
public void testRetryManagerApnPermanentFailedWithThreeApns() throws Exception {
mBundle.putStringArray(CarrierConfigManager.KEY_CARRIER_DATA_CALL_RETRY_CONFIG_STRINGS, new String[] { "default:2000:2000,3000:3000", "ims:1000,4000" });
ArrayList<ApnSetting> waitingApns = new ArrayList<ApnSetting>();
ApnSetting myApn1 = ApnSetting.makeApnSetting(mApn1);
ApnSetting myApn2 = ApnSetting.makeApnSetting(mApn2);
ApnSetting myApn3 = ApnSetting.makeApnSetting(mApn3);
waitingApns.add(myApn1);
waitingApns.add(myApn2);
waitingApns.add(myApn3);
RetryManager rm = new RetryManager(mPhone, "ims");
rm.setWaitingApns(waitingApns);
ApnSetting nextApn = rm.getNextApnSetting();
assertTrue(nextApn.equals(mApn1));
long delay = rm.getDelayForNextApn(false);
assertEquals(20000, delay);
nextApn = rm.getNextApnSetting();
assertTrue(nextApn.equals(mApn2));
delay = rm.getDelayForNextApn(false);
assertEquals(20000, delay);
rm.markApnPermanentFailed(myApn2);
nextApn = rm.getNextApnSetting();
assertTrue(nextApn.equals(mApn3));
delay = rm.getDelayForNextApn(false);
assertEquals(1000, delay);
nextApn = rm.getNextApnSetting();
assertTrue(nextApn.equals(mApn1));
delay = rm.getDelayForNextApn(false);
assertEquals(20000, delay);
nextApn = rm.getNextApnSetting();
assertTrue(nextApn.equals(mApn3));
delay = rm.getDelayForNextApn(false);
assertEquals(4000, delay);
nextApn = rm.getNextApnSetting();
assertTrue(nextApn.equals(mApn1));
delay = rm.getDelayForNextApn(false);
assertEquals(20000, delay);
nextApn = rm.getNextApnSetting();
assertTrue(nextApn.equals(mApn3));
delay = rm.getDelayForNextApn(false);
assertEquals(RetryManager.NO_RETRY, delay);
}
use of android.telephony.data.ApnSetting in project android_frameworks_opt_telephony by LineageOS.
the class RetryManagerTest method testRetryManagerOneApnNoRetry.
/**
* Test the basic retry scenario where only one APN and no retry configured.
*/
@Test
@SmallTest
public void testRetryManagerOneApnNoRetry() throws Exception {
mBundle.putStringArray(CarrierConfigManager.KEY_CARRIER_DATA_CALL_RETRY_CONFIG_STRINGS, new String[] { "default:" });
ArrayList<ApnSetting> waitingApns = new ArrayList<ApnSetting>();
waitingApns.add(ApnSetting.makeApnSetting(mApn1));
RetryManager rm = new RetryManager(mPhone, "default");
rm.setWaitingApns(waitingApns);
ApnSetting nextApn = rm.getNextApnSetting();
assertTrue(nextApn.equals(mApn1));
long delay = rm.getDelayForNextApn(false);
assertEquals(RetryManager.NO_RETRY, delay);
}
Aggregations