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

Commit 43cce614 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

LGEQualcommUiccRIL: Fix LTE support

Change-Id: Ifab51550113926d6d1b6c421e805f456d95faca8
parent f2d89cda
Loading
Loading
Loading
Loading
+72 −0
Original line number Original line Diff line number Diff line
@@ -34,6 +34,7 @@ import java.util.ArrayList;
 */
 */
public class LGEQualcommUiccRIL extends LGEQualcommRIL implements CommandsInterface {
public class LGEQualcommUiccRIL extends LGEQualcommRIL implements CommandsInterface {
    protected String mAid;
    protected String mAid;
    protected boolean mUSIM;
    private String mLastDataIface;
    private String mLastDataIface;
    boolean RILJ_LOGV = true;
    boolean RILJ_LOGV = true;
    boolean RILJ_LOGD = true;
    boolean RILJ_LOGD = true;
@@ -159,6 +160,19 @@ public class LGEQualcommUiccRIL extends LGEQualcommRIL implements CommandsInterf
    setupDataCall(String radioTechnology, String profile, String apn,
    setupDataCall(String radioTechnology, String profile, String apn,
            String user, String password, String authType, String ipVersion,
            String user, String password, String authType, String ipVersion,
            Message result) {
            Message result) {

        RILRequest rrSPT = RILRequest.obtain(
                121, null); //121 - RIL_REQUEST_VSS_SET_PDN_TABLE
        rrSPT.mp.writeInt(1); // pdnId
        rrSPT.mp.writeInt(apn.length()); // apnLength
        rrSPT.mp.writeString(apn); // apn
        rrSPT.mp.writeInt(0); // ipType
        rrSPT.mp.writeInt(0); // inactivityTime
        rrSPT.mp.writeInt(1); // enable
        send(rrSPT);



        RILRequest rr
        RILRequest rr
                = RILRequest.obtain(RIL_REQUEST_SETUP_DATA_CALL, result);
                = RILRequest.obtain(RIL_REQUEST_SETUP_DATA_CALL, result);


@@ -189,6 +203,9 @@ public class LGEQualcommUiccRIL extends LGEQualcommRIL implements CommandsInterf
        RILRequest rr
        RILRequest rr
                = RILRequest.obtain(RIL_REQUEST_SIM_IO, result);
                = RILRequest.obtain(RIL_REQUEST_SIM_IO, result);


        if (mUSIM)
            path = path.replaceAll("7F20$","7FFF");

        rr.mp.writeInt(command);
        rr.mp.writeInt(command);
        rr.mp.writeInt(fileid);
        rr.mp.writeInt(fileid);
        rr.mp.writeString(path);
        rr.mp.writeString(path);
@@ -304,10 +321,13 @@ public class LGEQualcommUiccRIL extends LGEQualcommRIL implements CommandsInterf
        if (numApplications > 0) {
        if (numApplications > 0) {
            IccCardApplication application = status.getApplication(appIndex);
            IccCardApplication application = status.getApplication(appIndex);
            mAid = application.aid;
            mAid = application.aid;
            mUSIM = application.app_type
                      == IccCardApplication.AppType.APPTYPE_USIM;
            if (TextUtils.isEmpty(mAid))
            if (TextUtils.isEmpty(mAid))
               mAid = "";
               mAid = "";
            Log.d(LOG_TAG, "mAid " + mAid);
            Log.d(LOG_TAG, "mAid " + mAid);
        }
        }

        return status;
        return status;
    }
    }


@@ -365,4 +385,56 @@ public class LGEQualcommUiccRIL extends LGEQualcommRIL implements CommandsInterf


        return dataCall;
        return dataCall;
    }
    }

    @Override
    public void getNeighboringCids(Message response) {
        if (!getRadioState().isOn())
            return;

        RILRequest rr = RILRequest.obtain(
                RILConstants.RIL_REQUEST_GET_NEIGHBORING_CELL_IDS, response);

        if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));

        send(rr);
    }

    @Override
    public void setPreferredNetworkType(int networkType , Message response) {
        /**
          * For USIMs, we want the preference to go to LTE, unless "2G-only"
          * is requested
          */
        if (mUSIM && networkType != RILConstants.NETWORK_MODE_GSM_ONLY) {
            networkType = RILConstants.NETWORK_MODE_LTE_GSM_WCDMA;
        }
        super.setPreferredNetworkType(networkType, response);
    }

    @Override
    protected Object
    responseSignalStrength(Parcel p) {
        int numInts = 12;
        int response[];

        boolean oldRil = needsOldRilFeature("signalstrength");
        boolean noLte = false;

        /* TODO: Add SignalStrength class to match RIL_SignalStrength */
        response = new int[numInts];
        for (int i = 0 ; i < numInts ; i++) {
            if ((oldRil || noLte) && i > 6 && i < 12) {
                response[i] = -1;
            } else {
                response[i] = p.readInt();
            }
            if (i == 7 && response[i] == 99) {
                response[i] = -1;
                noLte = true;
            }
        }

        return response;
    }

}
}