Loading src/java/com/android/internal/telephony/data/AutoDataSwitchController.java +2 −3 Original line number Diff line number Diff line Loading @@ -535,13 +535,13 @@ public class AutoDataSwitchController extends Handler { if (preferredPhoneId == defaultDataPhoneId) { // on default data sub int candidatePhoneId = getSwitchCandidatePhoneId(defaultDataPhoneId, debugMessage); log(debugMessage.toString()); if (candidatePhoneId != INVALID_PHONE_INDEX) { mSelectedTargetPhoneId = candidatePhoneId; startStabilityCheck(candidatePhoneId, mRequirePingTestBeforeSwitch); } else { cancelAnyPendingSwitch(); } log(debugMessage.toString()); } else { // on backup data sub Phone backupDataPhone = PhoneFactory.getPhone(preferredPhoneId); Loading Loading @@ -663,10 +663,9 @@ public class AutoDataSwitchController extends Handler { debugMessage.append(", but its data is not allowed"); } } } else { debugMessage.append(", no candidate found in Home service"); } } debugMessage.append(", found no qualified candidate."); return INVALID_PHONE_INDEX; } Loading tests/telephonytests/src/com/android/internal/telephony/data/AutoDataSwitchControllerTest.java +7 −5 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ public class AutoDataSwitchControllerTest extends TelephonyTest { // Change data config doReturn(true).when(mDataConfigManager).isPingTestBeforeAutoDataSwitchRequired(); doReturn(1L).when(mDataConfigManager) doReturn(10000L).when(mDataConfigManager) .getAutoDataSwitchAvailabilityStabilityTimeThreshold(); doReturn(MAX_RETRY).when(mDataConfigManager).getAutoDataSwitchValidationMaxRetry(); doReturn(SCORE_TOLERANCE).when(mDataConfigManager).getAutoDataSwitchScoreTolerance(); Loading Loading @@ -353,10 +353,12 @@ public class AutoDataSwitchControllerTest extends TelephonyTest { // Switch success, but the previous stability check is still pending doReturn(PHONE_2).when(mPhoneSwitcher).getPreferredDataPhoneId(); // The attempt to switch back should override the previous stability check serviceStateChanged(PHONE_1, NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING); // process messages without touching the delayed message, allow it to be overridden. processAllMessages(); // Display info and signal strength on secondary phone became worse than the default. // Expect to switch back, and it should override the previous stability check serviceStateChanged(PHONE_1, NetworkRegistrationInfo.REGISTRATION_STATE_HOME); signalStrengthChanged(PHONE_1, SignalStrength.SIGNAL_STRENGTH_GREAT); displayInfoChanged(PHONE_2, mBadTelephonyDisplayInfo); signalStrengthChanged(PHONE_2, SignalStrength.SIGNAL_STRENGTH_POOR); // process all messages include the delayed message processAllFutureMessages(); Loading Loading
src/java/com/android/internal/telephony/data/AutoDataSwitchController.java +2 −3 Original line number Diff line number Diff line Loading @@ -535,13 +535,13 @@ public class AutoDataSwitchController extends Handler { if (preferredPhoneId == defaultDataPhoneId) { // on default data sub int candidatePhoneId = getSwitchCandidatePhoneId(defaultDataPhoneId, debugMessage); log(debugMessage.toString()); if (candidatePhoneId != INVALID_PHONE_INDEX) { mSelectedTargetPhoneId = candidatePhoneId; startStabilityCheck(candidatePhoneId, mRequirePingTestBeforeSwitch); } else { cancelAnyPendingSwitch(); } log(debugMessage.toString()); } else { // on backup data sub Phone backupDataPhone = PhoneFactory.getPhone(preferredPhoneId); Loading Loading @@ -663,10 +663,9 @@ public class AutoDataSwitchController extends Handler { debugMessage.append(", but its data is not allowed"); } } } else { debugMessage.append(", no candidate found in Home service"); } } debugMessage.append(", found no qualified candidate."); return INVALID_PHONE_INDEX; } Loading
tests/telephonytests/src/com/android/internal/telephony/data/AutoDataSwitchControllerTest.java +7 −5 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ public class AutoDataSwitchControllerTest extends TelephonyTest { // Change data config doReturn(true).when(mDataConfigManager).isPingTestBeforeAutoDataSwitchRequired(); doReturn(1L).when(mDataConfigManager) doReturn(10000L).when(mDataConfigManager) .getAutoDataSwitchAvailabilityStabilityTimeThreshold(); doReturn(MAX_RETRY).when(mDataConfigManager).getAutoDataSwitchValidationMaxRetry(); doReturn(SCORE_TOLERANCE).when(mDataConfigManager).getAutoDataSwitchScoreTolerance(); Loading Loading @@ -353,10 +353,12 @@ public class AutoDataSwitchControllerTest extends TelephonyTest { // Switch success, but the previous stability check is still pending doReturn(PHONE_2).when(mPhoneSwitcher).getPreferredDataPhoneId(); // The attempt to switch back should override the previous stability check serviceStateChanged(PHONE_1, NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING); // process messages without touching the delayed message, allow it to be overridden. processAllMessages(); // Display info and signal strength on secondary phone became worse than the default. // Expect to switch back, and it should override the previous stability check serviceStateChanged(PHONE_1, NetworkRegistrationInfo.REGISTRATION_STATE_HOME); signalStrengthChanged(PHONE_1, SignalStrength.SIGNAL_STRENGTH_GREAT); displayInfoChanged(PHONE_2, mBadTelephonyDisplayInfo); signalStrengthChanged(PHONE_2, SignalStrength.SIGNAL_STRENGTH_POOR); // process all messages include the delayed message processAllFutureMessages(); Loading