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

Commit fc8736c3 authored by Jack Yu's avatar Jack Yu Committed by android-build-merger
Browse files

Merge "Data profile refactoring"

am: 4495e7c4

Change-Id: I369b785430cffdacac8e2d11de59e18eedb09131
parents d2b27406 4495e7c4
Loading
Loading
Loading
Loading
+20 −11
Original line number Diff line number Diff line
@@ -1308,8 +1308,8 @@ public class RIL extends BaseCommands implements CommandsInterface {

        dpi.profileId = dp.getProfileId();
        dpi.apn = dp.getApn();
        dpi.protocol = dp.getProtocol();
        dpi.roamingProtocol = dp.getRoamingProtocol();
        dpi.protocol = ApnSetting.getProtocolStringFromInt(dp.getProtocol());
        dpi.roamingProtocol = ApnSetting.getProtocolStringFromInt(dp.getRoamingProtocol());
        dpi.authType = dp.getAuthType();
        dpi.user = dp.getUserName();
        dpi.password = dp.getPassword();
@@ -1319,7 +1319,11 @@ public class RIL extends BaseCommands implements CommandsInterface {
        dpi.waitTime = dp.getWaitTime();
        dpi.enabled = dp.isEnabled();
        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.mvnoType = MvnoType.NONE;
        dpi.mvnoMatchData = "";
@@ -1338,8 +1342,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
                new android.hardware.radio.V1_4.DataProfileInfo();

        dpi.apn = dp.getApn();
        dpi.protocol = ApnSetting.getProtocolIntFromString(dp.getProtocol());
        dpi.roamingProtocol = ApnSetting.getProtocolIntFromString(dp.getRoamingProtocol());
        dpi.protocol = dp.getProtocol();
        dpi.roamingProtocol = dp.getRoamingProtocol();
        dpi.authType = dp.getAuthType();
        dpi.user = dp.getUserName();
        dpi.password = dp.getPassword();
@@ -1349,7 +1353,11 @@ public class RIL extends BaseCommands implements CommandsInterface {
        dpi.waitTime = dp.getWaitTime();
        dpi.enabled = dp.isEnabled();
        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.persistent = dp.isPersistent();
        dpi.preferred = dp.isPreferred();
@@ -5645,7 +5653,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
        if (dcResult == null) return null;

        int status, suggestedRetryTime, cid, active, mtu;
        String type, ifname;
        String ifname;
        int protocolType;
        String[] addresses = null;
        String[] dnses = null;
        String[] gateways = null;
@@ -5657,7 +5666,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
            suggestedRetryTime = result.suggestedRetryTime;
            cid = result.cid;
            active = result.active;
            type = result.type;
            protocolType = ApnSetting.getProtocolIntFromString(result.type);
            ifname = result.ifname;
            if (!TextUtils.isEmpty(result.addresses)) {
                addresses = result.addresses.split("\\s+");
@@ -5677,7 +5686,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
            suggestedRetryTime = result.suggestedRetryTime;
            cid = result.cid;
            active = result.active;
            type = ApnSetting.getProtocolStringFromInt(result.type);
            protocolType = result.type;
            ifname = result.ifname;
            addresses = result.addresses.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,
                dnsList, gatewayList, pcscfs, mtu);
        return new DataCallResponse(status, suggestedRetryTime, cid, active, protocolType, ifname,
                laList, dnsList, gatewayList, pcscfs, mtu);
    }

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

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

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

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

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

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

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

        setupDataCall.type = protocol + 1;

        addTelephonyEvent(new TelephonyEventBuilder(phoneId).setSetupDataCall(
                setupDataCall).build());
@@ -1186,9 +1185,8 @@ public class TelephonyMetrics {
            if (!TextUtils.isEmpty(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());
@@ -1435,9 +1433,7 @@ public class TelephonyMetrics {
            setupDataCallResponse.suggestedRetryTimeMillis = response.getSuggestedRetryTime();

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

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

    private static final int PROFILE_ID = 0;
    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 String USER_NAME = "username";
    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 boolean APN_ENABLED = true;
    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 MTU = 1234;
    private static final String MVNO_TYPE = "";
    private static final String MVNO_MATCH_DATA = "";
    private static final boolean PERSISTENT = true;

    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.mtu = 1500;

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