Loading src/java/com/android/internal/telephony/data/AutoDataSwitchController.java +71 −150 Original line number Original line Diff line number Diff line Loading @@ -230,12 +230,6 @@ public class AutoDataSwitchController extends Handler { * even if ping test fails. * even if ping test fails. */ */ private boolean mRequirePingTestBeforeSwitch = true; private boolean mRequirePingTestBeforeSwitch = true; /** * TODO: remove after V. * To indicate whether allow using roaming nDDS if user enabled its roaming when the DDS is not * usable(OOS or disabled roaming) */ private boolean mAllowNddsRoaming = true; /** The count of consecutive auto switch validation failure **/ /** The count of consecutive auto switch validation failure **/ private int mAutoSwitchValidationFailedCount = 0; private int mAutoSwitchValidationFailedCount = 0; /** /** Loading Loading @@ -495,7 +489,6 @@ public class AutoDataSwitchController extends Handler { DataConfigManager dataConfig = phone.getDataNetworkController().getDataConfigManager(); DataConfigManager dataConfig = phone.getDataNetworkController().getDataConfigManager(); mScoreTolerance = dataConfig.getAutoDataSwitchScoreTolerance(); mScoreTolerance = dataConfig.getAutoDataSwitchScoreTolerance(); mRequirePingTestBeforeSwitch = dataConfig.isPingTestBeforeAutoDataSwitchRequired(); mRequirePingTestBeforeSwitch = dataConfig.isPingTestBeforeAutoDataSwitchRequired(); mAllowNddsRoaming = dataConfig.doesAutoDataSwitchAllowRoaming(); STABILITY_CHECK_TIMER_MAP.put(STABILITY_CHECK_AVAILABILITY_SWITCH, STABILITY_CHECK_TIMER_MAP.put(STABILITY_CHECK_AVAILABILITY_SWITCH, dataConfig.getAutoDataSwitchAvailabilityStabilityTimeThreshold()); dataConfig.getAutoDataSwitchAvailabilityStabilityTimeThreshold()); STABILITY_CHECK_TIMER_MAP.put(STABILITY_CHECK_PERFORMANCE_SWITCH, STABILITY_CHECK_TIMER_MAP.put(STABILITY_CHECK_PERFORMANCE_SWITCH, Loading Loading @@ -740,7 +733,6 @@ public class AutoDataSwitchController extends Handler { int switchType = STABILITY_CHECK_AVAILABILITY_SWITCH; int switchType = STABILITY_CHECK_AVAILABILITY_SWITCH; boolean needValidation = true; boolean needValidation = true; if (isNddsRoamingEnabled()) { if (mDefaultNetworkIsOnNonCellular) { if (mDefaultNetworkIsOnNonCellular) { debugMessage.append(", back to default as default network") debugMessage.append(", back to default as default network") .append(" is active on nonCellular transport"); .append(" is active on nonCellular transport"); Loading Loading @@ -798,34 +790,6 @@ public class AutoDataSwitchController extends Handler { } } } } } } } else { if (mDefaultNetworkIsOnNonCellular) { debugMessage.append(", back to default as default network") .append(" is active on nonCellular transport"); backToDefault = true; needValidation = false; } else if (!isHomeService(mPhonesSignalStatus[preferredPhoneId].mDataRegState)) { debugMessage.append(", back to default as backup phone lost HOME registration"); backToDefault = true; needValidation = false; } else if (isRatSignalStrengthBasedSwitchEnabled()) { int defaultScore = mPhonesSignalStatus[defaultDataPhoneId].getRatSignalScore(); int currentScore = mPhonesSignalStatus[preferredPhoneId].getRatSignalScore(); if (defaultScore >= currentScore) { debugMessage .append(", back to default as default has higher or equal score ") .append(defaultScore).append(" versus current ") .append(currentScore); backToDefault = true; switchType = STABILITY_CHECK_PERFORMANCE_SWITCH; needValidation = mRequirePingTestBeforeSwitch; } } else if (isInService(mPhonesSignalStatus[defaultDataPhoneId].mDataRegState)) { debugMessage.append(", back to default as the default is back to service "); backToDefault = true; needValidation = mRequirePingTestBeforeSwitch; } } if (backToDefault) { if (backToDefault) { log(debugMessage.toString()); log(debugMessage.toString()); Loading Loading @@ -867,21 +831,12 @@ public class AutoDataSwitchController extends Handler { return invalidResult; return invalidResult; } } if (isNddsRoamingEnabled()) { // check whether primary and secondary signal status are worth switching // check whether primary and secondary signal status are worth switching if (!isRatSignalStrengthBasedSwitchEnabled() if (!isRatSignalStrengthBasedSwitchEnabled() && isHomeService(mPhonesSignalStatus[defaultPhoneId].mDataRegState)) { && isHomeService(mPhonesSignalStatus[defaultPhoneId].mDataRegState)) { debugMessage.append(", no candidate as default phone is in HOME service"); debugMessage.append(", no candidate as default phone is in HOME service"); return invalidResult; return invalidResult; } } } else { // check whether primary and secondary signal status are worth switching if (!isRatSignalStrengthBasedSwitchEnabled() && isInService(mPhonesSignalStatus[defaultPhoneId].mDataRegState)) { debugMessage.append(", no candidate as default phone is in service"); return invalidResult; } } PhoneSignalStatus defaultPhoneStatus = mPhonesSignalStatus[defaultPhoneId]; PhoneSignalStatus defaultPhoneStatus = mPhonesSignalStatus[defaultPhoneId]; for (int phoneId = 0; phoneId < mPhonesSignalStatus.length; phoneId++) { for (int phoneId = 0; phoneId < mPhonesSignalStatus.length; phoneId++) { Loading @@ -889,7 +844,6 @@ public class AutoDataSwitchController extends Handler { Phone secondaryDataPhone = null; Phone secondaryDataPhone = null; PhoneSignalStatus candidatePhoneStatus = mPhonesSignalStatus[phoneId]; PhoneSignalStatus candidatePhoneStatus = mPhonesSignalStatus[phoneId]; if (isNddsRoamingEnabled()) { PhoneSignalStatus.UsableState currentUsableState = PhoneSignalStatus.UsableState currentUsableState = mPhonesSignalStatus[defaultPhoneId].getUsableState(); mPhonesSignalStatus[defaultPhoneId].getUsableState(); PhoneSignalStatus.UsableState candidateUsableState = PhoneSignalStatus.UsableState candidateUsableState = Loading @@ -916,32 +870,6 @@ public class AutoDataSwitchController extends Handler { .append(defaultScore); .append(defaultScore); } } } } } else if (isHomeService(candidatePhoneStatus.mDataRegState)) { // the alternative phone must have HOME availability debugMessage.append(", found phone ").append(phoneId).append(" in HOME service"); if (isInService(defaultPhoneStatus.mDataRegState)) { // Use score if RAT/signal strength based switch is enabled and both phone are // in service. if (isRatSignalStrengthBasedSwitchEnabled()) { int defaultScore = mPhonesSignalStatus[defaultPhoneId].getRatSignalScore(); int candidateScore = mPhonesSignalStatus[phoneId].getRatSignalScore(); if ((candidateScore - defaultScore) > mScoreTolerance) { debugMessage.append(" with higher score ").append(candidateScore) .append(" versus current ").append(defaultScore); secondaryDataPhone = PhoneFactory.getPhone(phoneId); switchType = STABILITY_CHECK_PERFORMANCE_SWITCH; } else { debugMessage.append(", but its score ").append(candidateScore) .append(" doesn't meet the bar to switch given the current ") .append(defaultScore); } } } else { // Only OOS/in service switch is enabled. secondaryDataPhone = PhoneFactory.getPhone(phoneId); } } if (secondaryDataPhone != null) { if (secondaryDataPhone != null) { DataEvaluation evaluation = getInternetEvaluation(secondaryDataPhone); DataEvaluation evaluation = getInternetEvaluation(secondaryDataPhone); Loading Loading @@ -988,13 +916,6 @@ public class AutoDataSwitchController extends Handler { && sFeatureFlags.autoDataSwitchEnhanced(); && sFeatureFlags.autoDataSwitchEnhanced(); } } /** * @return {@code true} If the feature of switching to roaming non DDS is enabled. */ private boolean isNddsRoamingEnabled() { return mAllowNddsRoaming; } /** /** * Called when the current environment suits auto data switch. * Called when the current environment suits auto data switch. * Start pre-switch validation if the current environment suits auto data switch for * Start pre-switch validation if the current environment suits auto data switch for Loading src/java/com/android/internal/telephony/data/DataConfigManager.java +0 −9 Original line number Original line Diff line number Diff line Loading @@ -1124,15 +1124,6 @@ public class DataConfigManager extends Handler { .auto_data_switch_score_tolerance); .auto_data_switch_score_tolerance); } } /** * TODO: remove after V. * @return To indicate whether allow using roaming nDDS if user enabled its roaming when the DDS * is not usable(OOS or disabled roaming) */ public boolean doesAutoDataSwitchAllowRoaming() { return mResources.getBoolean(com.android.internal.R.bool.auto_data_switch_allow_roaming); } /** /** * @return The maximum number of retries when a validation for switching failed. * @return The maximum number of retries when a validation for switching failed. */ */ Loading tests/telephonytests/src/com/android/internal/telephony/data/AutoDataSwitchControllerTest.java +0 −1 Original line number Original line Diff line number Diff line Loading @@ -164,7 +164,6 @@ public class AutoDataSwitchControllerTest extends TelephonyTest { // Change data config // Change data config doReturn(true).when(mDataConfigManager).isPingTestBeforeAutoDataSwitchRequired(); doReturn(true).when(mDataConfigManager).isPingTestBeforeAutoDataSwitchRequired(); doReturn(true).when(mDataConfigManager).doesAutoDataSwitchAllowRoaming(); doReturn(10000L).when(mDataConfigManager) doReturn(10000L).when(mDataConfigManager) .getAutoDataSwitchAvailabilityStabilityTimeThreshold(); .getAutoDataSwitchAvailabilityStabilityTimeThreshold(); doReturn(120000L).when(mDataConfigManager) doReturn(120000L).when(mDataConfigManager) Loading Loading
src/java/com/android/internal/telephony/data/AutoDataSwitchController.java +71 −150 Original line number Original line Diff line number Diff line Loading @@ -230,12 +230,6 @@ public class AutoDataSwitchController extends Handler { * even if ping test fails. * even if ping test fails. */ */ private boolean mRequirePingTestBeforeSwitch = true; private boolean mRequirePingTestBeforeSwitch = true; /** * TODO: remove after V. * To indicate whether allow using roaming nDDS if user enabled its roaming when the DDS is not * usable(OOS or disabled roaming) */ private boolean mAllowNddsRoaming = true; /** The count of consecutive auto switch validation failure **/ /** The count of consecutive auto switch validation failure **/ private int mAutoSwitchValidationFailedCount = 0; private int mAutoSwitchValidationFailedCount = 0; /** /** Loading Loading @@ -495,7 +489,6 @@ public class AutoDataSwitchController extends Handler { DataConfigManager dataConfig = phone.getDataNetworkController().getDataConfigManager(); DataConfigManager dataConfig = phone.getDataNetworkController().getDataConfigManager(); mScoreTolerance = dataConfig.getAutoDataSwitchScoreTolerance(); mScoreTolerance = dataConfig.getAutoDataSwitchScoreTolerance(); mRequirePingTestBeforeSwitch = dataConfig.isPingTestBeforeAutoDataSwitchRequired(); mRequirePingTestBeforeSwitch = dataConfig.isPingTestBeforeAutoDataSwitchRequired(); mAllowNddsRoaming = dataConfig.doesAutoDataSwitchAllowRoaming(); STABILITY_CHECK_TIMER_MAP.put(STABILITY_CHECK_AVAILABILITY_SWITCH, STABILITY_CHECK_TIMER_MAP.put(STABILITY_CHECK_AVAILABILITY_SWITCH, dataConfig.getAutoDataSwitchAvailabilityStabilityTimeThreshold()); dataConfig.getAutoDataSwitchAvailabilityStabilityTimeThreshold()); STABILITY_CHECK_TIMER_MAP.put(STABILITY_CHECK_PERFORMANCE_SWITCH, STABILITY_CHECK_TIMER_MAP.put(STABILITY_CHECK_PERFORMANCE_SWITCH, Loading Loading @@ -740,7 +733,6 @@ public class AutoDataSwitchController extends Handler { int switchType = STABILITY_CHECK_AVAILABILITY_SWITCH; int switchType = STABILITY_CHECK_AVAILABILITY_SWITCH; boolean needValidation = true; boolean needValidation = true; if (isNddsRoamingEnabled()) { if (mDefaultNetworkIsOnNonCellular) { if (mDefaultNetworkIsOnNonCellular) { debugMessage.append(", back to default as default network") debugMessage.append(", back to default as default network") .append(" is active on nonCellular transport"); .append(" is active on nonCellular transport"); Loading Loading @@ -798,34 +790,6 @@ public class AutoDataSwitchController extends Handler { } } } } } } } else { if (mDefaultNetworkIsOnNonCellular) { debugMessage.append(", back to default as default network") .append(" is active on nonCellular transport"); backToDefault = true; needValidation = false; } else if (!isHomeService(mPhonesSignalStatus[preferredPhoneId].mDataRegState)) { debugMessage.append(", back to default as backup phone lost HOME registration"); backToDefault = true; needValidation = false; } else if (isRatSignalStrengthBasedSwitchEnabled()) { int defaultScore = mPhonesSignalStatus[defaultDataPhoneId].getRatSignalScore(); int currentScore = mPhonesSignalStatus[preferredPhoneId].getRatSignalScore(); if (defaultScore >= currentScore) { debugMessage .append(", back to default as default has higher or equal score ") .append(defaultScore).append(" versus current ") .append(currentScore); backToDefault = true; switchType = STABILITY_CHECK_PERFORMANCE_SWITCH; needValidation = mRequirePingTestBeforeSwitch; } } else if (isInService(mPhonesSignalStatus[defaultDataPhoneId].mDataRegState)) { debugMessage.append(", back to default as the default is back to service "); backToDefault = true; needValidation = mRequirePingTestBeforeSwitch; } } if (backToDefault) { if (backToDefault) { log(debugMessage.toString()); log(debugMessage.toString()); Loading Loading @@ -867,21 +831,12 @@ public class AutoDataSwitchController extends Handler { return invalidResult; return invalidResult; } } if (isNddsRoamingEnabled()) { // check whether primary and secondary signal status are worth switching // check whether primary and secondary signal status are worth switching if (!isRatSignalStrengthBasedSwitchEnabled() if (!isRatSignalStrengthBasedSwitchEnabled() && isHomeService(mPhonesSignalStatus[defaultPhoneId].mDataRegState)) { && isHomeService(mPhonesSignalStatus[defaultPhoneId].mDataRegState)) { debugMessage.append(", no candidate as default phone is in HOME service"); debugMessage.append(", no candidate as default phone is in HOME service"); return invalidResult; return invalidResult; } } } else { // check whether primary and secondary signal status are worth switching if (!isRatSignalStrengthBasedSwitchEnabled() && isInService(mPhonesSignalStatus[defaultPhoneId].mDataRegState)) { debugMessage.append(", no candidate as default phone is in service"); return invalidResult; } } PhoneSignalStatus defaultPhoneStatus = mPhonesSignalStatus[defaultPhoneId]; PhoneSignalStatus defaultPhoneStatus = mPhonesSignalStatus[defaultPhoneId]; for (int phoneId = 0; phoneId < mPhonesSignalStatus.length; phoneId++) { for (int phoneId = 0; phoneId < mPhonesSignalStatus.length; phoneId++) { Loading @@ -889,7 +844,6 @@ public class AutoDataSwitchController extends Handler { Phone secondaryDataPhone = null; Phone secondaryDataPhone = null; PhoneSignalStatus candidatePhoneStatus = mPhonesSignalStatus[phoneId]; PhoneSignalStatus candidatePhoneStatus = mPhonesSignalStatus[phoneId]; if (isNddsRoamingEnabled()) { PhoneSignalStatus.UsableState currentUsableState = PhoneSignalStatus.UsableState currentUsableState = mPhonesSignalStatus[defaultPhoneId].getUsableState(); mPhonesSignalStatus[defaultPhoneId].getUsableState(); PhoneSignalStatus.UsableState candidateUsableState = PhoneSignalStatus.UsableState candidateUsableState = Loading @@ -916,32 +870,6 @@ public class AutoDataSwitchController extends Handler { .append(defaultScore); .append(defaultScore); } } } } } else if (isHomeService(candidatePhoneStatus.mDataRegState)) { // the alternative phone must have HOME availability debugMessage.append(", found phone ").append(phoneId).append(" in HOME service"); if (isInService(defaultPhoneStatus.mDataRegState)) { // Use score if RAT/signal strength based switch is enabled and both phone are // in service. if (isRatSignalStrengthBasedSwitchEnabled()) { int defaultScore = mPhonesSignalStatus[defaultPhoneId].getRatSignalScore(); int candidateScore = mPhonesSignalStatus[phoneId].getRatSignalScore(); if ((candidateScore - defaultScore) > mScoreTolerance) { debugMessage.append(" with higher score ").append(candidateScore) .append(" versus current ").append(defaultScore); secondaryDataPhone = PhoneFactory.getPhone(phoneId); switchType = STABILITY_CHECK_PERFORMANCE_SWITCH; } else { debugMessage.append(", but its score ").append(candidateScore) .append(" doesn't meet the bar to switch given the current ") .append(defaultScore); } } } else { // Only OOS/in service switch is enabled. secondaryDataPhone = PhoneFactory.getPhone(phoneId); } } if (secondaryDataPhone != null) { if (secondaryDataPhone != null) { DataEvaluation evaluation = getInternetEvaluation(secondaryDataPhone); DataEvaluation evaluation = getInternetEvaluation(secondaryDataPhone); Loading Loading @@ -988,13 +916,6 @@ public class AutoDataSwitchController extends Handler { && sFeatureFlags.autoDataSwitchEnhanced(); && sFeatureFlags.autoDataSwitchEnhanced(); } } /** * @return {@code true} If the feature of switching to roaming non DDS is enabled. */ private boolean isNddsRoamingEnabled() { return mAllowNddsRoaming; } /** /** * Called when the current environment suits auto data switch. * Called when the current environment suits auto data switch. * Start pre-switch validation if the current environment suits auto data switch for * Start pre-switch validation if the current environment suits auto data switch for Loading
src/java/com/android/internal/telephony/data/DataConfigManager.java +0 −9 Original line number Original line Diff line number Diff line Loading @@ -1124,15 +1124,6 @@ public class DataConfigManager extends Handler { .auto_data_switch_score_tolerance); .auto_data_switch_score_tolerance); } } /** * TODO: remove after V. * @return To indicate whether allow using roaming nDDS if user enabled its roaming when the DDS * is not usable(OOS or disabled roaming) */ public boolean doesAutoDataSwitchAllowRoaming() { return mResources.getBoolean(com.android.internal.R.bool.auto_data_switch_allow_roaming); } /** /** * @return The maximum number of retries when a validation for switching failed. * @return The maximum number of retries when a validation for switching failed. */ */ Loading
tests/telephonytests/src/com/android/internal/telephony/data/AutoDataSwitchControllerTest.java +0 −1 Original line number Original line Diff line number Diff line Loading @@ -164,7 +164,6 @@ public class AutoDataSwitchControllerTest extends TelephonyTest { // Change data config // Change data config doReturn(true).when(mDataConfigManager).isPingTestBeforeAutoDataSwitchRequired(); doReturn(true).when(mDataConfigManager).isPingTestBeforeAutoDataSwitchRequired(); doReturn(true).when(mDataConfigManager).doesAutoDataSwitchAllowRoaming(); doReturn(10000L).when(mDataConfigManager) doReturn(10000L).when(mDataConfigManager) .getAutoDataSwitchAvailabilityStabilityTimeThreshold(); .getAutoDataSwitchAvailabilityStabilityTimeThreshold(); doReturn(120000L).when(mDataConfigManager) doReturn(120000L).when(mDataConfigManager) Loading