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

Commit 77c94113 authored by Kazuhiro Ondo's avatar Kazuhiro Ondo Committed by Wink Saville
Browse files

Data recovery failure due to apn/dc state stuck in "disconnecting"

If rild is reset while RIL_DEACTIVATE_DATA_CALL is pending
response, the ApnContext is not force cleaned up since
link to DCAC is cleared in the begining of release.

This patch fixes:
1) Hold DCAC reference until the DC is disconnected. This is
   to ensure DC won't be stuck in DcDisconnectingState so force
   reset can kick in.
2) In "clearCleanUpConnection", make sure the status of ApnContext
   can be reset to IDLE even if no reference to DCAC.

Change-Id: Ic69271da7c6bc9dcb2c38ec53a9bd2e8ce785adc
parent f5699b82
Loading
Loading
Loading
Loading
+15 −39
Original line number Diff line number Diff line
@@ -608,33 +608,6 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
        return allowed;
    }

    /**
     * Release the apnContext
     *
     * @param apnContext
     * @param tearDown
     * @return none
     */
    private void releaseApnContext(ApnContext apnContext, boolean tearDown) {
        if (apnContext == null) {
            if (DBG) loge("releaseApnContext: apnContext null should not happen, ignore");
            return;
        }
        DataConnection dc = apnContext.getDataConnection();
        if (dc == null) {
            if (DBG) loge("releaseApnContext: apnContext dc == null should not happen, ignore");
            return;
        }
        if (tearDown) {
            if (DBG) log("releaseApnContext: tearing down");
            Message msg = obtainMessage(EVENT_DISCONNECT_DONE, apnContext);
            apnContext.getDataConnection().tearDown(apnContext.getReason(), msg);
        }
        apnContext.setDataConnection(null);
        apnContext.setDataConnectionAc(null);
        return;
    }

    private void setupDataOnReadyApns(String reason) {
        // Only check for default APN state
        for (ApnContext apnContext : mApnContexts.values()) {
@@ -803,19 +776,19 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
        }

        DataConnectionAc dcac = apnContext.getDataConnectionAc();
        if (dcac != null) {
            if (tearDown) {
        if (tearDown && (dcac != null)) {
            if (DBG) log("cleanUpConnection: tearing down");
            Message msg = obtainMessage(EVENT_DISCONNECT_DONE, apnContext);
            apnContext.getDataConnection().tearDown(apnContext.getReason(), msg);
            apnContext.setState(State.DISCONNECTING);
                releaseApnContext(apnContext, tearDown);
        } else {
                dcac.resetSync();
            if (dcac != null) dcac.resetSync();
            apnContext.setState(State.IDLE);
            mPhone.notifyDataConnection(apnContext.getReason(), apnContext.getApnType());
            apnContext.setDataConnection(null);
            apnContext.setDataConnectionAc(null);
        }
    }
    }

    /**
     * @param APNContext to clean
@@ -1704,7 +1677,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
                    apnContext.setState(State.FAILED);
                    mPhone.notifyDataConnection(Phone.REASON_APN_FAILED, apnContext.getApnType());

                    releaseApnContext(apnContext, false);
                    apnContext.setDataConnection(null);
                    apnContext.setDataConnectionAc(null);
                    if (DBG) {
                        log("onDataSetupComplete: permanent error apn=%s" + apnString );
                    }
@@ -1739,6 +1713,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {

        apnContext.setState(State.IDLE);
        apnContext.setApnSetting(null);
        apnContext.setDataConnection(null);
        apnContext.setDataConnectionAc(null);

        mPhone.notifyDataConnection(apnContext.getReason(), apnContext.getApnType());