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

Commit 527ac5f0 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update outdated test" into main

parents ead0713c 9de9b626
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -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);
@@ -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;
    }

+7 −5
Original line number Diff line number Diff line
@@ -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();
@@ -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();