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

Commit bc368867 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Ricardo Cerqueira
Browse files

LGEQualcommUiccRIL: New subclass to deal with the latest qcom RIL

Yet another generation of CAF RIL, this one is necessary to support
multi-RAT (GSM/LTE) radios...

Change-Id: I87b5126ffbc16f3ccc7caaf227354edf95543c35

LGEQualcommUiccRIL: Fix LTE support

Change-Id: Ifab51550113926d6d1b6c421e805f456d95faca8

LGEQualcommUiccRIL: Fix multi-PDP support

Multiple concurrent PDPs are now functional, allowing the back-compat
singlepdp flag to be disabled

Change-Id: I8ef55e96b9f05d4a4dd8dbbaeddf6d48ded7fc67

Update to 4.2 APIs
parent 5343f096
Loading
Loading
Loading
Loading
+190 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2012 The CyanogenMod Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.internal.telephony;

import static com.android.internal.telephony.RILConstants.*;

import android.content.Context;
import android.os.Message;
import android.os.Parcel;
import android.os.SystemProperties;
import android.telephony.SignalStrength;
import android.text.TextUtils;
import android.util.Log;

import java.util.ArrayList;

/**
 * Custom Qualcomm No SimReady RIL for LGE using the latest Uicc stack
 *
 * {@hide}
 */
public class LGEQualcommUiccRIL extends QualcommSharedRIL implements CommandsInterface {
    boolean RILJ_LOGV = true;
    boolean RILJ_LOGD = true;

    public LGEQualcommUiccRIL(Context context, int networkMode, int cdmaSubscription) {
        super(context, networkMode, cdmaSubscription);
    }

    /*
    @Override
    public void
    setupDataCall(String radioTechnology, String profile, String apn,
            String user, String password, String authType, String protocol,
            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.obtain(RIL_REQUEST_SETUP_DATA_CALL, result);

        rr.mp.writeInt(7);

        rr.mp.writeString(radioTechnology);
        rr.mp.writeString(profile);
        rr.mp.writeString(apn);
        rr.mp.writeString(user);
        rr.mp.writeString(password);
        rr.mp.writeString(authType);
        rr.mp.writeString(protocol);

        if (RILJ_LOGD) riljLog(rr.serialString() + "> "
                + requestToString(rr.mRequest) + " " + radioTechnology + " "
                + profile + " " + apn + " " + user + " "
                + password + " " + authType + " " + protocol);

        send(rr);
    }
    */

    @Override
    protected Object
    responseSetupDataCall(Parcel p) {
        DataCallState dataCall;

        boolean oldRil = needsOldRilFeature("datacall");

        if (!oldRil)
           return super.responseSetupDataCall(p);

        p.readString();
        return super.responseSetupDataCall(p);

    }
    @Override
    protected Object
    responseIccCardStatus(Parcel p) {
        IccCardApplicationStatus ca;

        IccCardStatus status = new IccCardStatus();
        status.setCardState(p.readInt());
        status.setUniversalPinState(p.readInt());
        status.mGsmUmtsSubscriptionAppIndex = p.readInt();
        status.mCdmaSubscriptionAppIndex = p.readInt();

        status.mImsSubscriptionAppIndex = p.readInt();

        int numApplications = p.readInt();

        // limit to maximum allowed applications
        if (numApplications > IccCardStatus.CARD_MAX_APPS) {
            numApplications = IccCardStatus.CARD_MAX_APPS;
        }
        status.mApplications = new IccCardApplicationStatus[numApplications];


        for (int i = 0; i < numApplications; i++) {
            ca = new IccCardApplicationStatus();
            ca.app_type = ca.AppTypeFromRILInt(p.readInt());
            ca.app_state = ca.AppStateFromRILInt(p.readInt());
            ca.perso_substate = ca.PersoSubstateFromRILInt(p.readInt());
            ca.aid = p.readString();
            ca.app_label = p.readString();
            ca.pin1_replaced = p.readInt();
            ca.pin1 = ca.PinStateFromRILInt(p.readInt());
            ca.pin2 = ca.PinStateFromRILInt(p.readInt());
            p.readInt(); //remaining_count_pin1
            p.readInt(); //remaining_count_puk1
            p.readInt(); //remaining_count_pin2
            p.readInt(); //remaining_count_puk2
            status.mApplications[i] = ca;
        }
        int appIndex = -1;
        if (mPhoneType == RILConstants.CDMA_PHONE) {
            appIndex = status.mCdmaSubscriptionAppIndex;
            Log.d(LOG_TAG, "This is a CDMA PHONE " + appIndex);
        } else {
            appIndex = status.mGsmUmtsSubscriptionAppIndex;
            Log.d(LOG_TAG, "This is a GSM PHONE " + appIndex);
        }

        if (numApplications > 0) {
            IccCardApplicationStatus application = status.mApplications[appIndex];
            mAid = application.aid;
            mUSIM = application.app_type
                      == IccCardApplicationStatus.AppType.APPTYPE_USIM;
            mSetPreferredNetworkType = mPreferredNetworkType;

            if (TextUtils.isEmpty(mAid))
               mAid = "";
            Log.d(LOG_TAG, "mAid " + mAid);
        }

        return status;
    }

    @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;
            }
            if (i == 8 && !(noLte || oldRil)) {
                response[i] *= -1;
            }
        }

        return new SignalStrength(response[0], response[1], response[2], response[3], response[4], response[5], response[6], response[7],response[8], response[9], response[10], response[11], true);
    }

}