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

Commit 4297e6ee authored by Jack Yu's avatar Jack Yu
Browse files

Fixed that emergency APN is a duplicate in APN list

Added check to prevent duplicate APN setting added into
the all APN list.

Test: Unit tests
Bug: 122741227
Change-Id: I28197e49868c2649416b5e9cc81b2144d41342d9
parent 74fda6ea
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -3941,7 +3941,10 @@ public class DcTracker extends Handler {

            // If all of the APN settings cannot handle emergency, we add the emergency APN to the
            // list explicitly.
            if (!mAllApnSettings.contains(mEmergencyApn)) {
                mAllApnSettings.add(mEmergencyApn);
                log("Adding emergency APN : " + mEmergencyApn);
            }
        }
    }

+2 −9
Original line number Diff line number Diff line
@@ -97,7 +97,6 @@ import org.mockito.stubbing.Answer;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class DcTrackerTest extends TelephonyTest {

@@ -108,8 +107,6 @@ public class DcTrackerTest extends TelephonyTest {
            "mobile_ims,11,0,2,60000,true", "mobile_cbs,12,0,2,60000,true",
            "mobile_ia,14,0,2,-1,true", "mobile_emergency,15,0,2,-1,true"};

    private final static List<String> sApnTypes = Arrays.asList(
            "default", "mms", "cbs", "fota", "supl", "ia", "emergency", "dun", "hipri", "ims");
    private static final int LTE_BEARER_BITMASK = 1 << (ServiceState.RIL_RADIO_TECHNOLOGY_LTE - 1);
    private static final int EHRPD_BEARER_BITMASK =
            1 << (ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD - 1);
@@ -137,14 +134,10 @@ public class DcTrackerTest extends TelephonyTest {
    @Mock
    IBinder mBinder;
    @Mock
    NetworkRequest mNetworkRequest;
    @Mock
    SubscriptionInfo mSubscriptionInfo;
    @Mock
    ApnContext mApnContext;
    @Mock
    ApnSetting mApnSetting;
    @Mock
    DataConnection mDataConnection;
    @Mock
    PackageManagerService mMockPackageManagerInternal;
@@ -367,7 +360,7 @@ public class DcTrackerTest extends TelephonyTest {
                    });

                    mc.addRow(new Object[]{
                            2166,                   // id
                            2167,                   // id
                            FAKE_PLMN,              // numeric
                            "b-mobile for Nexus",   // name
                            FAKE_APN5,              // apn
@@ -622,7 +615,7 @@ public class DcTrackerTest extends TelephonyTest {
        result.status = 0x10004;

        // Simulate RIL fails the data call setup
        mSimulatedCommands.setDataCallResult(false, result);
        mSimulatedCommands.setDataCallResult(true, result);

        DataConnectionReasons dataConnectionReasons = new DataConnectionReasons();
        boolean allowed = isDataAllowed(dataConnectionReasons);