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

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

Merge "Telephony: Add "singlepdp" RIL feature" into ics

parents 4c78ff04 bdbb263b
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -475,6 +475,12 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
            if (DBG) log("enableApnType: return APN_ALREADY_ACTIVE");
            return Phone.APN_ALREADY_ACTIVE;
        }
        if (needsOldRilFeature("singlepdp") && !Phone.APN_TYPE_DEFAULT.equals(apnType)) {
            ApnContext defContext = mApnContexts.get(Phone.APN_TYPE_DEFAULT);
            if (defContext.isEnabled()) {
                setEnabled(apnTypeToId(Phone.APN_TYPE_DEFAULT), false);
            }
        }
        setEnabled(apnTypeToId(apnType), true);
        if (DBG) {
            log("enableApnType: new apn request for type " + apnType +
@@ -509,6 +515,9 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {

        if (apnContext != null) {
            setEnabled(apnTypeToId(type), false);
            if (needsOldRilFeature("singlepdp") && !Phone.APN_TYPE_DEFAULT.equals(type)) {
                setEnabled(apnTypeToId(Phone.APN_TYPE_DEFAULT), true);
            }
            if (apnContext.getState() != State.IDLE && apnContext.getState() != State.FAILED) {
                if (DBG) log("diableApnType: return APN_REQUEST_STARTED");
                return Phone.APN_REQUEST_STARTED;
@@ -2458,4 +2467,15 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
    protected void loge(String s) {
        Log.e(LOG_TAG, "[GsmDCT] " + s);
    }

    /** Maybe we should share this from RIL */
    protected 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;
    }

}