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

Commit 22ff84f9 authored by Anil Kumar T.V's avatar Anil Kumar T.V Committed by Richard Ross
Browse files

Fix 1x/evdo data call for NV/RUIM based subscription.

NV/RUIM based CDMA subscription was not handled properly in
DcTracker and data calls were not initiated since it was
waiting for sim loaded event.Changed the code to allow data
calls even without loading SIM ,if CDMA subscription is NV
based.
Dummy APN profiles will be created based on the current DATA
radio technology so that they wont be used for GSM/UMTS/LTE
and eHRPD.

Patch set 2:
* Rewrite a portion of the fix to Google standard.
* The reason string is only for log purposes.
* Add support for SIM/RUIM based connection.
* Consolidate the fix to one method.
Change-Id: Ie536f10e76befc62bdd4e1b99f3db7906d0f345d
parent 24616bba
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ public interface Phone {
    static final String REASON_DATA_DEPENDENCY_UNMET = "dependencyUnmet";
    static final String REASON_LOST_DATA_CONNECTION = "lostDataConnection";
    static final String REASON_CONNECTED = "connected";
    static final String REASON_NV_READY = "nvReady";

    // Used for band mode selection methods
    static final int BM_UNSPECIFIED = 0; // selected by baseband automatically
+31 −6
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ import com.android.internal.telephony.PhoneBase;
import com.android.internal.telephony.DctConstants;
import com.android.internal.telephony.EventLogTags;
import com.android.internal.telephony.gsm.GSMPhone;
import com.android.internal.telephony.cdma.CdmaSubscriptionSourceManager;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.RILConstants;
import com.android.internal.telephony.uicc.IccRecords;
@@ -106,6 +107,8 @@ public final class DcTracker extends DcTrackerBase {
    /** Watches for changes to the APN db. */
    private ApnChangeObserver mApnObserver;

    private CdmaSubscriptionSourceManager mCdmaSsm;

    //***** Constructor

    public DcTracker(PhoneBase p) {
@@ -132,6 +135,12 @@ public final class DcTracker extends DcTrackerBase {
        p.getServiceStateTracker().registerForPsRestrictedDisabled(this,
                DctConstants.EVENT_PS_RESTRICT_DISABLED, null);

        if (p.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) {
            mCdmaSsm = CdmaSubscriptionSourceManager.getInstance(
                    p.getContext(), p.mCi, this,
                    DctConstants.EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED, null);
        }

        mDataConnectionTracker = this;

        mApnObserver = new ApnChangeObserver();
@@ -185,6 +194,10 @@ public final class DcTracker extends DcTrackerBase {
        mPhone.getContext().getContentResolver().unregisterContentObserver(mApnObserver);
        mApnContexts.clear();

        if (mCdmaSsm != null) {
            mCdmaSsm.dispose(this);
        }

        destroyDataConnections();
    }

@@ -559,10 +572,14 @@ public final class DcTracker extends DcTrackerBase {
        boolean desiredPowerState = mPhone.getServiceStateTracker().getDesiredPowerState();
        IccRecords r = mIccRecords.get();
        boolean recordsLoaded = (r != null) ? r.getRecordsLoaded() : false;
        boolean subscriptionFromNv = ( (mPhone.getPhoneType() ==
                PhoneConstants.PHONE_TYPE_CDMA) &&
                (mCdmaSsm.getCdmaSubscriptionSource()
                == CdmaSubscriptionSourceManager.SUBSCRIPTION_FROM_NV) );

        boolean allowed =
                    (gprsState == ServiceState.STATE_IN_SERVICE || mAutoAttachOnCreation) &&
                    recordsLoaded &&
                    (subscriptionFromNv || recordsLoaded) &&
                    (mPhone.getState() == PhoneConstants.State.IDLE ||
                     mPhone.getServiceStateTracker().isConcurrentVoiceAndDataAllowed()) &&
                    internalDataEnabled &&
@@ -574,7 +591,9 @@ public final class DcTracker extends DcTrackerBase {
            if (!((gprsState == ServiceState.STATE_IN_SERVICE) || mAutoAttachOnCreation)) {
                reason += " - gprs= " + gprsState;
            }
            if (!recordsLoaded) reason += " - SIM not loaded";
            if (!(subscriptionFromNv || recordsLoaded)) {
                reason += " - SIM not loaded and not NV subscription";
            }
            if (mPhone.getState() != PhoneConstants.State.IDLE &&
                    !mPhone.getServiceStateTracker().isConcurrentVoiceAndDataAllowed()) {
                reason += " - PhoneState= " + mPhone.getState();
@@ -1306,14 +1325,14 @@ public final class DcTracker extends DcTrackerBase {
        }
    }

    private void onRecordsLoaded() {
    private void onRecordsLoaded(String reason) {
        if (DBG) log("onRecordsLoaded: createAllApnList");
        createAllApnList();
        if (mPhone.mCi.getRadioState().isOn()) {
            if (DBG) log("onRecordsLoaded: notifying data availability");
            notifyOffApnsOfAvailability(Phone.REASON_SIM_LOADED);
            notifyOffApnsOfAvailability(reason);
        }
        setupDataOnConnectableApns(Phone.REASON_SIM_LOADED);
        setupDataOnConnectableApns(reason);
    }

    @Override
@@ -2112,7 +2131,7 @@ public final class DcTracker extends DcTrackerBase {

        switch (msg.what) {
            case DctConstants.EVENT_RECORDS_LOADED:
                onRecordsLoaded();
                onRecordsLoaded(Phone.REASON_SIM_LOADED);
                break;

            case DctConstants.EVENT_DATA_CONNECTION_DETACHED:
@@ -2193,6 +2212,10 @@ public final class DcTracker extends DcTrackerBase {
                }
                break;

            case DctConstants.EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED:
                onRecordsLoaded(Phone.REASON_NV_READY);
                break;

            default:
                // handle the message in the super class DataConnectionTracker
                super.handleMessage(msg);
@@ -2207,6 +2230,8 @@ public final class DcTracker extends DcTrackerBase {
            return RILConstants.DATA_PROFILE_FOTA;
        } else if (TextUtils.equals(apnType, PhoneConstants.APN_TYPE_CBS)) {
            return RILConstants.DATA_PROFILE_CBS;
        } else if (TextUtils.equals(apnType, PhoneConstants.APN_TYPE_DUN)) {
            return RILConstants.DATA_PROFILE_TETHERED;
        } else {
            return RILConstants.DATA_PROFILE_DEFAULT;
        }