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

Commit 68517f7f authored by Ethan Chen's avatar Ethan Chen Committed by Ricardo Cerqueira
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: Ia540e9b48e2f0ff7deb4d798aaac2c45ef38dbb3
parent 3ce23e17
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@ import android.telephony.Rlog;

import com.android.internal.telephony.uicc.IccCardApplicationStatus;
import com.android.internal.telephony.uicc.IccCardStatus;
import com.android.internal.telephony.dataconnection.DcFailCause;
import com.android.internal.telephony.dataconnection.DataCallResponse;

import java.util.ArrayList;

@@ -48,6 +50,38 @@ public class HTCQualcommRIL extends RIL implements CommandsInterface {
        super(context, networkMode, cdmaSubscription);
    }

    @Override
    protected DataCallResponse getDataCallResponse(Parcel p, int version) {
        DataCallResponse dataCall = new DataCallResponse();

        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 == DcFailCause.NONE.getErrorCode()) &&
                TextUtils.isEmpty(dataCall.ifname) && dataCall.active != 0) {
            throw new RuntimeException("getDataCallResponse, 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) {