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

Commit da0db0bd authored by Ethan Chen's avatar Ethan Chen
Browse files

HTCQualcommRIL: fix data drops when switching state

* HTC RIL always throws this exception after the initial data call
  setup, so only switch ifname if the call goes from active to inactive.
* Prevents data drop due to empty address/DNS/gateway when radio tech
  switches to/from LTE/3G/2G.

Change-Id: I29107f549029d467ed01c0eba46561d65ca4d5d7
parent f0e75f84
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
@@ -47,6 +47,39 @@ public class HTCQualcommRIL extends RIL implements CommandsInterface {
        super(context, networkMode, cdmaSubscription);
    }

    @Override
    protected DataCallState getDataCallState(Parcel p, int version) {
        DataCallState dataCall = new DataCallState();

        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();
        /* Check dataCall.active != 0 so address, dns, gateways are provided
         * when switching LTE<->3G<->2G */
        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(" ");
        }

        return dataCall;
    }

    @Override
    protected void
    processUnsolicited (Parcel p) {