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

Commit 441f8d74 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

QualcommSharedRIL: Check call status before validating data call state

Ported over from CAF's change Iea75053cb8226ec15d2a2c11a73332e5ebe8c793,
since applying it to the main RIL class breaks non-qcoms

Change-Id: I1ac57537cffd52ce269250ea948f8b728a1c5636
parent f305d1a2
Loading
Loading
Loading
Loading
+46 −21
Original line number Diff line number Diff line
@@ -213,9 +213,33 @@ public class QualcommSharedRIL extends RIL implements CommandsInterface {

        boolean oldRil = needsOldRilFeature("datacall");

        if (!oldRil)
        if (!oldRil && version < 5) {
            return super.getDataCallState(p, version);

        } else if (!oldRil) {
            dataCall.version = version;
            dataCall.status = p.readInt();
            dataCall.suggestedRetryTime = p.readInt();
            dataCall.cid = p.readInt();
            dataCall.active = p.readInt();
            dataCall.type = p.readString();
            dataCall.ifname = p.readString();
            if ((dataCall.status == DataConnection.FailCause.NONE.getErrorCode()) &&
                    TextUtils.isEmpty(dataCall.ifname) && dataCall.active != 0) {
              throw new RuntimeException("getDataCallState, no ifname");
            }
            String addresses = p.readString();
            if (!TextUtils.isEmpty(addresses)) {
                dataCall.addresses = addresses.split(" ");
            }
            String dnses = p.readString();
            if (!TextUtils.isEmpty(dnses)) {
                dataCall.dnses = dnses.split(" ");
            }
            String gateways = p.readString();
            if (!TextUtils.isEmpty(gateways)) {
                dataCall.gateways = gateways.split(" ");
            }
        } else {
            dataCall.version = 4; // was dataCall.version = version;
            dataCall.cid = p.readInt();
            dataCall.active = p.readInt();
@@ -237,6 +261,7 @@ public class QualcommSharedRIL extends RIL implements CommandsInterface {
            dataCall.dnses = new String[2];
            dataCall.dnses[0] = SystemProperties.get("net."+dataCall.ifname+".dns1");
            dataCall.dnses[1] = SystemProperties.get("net."+dataCall.ifname+".dns2");
        }

        return dataCall;
    }