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

Commit e75478d2 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Gerrit Code Review
Browse files

Merge changes I06ee05b5,I2eb23ab5 into mr1-staging

* changes:
  telephony: add SamsungExynos3RIL
  RIL: squashed support for old RIL
parents 98244621 301196aa
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1576,4 +1576,10 @@ public interface CommandsInterface {
     * Notifiy that we are testing an emergency call
     */
    public void testingEmergencyCall();

    /**
     * @hide
     * CM-specific: Ask the RIL about the presence of back-compat flags
     */
    public boolean needsOldRilFeature(String feature);
}
+2 −0
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ import com.android.internal.telephony.uicc.UiccController;

import java.lang.reflect.Constructor;

import java.lang.reflect.Constructor;

/**
 * {@hide}
 */
+109 −31
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.net.ConnectivityManager;
import android.net.LocalSocket;
import android.net.LocalSocketAddress;
@@ -241,6 +242,11 @@ public class RIL extends BaseCommands implements CommandsInterface {
    // When we are testing emergency calls
    AtomicBoolean mTestingEmergencyCall = new AtomicBoolean(false);

    // Number of per-network elements expected in QUERY_AVAILABLE_NETWORKS's response.
    // 4 elements is default, but many RILs actually return 5, making it impossible to
    // divide the response array without prior knowledge of the number of elements.
    protected int mQANElements = 4;

    //***** Events

    static final int EVENT_SEND                 = 1;
@@ -700,8 +706,12 @@ public class RIL extends BaseCommands implements CommandsInterface {

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

        rr.mp.writeInt(2);
        boolean oldRil = needsOldRilFeature("facilitylock");

        rr.mp.writeInt(oldRil ? 1 : 2);
        rr.mp.writeString(pin);

        if (!oldRil)
            rr.mp.writeString(aid);

        send(rr);
@@ -720,9 +730,13 @@ public class RIL extends BaseCommands implements CommandsInterface {

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

        rr.mp.writeInt(3);
        boolean oldRil = needsOldRilFeature("facilitylock");

        rr.mp.writeInt(oldRil ? 2 : 3);
        rr.mp.writeString(puk);
        rr.mp.writeString(newPin);

        if (!oldRil)
            rr.mp.writeString(aid);

        send(rr);
@@ -741,8 +755,12 @@ public class RIL extends BaseCommands implements CommandsInterface {

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

        rr.mp.writeInt(2);
        boolean oldRil = needsOldRilFeature("facilitylock");

        rr.mp.writeInt(oldRil ? 1 : 2);
        rr.mp.writeString(pin);

        if (!oldRil)
            rr.mp.writeString(aid);

        send(rr);
@@ -761,9 +779,13 @@ public class RIL extends BaseCommands implements CommandsInterface {

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

        rr.mp.writeInt(3);
        boolean oldRil = needsOldRilFeature("facilitylock");

        rr.mp.writeInt(oldRil ? 2 : 3);
        rr.mp.writeString(puk);
        rr.mp.writeString(newPin2);

        if (!oldRil)
            rr.mp.writeString(aid);

        send(rr);
@@ -782,9 +804,13 @@ public class RIL extends BaseCommands implements CommandsInterface {

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

        rr.mp.writeInt(3);
        boolean oldRil = needsOldRilFeature("facilitylock");

        rr.mp.writeInt(oldRil ? 2 : 3);
        rr.mp.writeString(oldPin);
        rr.mp.writeString(newPin);

        if (!oldRil)
            rr.mp.writeString(aid);

        send(rr);
@@ -803,9 +829,13 @@ public class RIL extends BaseCommands implements CommandsInterface {

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

        rr.mp.writeInt(3);
        boolean oldRil = needsOldRilFeature("facilitylock");

        rr.mp.writeInt(oldRil ? 2 : 3);
        rr.mp.writeString(oldPin2);
        rr.mp.writeString(newPin2);

        if (!oldRil)
            rr.mp.writeString(aid);

        send(rr);
@@ -896,8 +926,16 @@ public class RIL extends BaseCommands implements CommandsInterface {
    getIMSIForApp(String aid, Message result) {
        RILRequest rr = RILRequest.obtain(RIL_REQUEST_GET_IMSI, result);

        boolean skipNullAid = needsOldRilFeature("skipnullaid");
        boolean writeAidOnly = needsOldRilFeature("writeaidonly");

        if (!writeAidOnly && (aid != null || !skipNullAid)) {
            rr.mp.writeInt(1);
            rr.mp.writeString(aid);
        }

        if (writeAidOnly)
            rr.mp.writeString(aid);

        if (RILJ_LOGD) riljLog(rr.serialString() +
                              "> getIMSI: " + requestToString(rr.mRequest)
@@ -1660,17 +1698,19 @@ public class RIL extends BaseCommands implements CommandsInterface {
                            Message response) {
        RILRequest rr = RILRequest.obtain(RIL_REQUEST_QUERY_FACILITY_LOCK, response);

        if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                                                 + " [" + facility + " " + serviceClass
                                                 + " " + appId + "]");
        if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));

        boolean oldRil = needsOldRilFeature("facilitylock");

        // count strings
        rr.mp.writeInt(4);
        rr.mp.writeInt(oldRil ? 3 : 4);

        rr.mp.writeString(facility);
        rr.mp.writeString(password);

        rr.mp.writeString(Integer.toString(serviceClass));

        if (!oldRil)
            rr.mp.writeString(appId);

        send(rr);
@@ -1695,14 +1735,18 @@ public class RIL extends BaseCommands implements CommandsInterface {
                                                        + " [" + facility + " " + lockState
                                                        + " " + serviceClass + " " + appId + "]");

        boolean oldRil = needsOldRilFeature("facilitylock");

        // count strings
        rr.mp.writeInt(5);
        rr.mp.writeInt(oldRil ? 4 : 5);

        rr.mp.writeString(facility);
        lockString = (lockState)?"1":"0";
        rr.mp.writeString(lockString);
        rr.mp.writeString(password);
        rr.mp.writeString(Integer.toString(serviceClass));

        if (!oldRil)
            rr.mp.writeString(appId);

        send(rr);
@@ -1869,7 +1913,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
        if (RILJ_LOGD) riljLog("setCurrentPreferredNetworkType: " + mSetPreferredNetworkType);
        setPreferredNetworkType(mSetPreferredNetworkType, null);
    }
    private int mSetPreferredNetworkType;
    protected int mSetPreferredNetworkType;

    /**
     * {@inheritDoc}
@@ -2645,6 +2689,10 @@ public class RIL extends BaseCommands implements CommandsInterface {
            case RIL_UNSOL_DATA_CALL_LIST_CHANGED:
                if (RILJ_LOGD) unsljLogRet(response, ret);

                boolean oldRil = needsOldRilFeature("skipbrokendatacall");
                if (oldRil && "IP".equals(((ArrayList<DataCallState>)ret).get(0).type))
                    break;

                mDataNetworkStateRegistrants.notifyRegistrants(new AsyncResult(null, ret, null));
            break;

@@ -3030,16 +3078,31 @@ public class RIL extends BaseCommands implements CommandsInterface {
        return new IccIoResult(sw1, sw2, s);
    }

    @Override
    public boolean needsOldRilFeature(String feature) {
        String[] features = SystemProperties.get("ro.telephony.ril.v3", "").split(",");
        for (String found: features) {
            if (found.equals(feature))
                return true;
        }
        return false;
    }

    protected Object
    responseIccCardStatus(Parcel p) {
        IccCardApplicationStatus appStatus;

        boolean oldRil = needsOldRilFeature("icccardstatus");

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

        if (!oldRil)
            cardStatus.mImsSubscriptionAppIndex = p.readInt();

        int numApplications = p.readInt();

        // limit to maximum allowed applications
@@ -3047,6 +3110,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
            numApplications = IccCardStatus.CARD_MAX_APPS;
        }
        cardStatus.mApplications = new IccCardApplicationStatus[numApplications];

        for (int i = 0 ; i < numApplications ; i++) {
            appStatus = new IccCardApplicationStatus();
            appStatus.app_type       = appStatus.AppTypeFromRILInt(p.readInt());
@@ -3150,6 +3214,11 @@ public class RIL extends BaseCommands implements CommandsInterface {
    }

    protected DataCallState getDataCallState(Parcel p, int version) {
        boolean oldRil = needsOldRilFeature("datacall");
        int ver = (oldRil ? 3 : p.readInt());
        int num = p.readInt();
        if (RILJ_LOGV) riljLog("responseSetupDataCall ver=" + ver + " num=" + num);

        DataCallState dataCall = new DataCallState();

        dataCall.version = version;
@@ -3157,12 +3226,20 @@ public class RIL extends BaseCommands implements CommandsInterface {
            dataCall.cid = p.readInt();
            dataCall.active = p.readInt();
            dataCall.type = p.readString();
            if (version < 4 || needsOldRilFeature("datacallapn")) {
                p.readString(); // APN - not used
            }
            String addresses = p.readString();
            if (!TextUtils.isEmpty(addresses)) {
                dataCall.addresses = addresses.split(" ");
            }
            // DataCallState needs an ifname. Since we don't have one use the name from the ThrottleService resource (default=rmnet0).
            dataCall.ifname = Resources.getSystem().getString(com.android.internal.R.string.config_datause_iface);
        } else {
            dataCall.status = p.readInt();
            if (needsOldRilFeature("usehcradio"))
                dataCall.suggestedRetryTime = -1;
            else
	      dataCall.suggestedRetryTime = p.readInt();
            dataCall.cid = p.readInt();
            dataCall.active = p.readInt();
@@ -3191,8 +3268,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
    protected Object
    responseDataCallList(Parcel p) {
        ArrayList<DataCallState> response;

        int ver = p.readInt();
        boolean oldRil = needsOldRilFeature("datacall");
        int ver = (oldRil ? 3 : p.readInt());
        int num = p.readInt();
        riljLog("responseDataCallList ver=" + ver + " num=" + num);

@@ -3206,7 +3283,8 @@ public class RIL extends BaseCommands implements CommandsInterface {

    protected Object
    responseSetupDataCall(Parcel p) {
        int ver = p.readInt();
        boolean oldRil = needsOldRilFeature("datacall");
        int ver = (oldRil ? 3 : p.readInt());
        int num = p.readInt();
        if (RILJ_LOGV) riljLog("responseSetupDataCall ver=" + ver + " num=" + num);

@@ -3256,15 +3334,15 @@ public class RIL extends BaseCommands implements CommandsInterface {
        String strings[] = (String [])responseStrings(p);
        ArrayList<OperatorInfo> ret;

        if (strings.length % 4 != 0) {
        if (strings.length % mQANElements != 0) {
            throw new RuntimeException(
                "RIL_REQUEST_QUERY_AVAILABLE_NETWORKS: invalid response. Got "
                + strings.length + " strings, expected multible of 4");
                + strings.length + " strings, expected multiple of " + mQANElements);
        }

        ret = new ArrayList<OperatorInfo>(strings.length / 4);
        ret = new ArrayList<OperatorInfo>(strings.length / mQANElements);

        for (int i = 0 ; i < strings.length ; i += 4) {
        for (int i = 0 ; i < strings.length ; i += mQANElements) {
            ret.add (
                new OperatorInfo(
                    strings[i+0],
+965 −0

File added.

Preview size limit exceeded, changes collapsed.

+9 −0
Original line number Diff line number Diff line
@@ -489,6 +489,12 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
            if (DBG) log("enableApnType: return APN_ALREADY_ACTIVE");
            return PhoneConstants.APN_ALREADY_ACTIVE;
        }
        if (mPhone.mCM.needsOldRilFeature("singlepdp") && !PhoneConstants.APN_TYPE_DEFAULT.equals(apnType)) {
            ApnContext defContext = mApnContexts.get(PhoneConstants.APN_TYPE_DEFAULT);
            if (defContext.isEnabled()) {
                setEnabled(apnTypeToId(PhoneConstants.APN_TYPE_DEFAULT), false);
            }
        }
        setEnabled(apnTypeToId(apnType), true);
        if (DBG) {
            log("enableApnType: new apn request for type " + apnType +
@@ -523,6 +529,9 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {

        if (apnContext != null) {
            setEnabled(apnTypeToId(type), false);
            if (mPhone.mCM.needsOldRilFeature("singlepdp") && !PhoneConstants.APN_TYPE_DEFAULT.equals(type)) {
                setEnabled(apnTypeToId(PhoneConstants.APN_TYPE_DEFAULT), true);
            }
            if (apnContext.getState() != DctConstants.State.IDLE && apnContext.getState()
                    != DctConstants.State.FAILED) {
                if (DBG) log("diableApnType: return APN_REQUEST_STARTED");
Loading