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

Commit 0a093807 authored by Ling Ma's avatar Ling Ma
Browse files

Add res config for roaming

Convert the flag to a bug fix flag. Also add a res config to controll it.

Fix: 287132491
Test: voice + data
Change-Id: Ie64e834b24cf6008a181dca7c3eb1f06fce6c76c
parent f38bf26b
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
package: "com.android.internal.telephony.flags"

flag {
  name: "auto_switch_allow_roaming"
  name: "auto_data_switch_allow_roaming"
  namespace: "telephony"
  description: "Allow using roaming network as target if user allows it from settings."
  bug: "306488039"
  bug: "287132491"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
+17 −3
Original line number Diff line number Diff line
@@ -188,6 +188,12 @@ 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 mAllowNddsRoamning = true;
    /** The count of consecutive auto switch validation failure **/
    private int mAutoSwitchValidationFailedCount = 0;
    /**
@@ -444,6 +450,7 @@ public class AutoDataSwitchController extends Handler {
        DataConfigManager dataConfig = phone.getDataNetworkController().getDataConfigManager();
        mScoreTolerance =  dataConfig.getAutoDataSwitchScoreTolerance();
        mRequirePingTestBeforeSwitch = dataConfig.isPingTestBeforeAutoDataSwitchRequired();
        mAllowNddsRoamning = dataConfig.doesAutoDataSwitchAllowRoaming();
        mAutoDataSwitchAvailabilityStabilityTimeThreshold =
                dataConfig.getAutoDataSwitchAvailabilityStabilityTimeThreshold();
        mAutoDataSwitchPerformanceStabilityTimeThreshold =
@@ -694,7 +701,7 @@ public class AutoDataSwitchController extends Handler {
            boolean isForPerformance = false;
            boolean needValidation = true;

            if (sFeatureFlags.autoSwitchAllowRoaming()) {
            if (isNddsRoamingEnabled()) {
                if (mDefaultNetworkIsOnNonCellular) {
                    debugMessage.append(", back to default as default network")
                            .append(" is active on nonCellular transport");
@@ -820,7 +827,7 @@ public class AutoDataSwitchController extends Handler {
            return invalidResult;
        }

        if (sFeatureFlags.autoSwitchAllowRoaming()) {
        if (isNddsRoamingEnabled()) {
            // check whether primary and secondary signal status are worth switching
            if (!isRatSignalStrengthBasedSwitchEnabled()
                    && isHomeService(mPhonesSignalStatus[defaultPhoneId].mDataRegState)) {
@@ -842,7 +849,7 @@ public class AutoDataSwitchController extends Handler {

            Phone secondaryDataPhone = null;
            PhoneSignalStatus candidatePhoneStatus = mPhonesSignalStatus[phoneId];
            if (sFeatureFlags.autoSwitchAllowRoaming()) {
            if (isNddsRoamingEnabled()) {
                PhoneSignalStatus.UsableState currentUsableState =
                        mPhonesSignalStatus[defaultPhoneId].getUsableState();
                PhoneSignalStatus.UsableState candidateUsableState =
@@ -918,6 +925,13 @@ public class AutoDataSwitchController extends Handler {
                && mAutoDataSwitchPerformanceStabilityTimeThreshold >= 0;
    }

    /**
     * @return {@code true} If the feature of switching to roaming non DDS is enabled.
     */
    private boolean isNddsRoamingEnabled() {
        return sFeatureFlags.autoDataSwitchAllowRoaming() && mAllowNddsRoamning;
    }

    /**
     * Called when the current environment suits auto data switch.
     * Start pre-switch validation if the current environment suits auto data switch for
+9 −0
Original line number Diff line number Diff line
@@ -1050,6 +1050,15 @@ 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.
     */
+2 −1
Original line number Diff line number Diff line
@@ -156,6 +156,7 @@ 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)
@@ -184,7 +185,7 @@ public class AutoDataSwitchControllerTest extends TelephonyTest {
        mEventsToAlarmListener = getPrivateField(mAutoDataSwitchControllerUT,
                "mEventsToAlarmListener", Map.class);

        doReturn(true).when(mFeatureFlags).autoSwitchAllowRoaming();
        doReturn(true).when(mFeatureFlags).autoDataSwitchAllowRoaming();
        doReturn(true).when(mFeatureFlags).carrierEnabledSatelliteFlag();
    }