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

Commit 5533ba5e authored by Jack Yu's avatar Jack Yu
Browse files

Call set initial attach apn when roaming status changes

This is needed for the old modem (RIL version <15) which only
accepts one protocol based on the roaming condition. In that
case we need to call set initial attach apn again so the
correct protocol can be passed down to the modem.

Test: Telephony sanity tests and unit tests
bug: 35210742
Change-Id: I5e88a61a1cc69d22ed319e598050509341833d7d
parent cc348d6c
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -2789,9 +2789,11 @@ public class DcTracker extends Handler {
    private void onRoamingOff() {
        if (DBG) log("onRoamingOff");

        // TODO: Remove this once all old vendor RILs are gone. We don't need to send the
        // data profile again as the modem should have both roaming and non-roaming protocol in
        // place. Modem should choose the right protocol based on roaming condition.
        // TODO: Remove this once all old vendor RILs are gone. We don't need to set initial apn
        // attach and send the data profile again as the modem should have both roaming and
        // non-roaming protocol in place. Modem should choose the right protocol based on the
        // roaming condition.
        setInitialAttachApn();
        setDataProfilesAsNeeded();

        if (!mDataEnabledSettings.isUserDataEnabled()) return;
@@ -2807,9 +2809,11 @@ public class DcTracker extends Handler {
    private void onRoamingOn() {
        if (DBG) log("onRoamingOn");

        // TODO: Remove this once all old vendor RILs are gone. We don't need to send the
        // data profile again as the modem should have both roaming and non-roaming protocol in
        // place. Modem should choose the right protocol based on roaming condition.
        // TODO: Remove this once all old vendor RILs are gone. We don't need to set initial apn
        // attach and send the data profile again as the modem should have both roaming and
        // non-roaming protocol in place. Modem should choose the right protocol based on the
        // roaming condition.
        setInitialAttachApn();
        setDataProfilesAsNeeded();

        if (!mDataEnabledSettings.isUserDataEnabled()) {
+4 −5
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Matchers.nullable;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.never;
@@ -704,6 +705,9 @@ public class DcTrackerTest extends TelephonyTest {
        mDct.setDataEnabled(true);

        waitForMs(200);
        verify(mSimulatedCommandsVerifier, times(1)).setInitialAttachApn(any(DataProfile.class),
                eq(true), nullable(Message.class));

        ArgumentCaptor<DataProfile> dpCaptor = ArgumentCaptor.forClass(DataProfile.class);
        verify(mSimulatedCommandsVerifier, times(1)).setupDataCall(
                eq(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS), dpCaptor.capture(),
@@ -713,11 +717,6 @@ public class DcTrackerTest extends TelephonyTest {
        assertEquals(DctConstants.State.CONNECTED, mDct.getOverallState());
        assertEquals(DctConstants.State.IDLE, mDct.getState(PhoneConstants.APN_TYPE_DEFAULT));
        assertEquals(DctConstants.State.CONNECTED, mDct.getState(PhoneConstants.APN_TYPE_IMS));

        // reset roaming settings / data enabled settings at end of this test
        mDct.setDataOnRoamingEnabled(roamingEnabled);
        mDct.setDataEnabled(dataEnabled);
        waitForMs(200);
    }

    // Test the default data switch scenario.