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

Commit 761c3e67 authored by Wink Saville's avatar Wink Saville Committed by Android (Google) Code Review
Browse files

Merge "ApnSettings: Removal of Enabled, Class and Inactivity Timer."

parents d54952b4 8c6dc017
Loading
Loading
Loading
Loading
+3 −23
Original line number Diff line number Diff line
@@ -38,17 +38,12 @@ public class ApnSetting {
    public String numeric;
    public String protocol;
    public String roamingProtocol;
    public boolean enabled;

    int timer;
    int apnclass;

    public ApnSetting(int id, String numeric, String carrier, String apn,
            String proxy, String port,
            String mmsc, String mmsProxy, String mmsPort,
            String user, String password, int authType, String[] types,
            String protocol, String roamingProtocol,
            boolean enabled, int timer, int apnclass) {
            String protocol, String roamingProtocol) {
        this.id = id;
        this.numeric = numeric;
        this.carrier = carrier;
@@ -64,9 +59,6 @@ public class ApnSetting {
        this.types = types;
        this.protocol = protocol;
        this.roamingProtocol = roamingProtocol;
        this.enabled = enabled;
        this.timer = timer;
        this.apnclass = apnclass;
    }

    /**
@@ -85,7 +77,7 @@ public class ApnSetting {
     * v2 format:
     *   [ApnSettingV2] <carrier>, <apn>, <proxy>, <port>, <mmsc>, <mmsproxy>,
     *   <mmsport>, <user>, <password, <authtype>, <mcc>, <mnc>,
     *   <type>[| <type>...], <protocol>, <roaming_protocol>, <enabled>, <timer>, <apnclass>
     *   <type>[| <type>...], <protocol>, <roaming_protocol>
     *
     * Note that the strings generated by toString() do not contain the username
     * and password and thus cannot be read by this method.
@@ -118,16 +110,11 @@ public class ApnSetting {

        String[] typeArray;
        String protocol, roamingProtocol;
        boolean enabled;
        int timer, apnclass;
        if (version == 1) {
            typeArray = new String[a.length - 13];
            System.arraycopy(a, 13, typeArray, 0, a.length - 13);
            protocol = RILConstants.SETUP_DATA_PROTOCOL_IP;
            roamingProtocol = RILConstants.SETUP_DATA_PROTOCOL_IP;
            enabled = true;
            timer = 0;
            apnclass = 0;
        } else {
            if (a.length < 16) {
                return null;
@@ -135,14 +122,10 @@ public class ApnSetting {
            typeArray = a[13].split("\\s*\\|\\s*");
            protocol = a[14];
            roamingProtocol = a[15];
            enabled = Integer.parseInt(a[16]) != 0;
            timer = Integer.parseInt(a[17]);
            apnclass = Integer.parseInt(a[18]);
        }

        return new ApnSetting(-1,a[10]+a[11],a[0],a[1],a[2],a[3],a[7],a[8],
                a[9],a[4],a[5],authType,typeArray,protocol,roamingProtocol,
                enabled,timer,apnclass);
                a[9],a[4],a[5],authType,typeArray,protocol,roamingProtocol);
    }

    public String toString() {
@@ -166,9 +149,6 @@ public class ApnSetting {
        }
        sb.append(", ").append(protocol);
        sb.append(", ").append(roamingProtocol);
        sb.append(", ").append(enabled);
        sb.append(", ").append(timer);
        sb.append(", ").append(apnclass);
        return sb.toString();
    }

+1 −1
Original line number Diff line number Diff line
@@ -311,7 +311,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
            apnId = mDefaultApnId;
        }
        mActiveApn = new ApnSetting(apnId, "", "", "", "", "", "", "", "", "",
                                    "", 0, types, "IP", "IP", true, 0, 0);
                                    "", 0, types, "IP", "IP");
        if (DBG) log("setupData: mActiveApn=" + mActiveApn);

        Message msg = obtainMessage();
+1 −14
Original line number Diff line number Diff line
@@ -799,8 +799,6 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
            do {
                String[] types = parseTypes(
                        cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.TYPE)));
                int enabled =
                    cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.ENABLED));
                ApnSetting apn = new ApnSetting(
                        cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers._ID)),
                        cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.NUMERIC)),
@@ -817,11 +815,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
                        types,
                        cursor.getString(cursor.getColumnIndexOrThrow(Telephony.Carriers.PROTOCOL)),
                        cursor.getString(cursor.getColumnIndexOrThrow(
                                Telephony.Carriers.ROAMING_PROTOCOL)),
                        (enabled == 0 ? false : true),
                        cursor.getInt(cursor.getColumnIndexOrThrow(
                                Telephony.Carriers.INACTIVE_TIMER)),
                        cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.CLASS)));
                                Telephony.Carriers.ROAMING_PROTOCOL)));
                result.add(apn);
            } while (cursor.moveToNext());
        }
@@ -868,13 +862,6 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
            return false;
        }

        if (((mPhone.getServiceState().getRadioTechnology() == ServiceState.RADIO_TECHNOLOGY_EHRPD)
            || (mPhone.getServiceState().getRadioTechnology() == ServiceState.RADIO_TECHNOLOGY_LTE))
            && (!apn.enabled)) {
            if (DBG) log("setupData: apn is desabled by carrier!");
            return false;
        }

        dc = findReadyDataConnection(apn);

        if (dc == null) {
+5 −5
Original line number Diff line number Diff line
@@ -58,21 +58,21 @@ public class ApnSettingTest extends TestCase {
        testString = "Vodafone IT,web.omnitel.it,,,,,,,,,222,10,,DUN";
        expected_apn =  new ApnSetting(
                -1, "22210", "Vodafone IT", "web.omnitel.it", "", "",
                "", "", "", "", "", 0, dunTypes, "IP", "IP", true, 0, 0);
                "", "", "", "", "", 0, dunTypes, "IP", "IP");
        assertApnSettingEqual(expected_apn, ApnSetting.fromString(testString));

        // A v2 string.
        testString = "[ApnSettingV2] Name,apn,,,,,,,,,123,45,,mms|*,IPV6,IP";
        expected_apn =  new ApnSetting(
                -1, "12345", "Name", "apn", "", "",
                "", "", "", "", "", 0, mmsTypes, "IPV6", "IP", true, 0, 0);
                "", "", "", "", "", 0, mmsTypes, "IPV6", "IP");
        assertApnSettingEqual(expected_apn, ApnSetting.fromString(testString));

        // A v2 string with spaces.
        testString = "[ApnSettingV2] Name,apn, ,,,,,,,,123,45,,mms|*,IPV4V6, IP";
        expected_apn =  new ApnSetting(
                -1, "12345", "Name", "apn", "", "",
                "", "", "", "", "", 0, mmsTypes, "IPV4V6", "IP", true, 0, 0);
                "", "", "", "", "", 0, mmsTypes, "IPV4V6", "IP");
        assertApnSettingEqual(expected_apn, ApnSetting.fromString(testString));

        // Return null if insufficient fields given.
@@ -87,7 +87,7 @@ public class ApnSettingTest extends TestCase {
        String[] incorrectTypes = {"mms|*", "IPV6"};
        expected_apn =  new ApnSetting(
                -1, "12345", "Name", "apn", "", "",
                "", "", "", "", "", 0, incorrectTypes, "IP", "IP", true, 0, 0);
                "", "", "", "", "", 0, incorrectTypes, "IP", "IP");
        assertApnSettingEqual(expected_apn, ApnSetting.fromString(testString));
    }

@@ -98,7 +98,7 @@ public class ApnSettingTest extends TestCase {
        ApnSetting apn =  new ApnSetting(
                99, "12345", "Name", "apn", "proxy", "port",
                "mmsc", "mmsproxy", "mmsport", "user", "password", 0,
                types, "IPV4V6", "IP", true, 0, 0);
                types, "IPV4V6", "IP");
        String expected = "[ApnSettingV2] Name, 99, 12345, apn, proxy, " +
                "mmsc, mmsproxy, mmsport, port, 0, default | *, " +
                "IPV4V6, IP";