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

Commit f817e941 authored by Wink Saville's avatar Wink Saville Committed by Android Git Automerger
Browse files

am 2f143a96: Merge "Fix an RuntimeExcpetion in GsmDCT.onDataSetupComplete" into ics-mr1

* commit '2f143a96':
  Fix an RuntimeExcpetion in GsmDCT.onDataSetupComplete
parents 42e231bf 2f143a96
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -134,7 +134,8 @@ public abstract class DataConnection extends StateMachine {
        // specified here
        // specified here
        UNKNOWN(0x10000),
        UNKNOWN(0x10000),
        RADIO_NOT_AVAILABLE(0x10001),
        RADIO_NOT_AVAILABLE(0x10001),
        UNACCEPTABLE_NETWORK_PARAMETER(0x10002);
        UNACCEPTABLE_NETWORK_PARAMETER(0x10002),
        CONNECTION_TO_DATACONNECTIONAC_BROKEN(0x10003);


        private final int mErrorCode;
        private final int mErrorCode;
        private static final HashMap<Integer, FailCause> sErrorCodeToFailCauseMap;
        private static final HashMap<Integer, FailCause> sErrorCodeToFailCauseMap;
+64 −40
Original line number Original line Diff line number Diff line
@@ -76,6 +76,7 @@ import java.util.concurrent.ConcurrentHashMap;
 */
 */
public final class GsmDataConnectionTracker extends DataConnectionTracker {
public final class GsmDataConnectionTracker extends DataConnectionTracker {
    protected final String LOG_TAG = "GSM";
    protected final String LOG_TAG = "GSM";
    private static final boolean RADIO_TESTS = false;


    /**
    /**
     * Handles changes to the APN db.
     * Handles changes to the APN db.
@@ -1405,7 +1406,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
        sent = mDataStallTxRxSum.txPkts - preTxRxSum.txPkts;
        sent = mDataStallTxRxSum.txPkts - preTxRxSum.txPkts;
        received = mDataStallTxRxSum.rxPkts - preTxRxSum.rxPkts;
        received = mDataStallTxRxSum.rxPkts - preTxRxSum.rxPkts;


        if (VDBG) {
        if (RADIO_TESTS) {
            if (SystemProperties.getBoolean("radio.test.data.stall", false)) {
            if (SystemProperties.getBoolean("radio.test.data.stall", false)) {
                log("updateDataStallInfo: radio.test.data.stall true received = 0;");
                log("updateDataStallInfo: radio.test.data.stall true received = 0;");
                received = 0;
                received = 0;
@@ -1891,6 +1892,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
    @Override
    @Override
    protected void onDataSetupComplete(AsyncResult ar) {
    protected void onDataSetupComplete(AsyncResult ar) {


        DataConnection.FailCause cause = DataConnection.FailCause.UNKNOWN;
        boolean handleError = false;
        ApnContext apnContext = null;
        ApnContext apnContext = null;


        if(ar.userObj instanceof ApnContext){
        if(ar.userObj instanceof ApnContext){
@@ -1901,9 +1904,30 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {


        if (isDataSetupCompleteOk(ar)) {
        if (isDataSetupCompleteOk(ar)) {
            DataConnectionAc dcac = apnContext.getDataConnectionAc();
            DataConnectionAc dcac = apnContext.getDataConnectionAc();
            if (dcac == null) {

                throw new RuntimeException("onDataSetupCompete: No dcac");
            if (RADIO_TESTS) {
                // Note: To change radio.test.onDSC.null.dcac from command line you need to
                // adb root and adb remount and from the command line you can only change the
                // value to 1 once. To change it a second time you can reboot or execute
                // adb shell stop and then adb shell start. The command line to set the value is:
                //   adb shell sqlite3 /data/data/com.android.providers.settings/databases/settings.db "insert into system (name,value) values ('radio.test.onDSC.null.dcac', '1');"
                ContentResolver cr = mPhone.getContext().getContentResolver();
                String radioTestProperty = "radio.test.onDSC.null.dcac";
                if (Settings.System.getInt(cr, radioTestProperty, 0) == 1) {
                    log("onDataSetupComplete: " + radioTestProperty +
                            " is true, set dcac to null and reset property to false");
                    dcac = null;
                    Settings.System.putInt(cr, radioTestProperty, 0);
                    log("onDataSetupComplete: " + radioTestProperty + "=" +
                            Settings.System.getInt(mPhone.getContext().getContentResolver(),
                                    radioTestProperty, -1));
                }
                }
            }
            if (dcac == null) {
                log("onDataSetupComplete: no connection to DC, handle as error");
                cause = DataConnection.FailCause.CONNECTION_TO_DATACONNECTIONAC_BROKEN;
                handleError = true;
            } else {
                DataConnection dc = apnContext.getDataConnection();
                DataConnection dc = apnContext.getDataConnection();


                if (DBG) {
                if (DBG) {
@@ -1944,9 +1968,9 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
                    SystemProperties.set("gsm.defaultpdpcontext.active", "false");
                    SystemProperties.set("gsm.defaultpdpcontext.active", "false");
                }
                }
                notifyDefaultData(apnContext);
                notifyDefaultData(apnContext);
            }
        } else {
        } else {
            String apnString;
            String apnString;
            DataConnection.FailCause cause;


            cause = (DataConnection.FailCause) (ar.result);
            cause = (DataConnection.FailCause) (ar.result);
            if (DBG) {
            if (DBG) {
@@ -1974,7 +1998,10 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
                        apnContext.getWaitingApns().size(),
                        apnContext.getWaitingApns().size(),
                        apnContext.getWaitingApnsPermFailCount()));
                        apnContext.getWaitingApnsPermFailCount()));
            }
            }
            handleError = true;
        }


        if (handleError) {
            // See if there are more APN's to try
            // See if there are more APN's to try
            if (apnContext.getWaitingApns().isEmpty()) {
            if (apnContext.getWaitingApns().isEmpty()) {
                if (apnContext.getWaitingApnsPermFailCount() == 0) {
                if (apnContext.getWaitingApnsPermFailCount() == 0) {
@@ -1986,9 +2013,6 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {


                    apnContext.setDataConnection(null);
                    apnContext.setDataConnection(null);
                    apnContext.setDataConnectionAc(null);
                    apnContext.setDataConnectionAc(null);
                    if (DBG) {
                        log("onDataSetupComplete: permanent error apn=%s" + apnString );
                    }
                } else {
                } else {
                    if (DBG) log("onDataSetupComplete: Not all permanent failures, retry");
                    if (DBG) log("onDataSetupComplete: Not all permanent failures, retry");
                    // check to see if retry should be overridden for this failure.
                    // check to see if retry should be overridden for this failure.