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

Commit 4495e7c4 authored by Jack Yu's avatar Jack Yu Committed by Gerrit Code Review
Browse files

Merge "Data profile refactoring"

parents cc7a441d dd72c425
Loading
Loading
Loading
Loading
+20 −11
Original line number Original line Diff line number Diff line
@@ -1308,8 +1308,8 @@ public class RIL extends BaseCommands implements CommandsInterface {


        dpi.profileId = dp.getProfileId();
        dpi.profileId = dp.getProfileId();
        dpi.apn = dp.getApn();
        dpi.apn = dp.getApn();
        dpi.protocol = dp.getProtocol();
        dpi.protocol = ApnSetting.getProtocolStringFromInt(dp.getProtocol());
        dpi.roamingProtocol = dp.getRoamingProtocol();
        dpi.roamingProtocol = ApnSetting.getProtocolStringFromInt(dp.getRoamingProtocol());
        dpi.authType = dp.getAuthType();
        dpi.authType = dp.getAuthType();
        dpi.user = dp.getUserName();
        dpi.user = dp.getUserName();
        dpi.password = dp.getPassword();
        dpi.password = dp.getPassword();
@@ -1319,7 +1319,11 @@ public class RIL extends BaseCommands implements CommandsInterface {
        dpi.waitTime = dp.getWaitTime();
        dpi.waitTime = dp.getWaitTime();
        dpi.enabled = dp.isEnabled();
        dpi.enabled = dp.isEnabled();
        dpi.supportedApnTypesBitmap = dp.getSupportedApnTypesBitmap();
        dpi.supportedApnTypesBitmap = dp.getSupportedApnTypesBitmap();
        dpi.bearerBitmap = dp.getBearerBitmap();
        // Shift by 1 bit due to the discrepancy between
        // android.hardware.radio.V1_0.RadioAccessFamily and the bitmask version of
        // ServiceState.RIL_RADIO_TECHNOLOGY_XXXX.
        dpi.bearerBitmap = ServiceState.convertNetworkTypeBitmaskToBearerBitmask(
                dp.getBearerBitmap()) << 1;
        dpi.mtu = dp.getMtu();
        dpi.mtu = dp.getMtu();
        dpi.mvnoType = MvnoType.NONE;
        dpi.mvnoType = MvnoType.NONE;
        dpi.mvnoMatchData = "";
        dpi.mvnoMatchData = "";
@@ -1338,8 +1342,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
                new android.hardware.radio.V1_4.DataProfileInfo();
                new android.hardware.radio.V1_4.DataProfileInfo();


        dpi.apn = dp.getApn();
        dpi.apn = dp.getApn();
        dpi.protocol = ApnSetting.getProtocolIntFromString(dp.getProtocol());
        dpi.protocol = dp.getProtocol();
        dpi.roamingProtocol = ApnSetting.getProtocolIntFromString(dp.getRoamingProtocol());
        dpi.roamingProtocol = dp.getRoamingProtocol();
        dpi.authType = dp.getAuthType();
        dpi.authType = dp.getAuthType();
        dpi.user = dp.getUserName();
        dpi.user = dp.getUserName();
        dpi.password = dp.getPassword();
        dpi.password = dp.getPassword();
@@ -1349,7 +1353,11 @@ public class RIL extends BaseCommands implements CommandsInterface {
        dpi.waitTime = dp.getWaitTime();
        dpi.waitTime = dp.getWaitTime();
        dpi.enabled = dp.isEnabled();
        dpi.enabled = dp.isEnabled();
        dpi.supportedApnTypesBitmap = dp.getSupportedApnTypesBitmap();
        dpi.supportedApnTypesBitmap = dp.getSupportedApnTypesBitmap();
        dpi.bearerBitmap = dp.getBearerBitmap();
        // Shift by 1 bit due to the discrepancy between
        // android.hardware.radio.V1_0.RadioAccessFamily and the bitmask version of
        // ServiceState.RIL_RADIO_TECHNOLOGY_XXXX.
        dpi.bearerBitmap = ServiceState.convertNetworkTypeBitmaskToBearerBitmask(
                dp.getBearerBitmap()) << 1;
        dpi.mtu = dp.getMtu();
        dpi.mtu = dp.getMtu();
        dpi.persistent = dp.isPersistent();
        dpi.persistent = dp.isPersistent();
        dpi.preferred = dp.isPreferred();
        dpi.preferred = dp.isPreferred();
@@ -5645,7 +5653,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
        if (dcResult == null) return null;
        if (dcResult == null) return null;


        int status, suggestedRetryTime, cid, active, mtu;
        int status, suggestedRetryTime, cid, active, mtu;
        String type, ifname;
        String ifname;
        int protocolType;
        String[] addresses = null;
        String[] addresses = null;
        String[] dnses = null;
        String[] dnses = null;
        String[] gateways = null;
        String[] gateways = null;
@@ -5657,7 +5666,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
            suggestedRetryTime = result.suggestedRetryTime;
            suggestedRetryTime = result.suggestedRetryTime;
            cid = result.cid;
            cid = result.cid;
            active = result.active;
            active = result.active;
            type = result.type;
            protocolType = ApnSetting.getProtocolIntFromString(result.type);
            ifname = result.ifname;
            ifname = result.ifname;
            if (!TextUtils.isEmpty(result.addresses)) {
            if (!TextUtils.isEmpty(result.addresses)) {
                addresses = result.addresses.split("\\s+");
                addresses = result.addresses.split("\\s+");
@@ -5677,7 +5686,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
            suggestedRetryTime = result.suggestedRetryTime;
            suggestedRetryTime = result.suggestedRetryTime;
            cid = result.cid;
            cid = result.cid;
            active = result.active;
            active = result.active;
            type = ApnSetting.getProtocolStringFromInt(result.type);
            protocolType = result.type;
            ifname = result.ifname;
            ifname = result.ifname;
            addresses = result.addresses.stream().toArray(String[]::new);
            addresses = result.addresses.stream().toArray(String[]::new);
            dnses = result.dnses.stream().toArray(String[]::new);
            dnses = result.dnses.stream().toArray(String[]::new);
@@ -5744,8 +5753,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
            }
            }
        }
        }


        return new DataCallResponse(status, suggestedRetryTime, cid, active, type, ifname, laList,
        return new DataCallResponse(status, suggestedRetryTime, cid, active, protocolType, ifname,
                dnsList, gatewayList, pcscfs, mtu);
                laList, dnsList, gatewayList, pcscfs, mtu);
    }
    }


    /**
    /**
+1 −1
Original line number Original line Diff line number Diff line
@@ -543,7 +543,7 @@ public class DataConnection extends StateMachine {
        if (mDcTesterFailBringUpAll.getDcFailBringUp().mCounter  > 0) {
        if (mDcTesterFailBringUpAll.getDcFailBringUp().mCounter  > 0) {
            DataCallResponse response = new DataCallResponse(
            DataCallResponse response = new DataCallResponse(
                    mDcTesterFailBringUpAll.getDcFailBringUp().mFailCause,
                    mDcTesterFailBringUpAll.getDcFailBringUp().mFailCause,
                    mDcTesterFailBringUpAll.getDcFailBringUp().mSuggestedRetryTime, 0, 0, "", "",
                    mDcTesterFailBringUpAll.getDcFailBringUp().mSuggestedRetryTime, 0, 0, 0, "",
                    null, null, null, null, PhoneConstants.UNSET_MTU);
                    null, null, null, null, PhoneConstants.UNSET_MTU);


            Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp);
            Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp);
+7 −9
Original line number Original line Diff line number Diff line
@@ -3268,7 +3268,7 @@ public class DcTracker extends Handler {
                    if (DBG) {
                    if (DBG) {
                        log("buildWaitingApns: networkTypeBitmask:"
                        log("buildWaitingApns: networkTypeBitmask:"
                                + apn.getNetworkTypeBitmask()
                                + apn.getNetworkTypeBitmask()
                                + "do not include radioTech:" + radioTech);
                                + " does not include radioTech:" + radioTech);
                    }
                    }
                }
                }
            } else if (DBG) {
            } else if (DBG) {
@@ -4675,23 +4675,21 @@ public class DcTracker extends Handler {
                                                boolean isPreferred) {
                                                boolean isPreferred) {
        int profileType;
        int profileType;


        int bearerBitmap = ServiceState.convertNetworkTypeBitmaskToBearerBitmask(
        int networkTypeBitmask = apn.getNetworkTypeBitmask();
                apn.getNetworkTypeBitmask());


        if (bearerBitmap == 0) {
        if (networkTypeBitmask == 0) {
            profileType = DataProfile.TYPE_COMMON;
            profileType = DataProfile.TYPE_COMMON;
        } else if (ServiceState.bearerBitmapHasCdma(bearerBitmap)) {
        } else if (ServiceState.bearerBitmapHasCdma(networkTypeBitmask)) {
            profileType = DataProfile.TYPE_3GPP2;
            profileType = DataProfile.TYPE_3GPP2;
        } else {
        } else {
            profileType = DataProfile.TYPE_3GPP;
            profileType = DataProfile.TYPE_3GPP;
        }
        }


        return new DataProfile(profileId, apn.getApnName(),
        return new DataProfile(profileId, apn.getApnName(), apn.getProtocol(), apn.getAuthType(),
                ApnSetting.getProtocolStringFromInt(apn.getProtocol()), apn.getAuthType(),
                apn.getUser(), apn.getPassword(), profileType, apn.getMaxConnsTime(),
                apn.getUser(), apn.getPassword(), profileType, apn.getMaxConnsTime(),
                apn.getMaxConns(),  apn.getWaitTime(), apn.isEnabled(), apn.getApnTypeBitmask(),
                apn.getMaxConns(),  apn.getWaitTime(), apn.isEnabled(), apn.getApnTypeBitmask(),
                ApnSetting.getProtocolStringFromInt(apn.getRoamingProtocol()), bearerBitmap,
                apn.getRoamingProtocol(), networkTypeBitmask, apn.getMtu(), apn.isPersistent(),
                apn.getMtu(), apn.isPersistent(), isPreferred);
                isPreferred);
    }
    }


    private void onDataServiceBindingChanged(boolean bound) {
    private void onDataServiceBindingChanged(boolean bound) {
+6 −10
Original line number Original line Diff line number Diff line
@@ -1124,7 +1124,7 @@ public class TelephonyMetrics {
     * @param protocol Data connection protocol
     * @param protocol Data connection protocol
     */
     */
    public void writeSetupDataCall(int phoneId, int radioTechnology, int profileId, String apn,
    public void writeSetupDataCall(int phoneId, int radioTechnology, int profileId, String apn,
                                   String protocol) {
                                   int protocol) {


        RilSetupDataCall setupDataCall = new RilSetupDataCall();
        RilSetupDataCall setupDataCall = new RilSetupDataCall();
        setupDataCall.rat = radioTechnology;
        setupDataCall.rat = radioTechnology;
@@ -1132,9 +1132,8 @@ public class TelephonyMetrics {
        if (apn != null) {
        if (apn != null) {
            setupDataCall.apn = apn;
            setupDataCall.apn = apn;
        }
        }
        if (protocol != null) {

            setupDataCall.type = toPdpType(protocol);
        setupDataCall.type = protocol + 1;
        }


        addTelephonyEvent(new TelephonyEventBuilder(phoneId).setSetupDataCall(
        addTelephonyEvent(new TelephonyEventBuilder(phoneId).setSetupDataCall(
                setupDataCall).build());
                setupDataCall).build());
@@ -1186,9 +1185,8 @@ public class TelephonyMetrics {
            if (!TextUtils.isEmpty(dcsList.get(i).getIfname())) {
            if (!TextUtils.isEmpty(dcsList.get(i).getIfname())) {
                dataCalls[i].iframe = dcsList.get(i).getIfname();
                dataCalls[i].iframe = dcsList.get(i).getIfname();
            }
            }
            if (!TextUtils.isEmpty(dcsList.get(i).getType())) {

                dataCalls[i].type = toPdpType(dcsList.get(i).getType());
            dataCalls[i].type = dcsList.get(i).getProtocolType() + 1;
            }
        }
        }


        addTelephonyEvent(new TelephonyEventBuilder(phoneId).setDataCalls(dataCalls).build());
        addTelephonyEvent(new TelephonyEventBuilder(phoneId).setDataCalls(dataCalls).build());
@@ -1435,9 +1433,7 @@ public class TelephonyMetrics {
            setupDataCallResponse.suggestedRetryTimeMillis = response.getSuggestedRetryTime();
            setupDataCallResponse.suggestedRetryTimeMillis = response.getSuggestedRetryTime();


            dataCall.cid = response.getCallId();
            dataCall.cid = response.getCallId();
            if (!TextUtils.isEmpty(response.getType())) {
            dataCall.type = response.getProtocolType() + 1;
                dataCall.type = toPdpType(response.getType());
            }


            if (!TextUtils.isEmpty(response.getIfname())) {
            if (!TextUtils.isEmpty(response.getIfname())) {
                dataCall.iframe = response.getIfname();
                dataCall.iframe = response.getIfname();
+5 −7
Original line number Original line Diff line number Diff line
@@ -223,7 +223,7 @@ public class RILTest extends TelephonyTest {


    private static final int PROFILE_ID = 0;
    private static final int PROFILE_ID = 0;
    private static final String APN = "apn";
    private static final String APN = "apn";
    private static final String PROTOCOL = "IPV6";
    private static final int PROTOCOL = ApnSetting.PROTOCOL_IPV6;
    private static final int AUTH_TYPE = 0;
    private static final int AUTH_TYPE = 0;
    private static final String USER_NAME = "username";
    private static final String USER_NAME = "username";
    private static final String PASSWORD = "password";
    private static final String PASSWORD = "password";
@@ -233,11 +233,9 @@ public class RILTest extends TelephonyTest {
    private static final int WAIT_TIME = 10;
    private static final int WAIT_TIME = 10;
    private static final boolean APN_ENABLED = true;
    private static final boolean APN_ENABLED = true;
    private static final int SUPPORTED_APNT_YPES_BITMAP = 123456;
    private static final int SUPPORTED_APNT_YPES_BITMAP = 123456;
    private static final String ROAMING_PROTOCOL = "IPV6";
    private static final int ROAMING_PROTOCOL = ApnSetting.PROTOCOL_IPV6;
    private static final int BEARER_BITMAP = 123123;
    private static final int BEARER_BITMAP = 123123;
    private static final int MTU = 1234;
    private static final int MTU = 1234;
    private static final String MVNO_TYPE = "";
    private static final String MVNO_MATCH_DATA = "";
    private static final boolean PERSISTENT = true;
    private static final boolean PERSISTENT = true;


    private class RILTestHandler extends HandlerThread {
    private class RILTestHandler extends HandlerThread {
@@ -1547,7 +1545,7 @@ public class RILTest extends TelephonyTest {
        result10.pcscf = "fd00:976a:c206:20::6   fd00:976a:c206:20::9    fd00:976a:c202:1d::9";
        result10.pcscf = "fd00:976a:c206:20::6   fd00:976a:c206:20::9    fd00:976a:c202:1d::9";
        result10.mtu = 1500;
        result10.mtu = 1500;


        DataCallResponse response = new DataCallResponse(0, -1, 0, 2, "IPV4V6",
        DataCallResponse response = new DataCallResponse(0, -1, 0, 2, ApnSetting.PROTOCOL_IPV4V6,
                "ifname",
                "ifname",
                Arrays.asList(new LinkAddress(NetworkUtils.numericToInetAddress("10.0.2.15"), 32),
                Arrays.asList(new LinkAddress(NetworkUtils.numericToInetAddress("10.0.2.15"), 32),
                        new LinkAddress("2607:fb90:a620:651d:eabe:f8da:c107:44be/64")),
                        new LinkAddress("2607:fb90:a620:651d:eabe:f8da:c107:44be/64")),
@@ -1742,7 +1740,7 @@ public class RILTest extends TelephonyTest {
        DataProfileInfo dpi = dpiCaptor.getValue();
        DataProfileInfo dpi = dpiCaptor.getValue();
        assertEquals(PROFILE_ID, dpi.profileId);
        assertEquals(PROFILE_ID, dpi.profileId);
        assertEquals(APN, dpi.apn);
        assertEquals(APN, dpi.apn);
        assertEquals(PROTOCOL, dpi.protocol);
        assertEquals(PROTOCOL, ApnSetting.getProtocolIntFromString(dpi.protocol));
        assertEquals(AUTH_TYPE, dpi.authType);
        assertEquals(AUTH_TYPE, dpi.authType);
        assertEquals(USER_NAME, dpi.user);
        assertEquals(USER_NAME, dpi.user);
        assertEquals(PASSWORD, dpi.password);
        assertEquals(PASSWORD, dpi.password);
@@ -1752,7 +1750,7 @@ public class RILTest extends TelephonyTest {
        assertEquals(WAIT_TIME, dpi.waitTime);
        assertEquals(WAIT_TIME, dpi.waitTime);
        assertEquals(APN_ENABLED, dpi.enabled);
        assertEquals(APN_ENABLED, dpi.enabled);
        assertEquals(SUPPORTED_APNT_YPES_BITMAP, dpi.supportedApnTypesBitmap);
        assertEquals(SUPPORTED_APNT_YPES_BITMAP, dpi.supportedApnTypesBitmap);
        assertEquals(ROAMING_PROTOCOL, dpi.protocol);
        assertEquals(ROAMING_PROTOCOL, ApnSetting.getProtocolIntFromString(dpi.protocol));
        assertEquals(BEARER_BITMAP, dpi.bearerBitmap);
        assertEquals(BEARER_BITMAP, dpi.bearerBitmap);
        assertEquals(MTU, dpi.mtu);
        assertEquals(MTU, dpi.mtu);
    }
    }
Loading