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

Commit bc432281 authored by Alex Yakavenka's avatar Alex Yakavenka Committed by Dan Pasanen
Browse files

Create cdma dummy apns.

Create cdma dummy apns if none are found in database.

(Forward port of commit 62641b09
that only handles NV subscriptions.)

Change-Id: I00ed7cfaff9b1543f9d687ceb8d48d39c88f4651
parent 71c8c958
Loading
Loading
Loading
Loading
+44 −0
Original line number Diff line number Diff line
@@ -674,6 +674,18 @@ public class DcTracker extends Handler {
                        Uri.parse("content://telephony/carriers/preferapn_no_update/subId/");
    static final String APN_ID = "apn_id";

    /**
     * Property that can be used to set the IP version for CDMA
     */
    private static final String PROPERTY_CDMA_IPPROTOCOL = SystemProperties.get(
            "persist.telephony.cdma.protocol", "IP");

    /**
     * Property that can be used to set the IP version for CDMA when roaming
     */
    private static final String PROPERTY_CDMA_ROAMING_IPPROTOCOL = SystemProperties.get(
            "persist.telephony.cdma.rproto", "IP");

    private boolean mCanSetPreferApn = false;

    private AtomicBoolean mAttached = new AtomicBoolean(false);
@@ -3468,6 +3480,10 @@ public class DcTracker extends Handler {

        dedupeApnSettings();

        if (mAllApnSettings.isEmpty() && isNvSubscription()) {
            addDummyApnSettings(operator);
        }

        if (mAllApnSettings.isEmpty()) {
            if (DBG) log("createAllApnList: No APN found for carrier: " + operator);
            mPreferredApn = null;
@@ -3598,6 +3614,34 @@ public class DcTracker extends Handler {
                dest.maxConnsTime, dest.mtu, dest.mvnoType, dest.mvnoMatchData);
    }

    private void addDummyApnSettings(String operator) {
        // Create dummy data profiles.
        if (DBG) log("createAllApnList: Creating dummy apn for cdma operator:" + operator);
        String[] defaultApnTypes = {
                PhoneConstants.APN_TYPE_DEFAULT,
                PhoneConstants.APN_TYPE_MMS,
                PhoneConstants.APN_TYPE_SUPL,
                PhoneConstants.APN_TYPE_HIPRI,
                PhoneConstants.APN_TYPE_FOTA,
                PhoneConstants.APN_TYPE_IMS,
                PhoneConstants.APN_TYPE_CBS};
        String[] dunApnTypes = {
                PhoneConstants.APN_TYPE_DUN};

        ApnSetting apn = new ApnSetting(DctConstants.APN_DEFAULT_ID, operator, null, null,
                null, null, null, null, null, null, null,
                RILConstants.SETUP_DATA_AUTH_PAP_CHAP, defaultApnTypes,
                PROPERTY_CDMA_IPPROTOCOL, PROPERTY_CDMA_ROAMING_IPPROTOCOL, true, 0,
                0, 0, false, 0, 0, 0, PhoneConstants.UNSET_MTU, "", "");
        mAllApnSettings.add(apn);
        apn = new ApnSetting(DctConstants.APN_DUN_ID, operator, null, null,
                null, null, null, null, null, null, null,
                RILConstants.SETUP_DATA_AUTH_PAP_CHAP, dunApnTypes,
                PROPERTY_CDMA_IPPROTOCOL, PROPERTY_CDMA_ROAMING_IPPROTOCOL, true, 0,
                0, 0, false, 0, 0, 0, PhoneConstants.UNSET_MTU, "", "");
        mAllApnSettings.add(apn);
    }

    /** Return the DC AsyncChannel for the new data connection */
    private DcAsyncChannel createDataConnection() {
        if (DBG) log("createDataConnection E");