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

Commit c83f5ca3 authored by Chris Holmes's avatar Chris Holmes Committed by Dorian Snyder
Browse files

Revert "Fix cdma data calls based on NV"

Causing a wild issue on d2vzw and jfltevzw.
If you connect to wifi, data will be broken when you disconnect
unless you reboot the phone.  Reverting this and the dependant
base change fixes the issue with data coming off wifi.

This reverts commit 7cd6a99e.

PS2: Retain some NV pieces
PS3: Fix compile
PS4: derp

Change-Id: Iaad556f46bf5d35483f1c44c054945511d8c4234
parent 0d5797cc
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -104,7 +104,6 @@ public interface Phone {
    static final String REASON_LOST_DATA_CONNECTION = "lostDataConnection";
    static final String REASON_LOST_DATA_CONNECTION = "lostDataConnection";
    static final String REASON_CONNECTED = "connected";
    static final String REASON_CONNECTED = "connected";
    static final String REASON_SINGLE_PDN_ARBITRATION = "SinglePdnArbitration";
    static final String REASON_SINGLE_PDN_ARBITRATION = "SinglePdnArbitration";
    static final String REASON_NV_READY = "nvReady";


    // Used for band mode selection methods
    // Used for band mode selection methods
    static final int BM_UNSPECIFIED = 0; // selected by baseband automatically
    static final int BM_UNSPECIFIED = 0; // selected by baseband automatically
+1 −2
Original line number Original line Diff line number Diff line
@@ -136,8 +136,7 @@ public class CDMAPhone extends PhoneBase {


    Registrant mPostDialHandler;
    Registrant mPostDialHandler;


    public static final String PROPERTY_CDMA_HOME_OPERATOR_NUMERIC =
    static String PROPERTY_CDMA_HOME_OPERATOR_NUMERIC = "ro.cdma.home.operator.numeric";
            "ro.cdma.home.operator.numeric";


    // Constructors
    // Constructors
    public CDMAPhone(Context context, CommandsInterface ci, PhoneNotifier notifier) {
    public CDMAPhone(Context context, CommandsInterface ci, PhoneNotifier notifier) {
+4 −9
Original line number Original line Diff line number Diff line
@@ -455,11 +455,10 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
            mPhone.notifyServiceStateChanged(mSS);
            mPhone.notifyServiceStateChanged(mSS);
        }
        }


        // First notify detached, then rat changed, then attached - that's the way it
        if (hasCdmaDataConnectionAttached || has4gHandoff) {
        // happens in the modem.
            mAttachedRegistrants.notifyRegistrants();
        // Behavior of recipients (DcTracker, for instance) depends on this sequence
        }
        // since DcTracker reloads profiles on "rat_changed" notification and sets up

        // data call on "attached" notification.
        if (hasCdmaDataConnectionDetached) {
        if (hasCdmaDataConnectionDetached) {
            mDetachedRegistrants.notifyRegistrants();
            mDetachedRegistrants.notifyRegistrants();
        }
        }
@@ -469,10 +468,6 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
            mPhone.notifyDataConnection(null);
            mPhone.notifyDataConnection(null);
        }
        }


        if (hasCdmaDataConnectionAttached || has4gHandoff) {
            mAttachedRegistrants.notifyRegistrants();
        }

        if (hasRoamingOn) {
        if (hasRoamingOn) {
            mRoamingOnRegistrants.notifyRegistrants();
            mRoamingOnRegistrants.notifyRegistrants();
        }
        }
+4 −9
Original line number Original line Diff line number Diff line
@@ -1107,11 +1107,10 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
            mPhone.notifyServiceStateChanged(mSS);
            mPhone.notifyServiceStateChanged(mSS);
        }
        }


        // First notify detached, then rat changed, then attached - that's the way it
        if (hasCdmaDataConnectionAttached) {
        // happens in the modem.
            mAttachedRegistrants.notifyRegistrants();
        // Behavior of recipients (DcTracker, for instance) depends on this sequence
        }
        // since DcTracker reloads profiles on "rat_changed" notification and sets up

        // data call on "attached" notification.
        if (hasCdmaDataConnectionDetached) {
        if (hasCdmaDataConnectionDetached) {
            mDetachedRegistrants.notifyRegistrants();
            mDetachedRegistrants.notifyRegistrants();
        }
        }
@@ -1121,10 +1120,6 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
            mPhone.notifyDataConnection(null);
            mPhone.notifyDataConnection(null);
        }
        }


        if (hasCdmaDataConnectionAttached) {
            mAttachedRegistrants.notifyRegistrants();
        }

        if (hasRoamingOn) {
        if (hasRoamingOn) {
            mRoamingOnRegistrants.notifyRegistrants();
            mRoamingOnRegistrants.notifyRegistrants();
        }
        }
+30 −96
Original line number Original line Diff line number Diff line
@@ -142,8 +142,6 @@ public final class DcTracker extends DcTrackerBase {
                DctConstants.EVENT_PS_RESTRICT_ENABLED, null);
                DctConstants.EVENT_PS_RESTRICT_ENABLED, null);
        p.getServiceStateTracker().registerForPsRestrictedDisabled(this,
        p.getServiceStateTracker().registerForPsRestrictedDisabled(this,
                DctConstants.EVENT_PS_RESTRICT_DISABLED, null);
                DctConstants.EVENT_PS_RESTRICT_DISABLED, null);
        p.getServiceStateTracker().registerForDataRegStateOrRatChanged(this,
                DctConstants.EVENT_DATA_RAT_CHANGED, null);


        if (p.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) {
        if (p.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) {
            mCdmaSsm = CdmaSubscriptionSourceManager.getInstance(
            mCdmaSsm = CdmaSubscriptionSourceManager.getInstance(
@@ -183,7 +181,7 @@ public final class DcTracker extends DcTrackerBase {


    @Override
    @Override
    public void dispose() {
    public void dispose() {
        if (DBG) log("dispose");
        if (DBG) log("GsmDCT.dispose");
        cleanUpAllConnections(true, null);
        cleanUpAllConnections(true, null);


        super.dispose();
        super.dispose();
@@ -210,6 +208,7 @@ public final class DcTracker extends DcTrackerBase {
        if (mCdmaSsm != null) {
        if (mCdmaSsm != null) {
            mCdmaSsm.dispose(this);
            mCdmaSsm.dispose(this);
        }
        }

        destroyDataConnections();
        destroyDataConnections();
    }
    }


@@ -1130,11 +1129,6 @@ public final class DcTracker extends DcTrackerBase {
     * Handles changes to the APN database.
     * Handles changes to the APN database.
     */
     */
    private void onApnChanged() {
    private void onApnChanged() {
        if (DBG) log("onApnChanged: tryRestartDataConnections");
        tryRestartDataConnections(Phone.REASON_APN_CHANGED);
    }

    private void tryRestartDataConnections(String reason) {
        DctConstants.State overallState = getOverallState();
        DctConstants.State overallState = getOverallState();
        boolean isDisconnected = (overallState == DctConstants.State.IDLE ||
        boolean isDisconnected = (overallState == DctConstants.State.IDLE ||
                overallState == DctConstants.State.FAILED);
                overallState == DctConstants.State.FAILED);
@@ -1146,12 +1140,12 @@ public final class DcTracker extends DcTrackerBase {


        // TODO: It'd be nice to only do this if the changed entrie(s)
        // TODO: It'd be nice to only do this if the changed entrie(s)
        // match the current operator.
        // match the current operator.
        if (DBG) log("tryRestartDataConnections: createAllApnList and cleanUpAllConnections");
        if (DBG) log("onApnChanged: createAllApnList and cleanUpAllConnections");
        createAllApnList();
        createAllApnList();
        setInitialAttachApn();
        setInitialAttachApn();
        cleanUpAllConnections(!isDisconnected, reason);
        cleanUpAllConnections(!isDisconnected, Phone.REASON_APN_CHANGED);
        if (isDisconnected) {
        if (isDisconnected) {
            setupDataOnConnectableApns(reason);
            setupDataOnConnectableApns(Phone.REASON_APN_CHANGED);
        }
        }
    }
    }


@@ -1367,12 +1361,6 @@ public final class DcTracker extends DcTrackerBase {
        setupDataOnConnectableApns(Phone.REASON_SIM_LOADED);
        setupDataOnConnectableApns(Phone.REASON_SIM_LOADED);
    }
    }


    private void onNvReady() {
        if (DBG) log("onNvReady");
        createAllApnList();
        setupDataOnConnectableApns(Phone.REASON_NV_READY);
    }

    @Override
    @Override
    protected void onSetDependencyMet(String apnType, boolean met) {
    protected void onSetDependencyMet(String apnType, boolean met) {
        // don't allow users to tweak hipri to work around default dependency not met
        // don't allow users to tweak hipri to work around default dependency not met
@@ -1885,17 +1873,12 @@ public final class DcTracker extends DcTrackerBase {


        // If APN is still enabled, try to bring it back up automatically
        // If APN is still enabled, try to bring it back up automatically
        if (mAttached.get() && apnContext.isReady() && retryAfterDisconnected(apnContext)) {
        if (mAttached.get() && apnContext.isReady() && retryAfterDisconnected(apnContext)) {
            if (apnContext.getReason().equals(Phone.REASON_NW_TYPE_CHANGED)) {
                // Retry immediately if reason is nw_type_changed (like rat switch, for instance)
                setupDataOnConnectableApns(Phone.REASON_NW_TYPE_CHANGED);
            } else {
            SystemProperties.set(PUPPET_MASTER_RADIO_STRESS_TEST, "false");
            SystemProperties.set(PUPPET_MASTER_RADIO_STRESS_TEST, "false");
            // Wait a bit before trying the next APN, so that
            // Wait a bit before trying the next APN, so that
            // we're not tying up the RIL command channel.
            // we're not tying up the RIL command channel.
            // This also helps in any external dependency to turn off the context.
            // This also helps in any external dependency to turn off the context.
            if(DBG) log("onDisconnectDone: attached, ready and retry after disconnect");
            if(DBG) log("onDisconnectDone: attached, ready and retry after disconnect");
            startAlarmForReconnect(getApnDelay(), apnContext);
            startAlarmForReconnect(getApnDelay(), apnContext);
            }
        } else {
        } else {
            boolean restartRadioAfterProvisioning = mPhone.getContext().getResources().getBoolean(
            boolean restartRadioAfterProvisioning = mPhone.getContext().getResources().getBoolean(
                    com.android.internal.R.bool.config_restartRadioAfterProvisioning);
                    com.android.internal.R.bool.config_restartRadioAfterProvisioning);
@@ -2035,29 +2018,13 @@ public final class DcTracker extends DcTrackerBase {
    }
    }


    /**
    /**
     * Returns mccmnc for data call either from cdma_home_operator or from IccRecords
     * Based on the sim operator numeric, create a list for all possible
     * @return operator numeric
     */
    private String getOperatorNumeric() {
        String result;
        if (isNvSubscription()) {
            result = SystemProperties.get(CDMAPhone.PROPERTY_CDMA_HOME_OPERATOR_NUMERIC);
            log("getOperatorNumberic - returning from NV: " + result);
        } else {
            IccRecords r = mIccRecords.get();
            result = (r != null) ? r.getOperatorNumeric() : "";
            log("getOperatorNumberic - returning from card: " + result);
        }
        return result;
    }

    /**
     * Based on the operator numeric, create a list for all possible
     * Data Connections and setup the preferredApn.
     * Data Connections and setup the preferredApn.
     */
     */
    private void createAllApnList() {
    private void createAllApnList() {
        mAllApnSettings = new ArrayList<ApnSetting>();
        mAllApnSettings = new ArrayList<ApnSetting>();
        String operator = getOperatorNumeric();
        IccRecords r = mIccRecords.get();
        String operator = (r != null) ? r.getOperatorNumeric() : "";
        if (operator != null) {
        if (operator != null) {
            String selection = "numeric = '" + operator + "'";
            String selection = "numeric = '" + operator + "'";
            // query only enabled apn.
            // query only enabled apn.
@@ -2141,7 +2108,9 @@ public final class DcTracker extends DcTrackerBase {
            }
            }
        }
        }


        String operator = getOperatorNumeric();
        IccRecords r = mIccRecords.get();
        String operator = (r != null) ? r.getOperatorNumeric() : "";

        // This is a workaround for a bug (7305641) where we don't failover to other
        // This is a workaround for a bug (7305641) where we don't failover to other
        // suitable APNs if our preferred APN fails.  On prepaid ATT sims we need to
        // suitable APNs if our preferred APN fails.  On prepaid ATT sims we need to
        // failover to a provisioning APN, but once we've used their default data
        // failover to a provisioning APN, but once we've used their default data
@@ -2159,7 +2128,8 @@ public final class DcTracker extends DcTrackerBase {
            log("buildWaitingApns: usePreferred=" + usePreferred
            log("buildWaitingApns: usePreferred=" + usePreferred
                    + " canSetPreferApn=" + mCanSetPreferApn
                    + " canSetPreferApn=" + mCanSetPreferApn
                    + " mPreferredApn=" + mPreferredApn
                    + " mPreferredApn=" + mPreferredApn
                    + " operator=" + operator + " radioTech=" + radioTech);
                    + " operator=" + operator + " radioTech=" + radioTech
                    + " IccRecords r=" + r);
        }
        }


        if (usePreferred && mCanSetPreferApn && mPreferredApn != null &&
        if (usePreferred && mCanSetPreferApn && mPreferredApn != null &&
@@ -2184,7 +2154,7 @@ public final class DcTracker extends DcTrackerBase {
                mPreferredApn = null;
                mPreferredApn = null;
            }
            }
        }
        }
        if (mAllApnSettings != null && !mAllApnSettings.isEmpty()) {
        if (mAllApnSettings != null) {
            if (DBG) log("buildWaitingApns: mAllApnSettings=" + mAllApnSettings);
            if (DBG) log("buildWaitingApns: mAllApnSettings=" + mAllApnSettings);
            for (ApnSetting apn : mAllApnSettings) {
            for (ApnSetting apn : mAllApnSettings) {
                if (DBG) log("buildWaitingApns: apn=" + apn);
                if (DBG) log("buildWaitingApns: apn=" + apn);
@@ -2381,20 +2351,6 @@ public final class DcTracker extends DcTrackerBase {
                }
                }
                break;
                break;


            case DctConstants.EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED: // fall thru
            case DctConstants.EVENT_DATA_RAT_CHANGED:
                // When data rat changes we might need to load different
                // set of apns (example, LTE->1x)
                if (onUpdateIcc()) {
                    log("onUpdateIcc: tryRestartDataConnections " + Phone.REASON_NW_TYPE_CHANGED);
                    tryRestartDataConnections(Phone.REASON_NW_TYPE_CHANGED);
                } else if (isNvSubscription()){
                    // If cdma subscription source changed to NV or data rat changed to cdma
                    // (while subscription source was NV) - we need to trigger NV ready
                    onNvReady();
                }
                break;

            default:
            default:
                // handle the message in the super class DataConnectionTracker
                // handle the message in the super class DataConnectionTracker
                super.handleMessage(msg);
                super.handleMessage(msg);
@@ -2432,50 +2388,28 @@ public final class DcTracker extends DcTrackerBase {
        return cid;
        return cid;
    }
    }


    /**
     * @description This function updates mIccRecords reference to track
     *              currently used IccRecords
     * @return true if IccRecords changed
     */
    @Override
    @Override
    protected boolean onUpdateIcc() {
    protected void onUpdateIcc() {
        boolean result = false;
        if (mUiccController == null ) {
        if (mUiccController == null ) {
            loge("onUpdateIcc: mUiccController is null. Error!");
            return;
            return false;
        }
        }


        int dataRat = mPhone.getServiceState().getRilDataRadioTechnology();
        IccRecords newIccRecords = mUiccController.getIccRecords(UiccController.APP_FAM_3GPP);
        int appFamily = UiccController.getFamilyFromRadioTechnology(dataRat);
        IccRecords newIccRecords = mUiccController.getIccRecords(appFamily);
        log("onUpdateIcc: newIccRecords " + ((newIccRecords != null) ?
                newIccRecords.getClass().getName() : null));
        if (dataRat == ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN) {
            // Ignore this. This could be due to data not registered
            // We want to ignore RADIO_TECHNOLOGY_UNKNOWN so that we do not tear down data
            // call in case we are out of service.
            return false;
        }


        IccRecords r = mIccRecords.get();
        IccRecords r = mIccRecords.get();
        if (r != newIccRecords) {
        if (r != newIccRecords) {
            if (r != null) {
            if (r != null) {
                log("Removing stale icc objects. " + ((r != null) ?
                log("Removing stale icc objects.");
                        r.getClass().getName() : null));
                r.unregisterForRecordsLoaded(this);
                r.unregisterForRecordsLoaded(this);
                mIccRecords.set(null);
                mIccRecords.set(null);
            }
            }
            if (newIccRecords != null) {
            if (newIccRecords != null) {
                log("New records found " + ((newIccRecords != null) ?
                log("New records found");
                        newIccRecords.getClass().getName() : null));
                mIccRecords.set(newIccRecords);
                mIccRecords.set(newIccRecords);
                newIccRecords.registerForRecordsLoaded(
                newIccRecords.registerForRecordsLoaded(
                        this, DctConstants.EVENT_RECORDS_LOADED, null);
                        this, DctConstants.EVENT_RECORDS_LOADED, null);
            }
            }
            // Records changed -> return true
            result = true;
        }
        }
        return result;
    }
    }


    @Override
    @Override
Loading