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

Commit 44a5c989 authored by Hui Wang's avatar Hui Wang Committed by Jack Yu
Browse files

Set data profile as 3GPP2 only if it is exclusive for cdma

When creating DataProfile, the type may be set as 3GPP2 even it is
for both 3GPP and 3GPP2 due to the limit of bearerBitmapHasCdma.
- Do not use ServiceState.bearerBitmapHasCdma
- update the logic to check if the network type is exclusive for cdma

Bug: 141533872
Test: Manual
Merged-In: I4ea9bf00949b7b613492661fb5426f7e730d71e2
Change-Id: I4ea9bf00949b7b613492661fb5426f7e730d71e2
(cherry picked from commit 2eb39202)
parent 3994f51d
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -5289,10 +5289,14 @@ public class DcTracker extends Handler {

        if (networkTypeBitmask == 0) {
            profileType = DataProfile.TYPE_COMMON;
        } else if (ServiceState.bearerBitmapHasCdma(networkTypeBitmask)) {
        } else if ((networkTypeBitmask & TelephonyManager.NETWORK_STANDARDS_FAMILY_BITMASK_3GPP2)
                == networkTypeBitmask) {
            profileType = DataProfile.TYPE_3GPP2;
        } else {
        } else if ((networkTypeBitmask & TelephonyManager.NETWORK_STANDARDS_FAMILY_BITMASK_3GPP)
                == networkTypeBitmask) {
            profileType = DataProfile.TYPE_3GPP;
        } else {
            profileType = DataProfile.TYPE_COMMON;
        }

        return new DataProfile.Builder()
+30 −1
Original line number Diff line number Diff line
@@ -107,6 +107,33 @@ public class DataProfileTest extends TestCase {
            -1,                     // mvno_type
            "");                    // mnvo_match_data

    private ApnSetting mApn4 = ApnSetting.makeApnSetting(
            2163,                   // id
            "44010",                // numeric
            "sp-mode",              // name
            "fake_apn",             // apn
            null,                   // proxy
            -1,                     // port
            null,                   // mmsc
            null,                   // mmsproxy
            -1,                     // mmsport
            "user",                 // user
            "passwd",               // password
            -1,                     // authtype
            ApnSetting.TYPE_DEFAULT | ApnSetting.TYPE_SUPL,   // types
            ApnSetting.PROTOCOL_IP,                 // protocol
            ApnSetting.PROTOCOL_IP,                 // roaming_protocol
            true,                   // carrier_enabled
            10360,                  // networktype_bitmask
            1234,                   // profile_id
            false,                  // modem_cognitive
            111,                    // max_conns
            456,                    // wait_time
            789,                    // max_conns_time
            0,                      // mtu
            -1,                     // mvno_type
            "");                    // mnvo_match_data

    @SmallTest
    public void testCreateFromApnSetting() throws Exception {
        DataProfile dp = DcTracker.createDataProfile(mApn1, mApn1.getProfileId(), false);
@@ -132,11 +159,13 @@ public class DataProfileTest extends TestCase {
        assertEquals(RILConstants.SETUP_DATA_AUTH_PAP_CHAP, dp.getAuthType());
        assertEquals(mApn3.getUser(), dp.getUserName());
        assertEquals(mApn3.getPassword(), dp.getPassword());
        assertEquals(2, dp.getType());  // TYPE_3GPP2
        assertEquals(0, dp.getType());  // TYPE_COMMON
        assertEquals(mApn3.getWaitTime(), dp.getWaitTime());
        assertEquals(mApn3.isEnabled(), dp.isEnabled());
        int expectedBearerBitmap = mApn3.getNetworkTypeBitmask();
        assertEquals(expectedBearerBitmap, dp.getBearerBitmask());
        dp = DcTracker.createDataProfile(mApn4, mApn4.getProfileId(), false);
        assertEquals(2, dp.getType());  // TYPE_3GPP2
    }

    @SmallTest