Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 94d91b0b authored by Ling Ma's avatar Ling Ma
Browse files

Remove roaming flag

Test: basic voice call + data browsing
Flag: EXEMPT cleanup
Change-Id: I828d1ea5a9c66888602d1bc812c58bde9df028a5
parent 77c23265
Loading
Loading
Loading
Loading
+71 −150
Original line number Diff line number Diff line
@@ -230,12 +230,6 @@ public class AutoDataSwitchController extends Handler {
     * even if ping test fails.
     */
    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 **/
    private int mAutoSwitchValidationFailedCount = 0;
    /**
@@ -494,7 +488,6 @@ public class AutoDataSwitchController extends Handler {
        DataConfigManager dataConfig = phone.getDataNetworkController().getDataConfigManager();
        mScoreTolerance = dataConfig.getAutoDataSwitchScoreTolerance();
        mRequirePingTestBeforeSwitch = dataConfig.isPingTestBeforeAutoDataSwitchRequired();
        mAllowNddsRoaming = dataConfig.doesAutoDataSwitchAllowRoaming();
        STABILITY_CHECK_TIMER_MAP.put(STABILITY_CHECK_AVAILABILITY_SWITCH,
                dataConfig.getAutoDataSwitchAvailabilityStabilityTimeThreshold());
        STABILITY_CHECK_TIMER_MAP.put(STABILITY_CHECK_PERFORMANCE_SWITCH,
@@ -742,7 +735,6 @@ public class AutoDataSwitchController extends Handler {
            int switchType = STABILITY_CHECK_AVAILABILITY_SWITCH;
            boolean needValidation = true;

            if (isNddsRoamingEnabled()) {
            if (mDefaultNetworkIsOnNonCellular) {
                debugMessage.append(", back to default as default network")
                        .append(" is active on nonCellular transport");
@@ -800,34 +792,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) {
                log(debugMessage.toString());
@@ -869,21 +833,12 @@ public class AutoDataSwitchController extends Handler {
            return invalidResult;
        }

        if (isNddsRoamingEnabled()) {
        // check whether primary and secondary signal status are worth switching
        if (!isRatSignalStrengthBasedSwitchEnabled()
                && isHomeService(mPhonesSignalStatus[defaultPhoneId].mDataRegState)) {
            debugMessage.append(", no candidate as default phone is in HOME service");
            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];
        for (int phoneId = 0; phoneId < mPhonesSignalStatus.length; phoneId++) {
@@ -891,7 +846,6 @@ public class AutoDataSwitchController extends Handler {

            Phone secondaryDataPhone = null;
            PhoneSignalStatus candidatePhoneStatus = mPhonesSignalStatus[phoneId];
            if (isNddsRoamingEnabled()) {
            PhoneSignalStatus.UsableState currentUsableState =
                    mPhonesSignalStatus[defaultPhoneId].getUsableState();
            PhoneSignalStatus.UsableState candidateUsableState =
@@ -918,32 +872,6 @@ public class AutoDataSwitchController extends Handler {
                            .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) {
                DataEvaluation evaluation = getInternetEvaluation(secondaryDataPhone);
@@ -990,13 +918,6 @@ public class AutoDataSwitchController extends Handler {
                && 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.
     * Start pre-switch validation if the current environment suits auto data switch for
+0 −9
Original line number Diff line number Diff line
@@ -1124,15 +1124,6 @@ public class DataConfigManager extends Handler {
                .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.
     */
+0 −1
Original line number Diff line number Diff line
@@ -164,7 +164,6 @@ public class AutoDataSwitchControllerTest extends TelephonyTest {

        // Change data config
        doReturn(true).when(mDataConfigManager).isPingTestBeforeAutoDataSwitchRequired();
        doReturn(true).when(mDataConfigManager).doesAutoDataSwitchAllowRoaming();
        doReturn(10000L).when(mDataConfigManager)
                .getAutoDataSwitchAvailabilityStabilityTimeThreshold();
        doReturn(120000L).when(mDataConfigManager)