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

Commit 5aea02db authored by Wink Saville's avatar Wink Saville Committed by Android (Google) Code Review
Browse files

Merge "Partial fix for b8022095"

parents ce282770 e65a7cd0
Loading
Loading
Loading
Loading
+34 −31
Original line number Diff line number Diff line
@@ -129,21 +129,19 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
    @Override
    protected void onActionIntentReconnectAlarm(Intent intent) {
        String reason = intent.getStringExtra(INTENT_RECONNECT_ALARM_EXTRA_REASON);
        int connectionId = intent.getIntExtra(INTENT_RECONNECT_ALARM_EXTRA_TYPE, -1);
        String apnType = intent.getStringExtra(INTENT_RECONNECT_ALARM_EXTRA_TYPE);
        int retryCount = intent.getIntExtra(INTENT_RECONNECT_ALARM_EXTRA_RETRY_COUNT, 0);

        DataConnectionAc dcac= mDataConnectionAsyncChannels.get(connectionId);
        ApnContext apnContext = mApnContexts.get(apnType);

        if (DBG) {
            log("onActionIntentReconnectAlarm: mState=" + mState + " reason=" + reason +
                    " connectionId=" + connectionId + " retryCount=" + retryCount + " dcac=" + dcac
                    + " mDataConnectionAsyncChannels=" + mDataConnectionAsyncChannels);
                    " retryCount=" + retryCount +
                    " apnType=" + apnType + " apnContext=" + apnContext +
                    " mDataConnectionAsyncChannels=" + mDataConnectionAsyncChannels);
        }

        if (dcac != null) {
            Collection<ApnContext> apnList = dcac.getApnListSync();
            if (DBG) log("onActionIntentReconnectAlarm: dcac.getApnListSync()=" + apnList);
            for (ApnContext apnContext : apnList) {
        if ((apnContext != null) && (apnContext.isEnabled())) {
            apnContext.setReason(reason);
            apnContext.setRetryCount(retryCount);
            DctConstants.State apnContextState = apnContext.getState();
@@ -159,16 +157,21 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
                apnContext.setDataConnection(null);
                apnContext.setState(DctConstants.State.IDLE);
            } else {
                    if (DBG) {
                        log("onActionIntentReconnectAlarm: keep associated");
                    }
                if (DBG) log("onActionIntentReconnectAlarm: keep associated");
            }
            // TODO: IF already associated should we send the EVENT_TRY_SETUP_DATA???
            sendMessage(obtainMessage(DctConstants.EVENT_TRY_SETUP_DATA, apnContext));
            }
            // Alram had expired. Clear pending intent recorded on the DataConnection.

            DataConnectionAc dcac = apnContext.getDataConnectionAc();
            if (dcac != null) {
                Collection<ApnContext> apnList = dcac.getApnListSync();
                log("onActionIntentReconnectAlarm: dcac.getApnListSync()=" + apnList);
                // Alarm had expired. Clear pending intent recorded on the DataConnection.
                // TODO: Maybe store in apnContext????
                dcac.setReconnectIntentSync(null);
            }
        }
    }

    /** Watches for changes to the APN db. */
    private ApnChangeObserver mApnObserver;
@@ -1472,8 +1475,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
                                   dcac.dataConnection.getDataConnectionId());
        String reason = apnContext.getReason();
        intent.putExtra(INTENT_RECONNECT_ALARM_EXTRA_REASON, reason);
        int connectionId = dcac.dataConnection.getDataConnectionId();
        intent.putExtra(INTENT_RECONNECT_ALARM_EXTRA_TYPE, connectionId);
        String apnType = apnContext.getApnType();
        intent.putExtra(INTENT_RECONNECT_ALARM_EXTRA_TYPE, apnType);

        // TODO: Until a real fix is created, which probably entails pushing
        // retires into the DC itself, this fix gets the retry count and
@@ -1487,7 +1490,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {

        if (DBG) {
            log("startAlarmForReconnect: next attempt in " + (delay / 1000) + "s" +
                    " reason='" + reason + "' connectionId=" + connectionId +
                    " reason='" + reason + "' apnType=" + apnType +
                    " retryCount=" + retryCount);
        }