From a43db7f48dd27e80d2eb54b58f1c7099cfa414be Mon Sep 17 00:00:00 2001 From: Kazuhiro Ondo Date: Wed, 13 Apr 2011 14:54:14 -0500 Subject: [PATCH] Clean up calls immediately if cid become inactive in unsol data state changed Do not perform extra data call list query. Just trust the message sent up from RIL. Change-Id: Ic03f5cc13ef05fe1de8fb5826fa37a68708e8e18 --- .../telephony/DataConnectionTracker.java | 1 - .../gsm/GsmDataConnectionTracker.java | 36 ++++++------------- 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java index a2c08edb97ad0..d26890349628e 100644 --- a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java @@ -97,7 +97,6 @@ public abstract class DataConnectionTracker extends Handler { protected static final int EVENT_TRY_SETUP_DATA = 5; protected static final int EVENT_DATA_STATE_CHANGED = 6; protected static final int EVENT_POLL_PDP = 7; - protected static final int EVENT_GET_PDP_LIST_COMPLETE = 11; protected static final int EVENT_RADIO_OFF_OR_NOT_AVAILABLE = 12; protected static final int EVENT_VOICE_CALL_STARTED = 14; protected static final int EVENT_VOICE_CALL_ENDED = 15; diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java index 1d0e0fc7d3f78..aa400853eef21 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java @@ -960,7 +960,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { * via an unsolicited response (which could have happened at any * previous state */ - private void onDataStateChanged (AsyncResult ar, boolean explicitPoll) { + private void onDataStateChanged (AsyncResult ar) { ArrayList dataCallStates; dataCallStates = (ArrayList)(ar.result); @@ -973,12 +973,11 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { } for (ApnContext apnContext : mApnContexts.values()) { - onDataStateChanged(dataCallStates, explicitPoll, apnContext); + onDataStateChanged(dataCallStates, apnContext); } } private void onDataStateChanged (ArrayList dataCallStates, - boolean explicitPoll, ApnContext apnContext) { if (apnContext == null) { @@ -1008,25 +1007,16 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { return; } else if (!dataCallStatesHasActiveCID(dataCallStates, apnContext.getDataConnection().getCid())) { - // Here, we only consider this authoritative if we asked for the - // PDP list. If it was an unsolicited response, we poll again - // to make sure everyone agrees on the initial state. - if (!explicitPoll) { - // We think it disconnected but aren't sure...poll from our side - mPhone.mCM.getPDPContextList( - this.obtainMessage(EVENT_GET_PDP_LIST_COMPLETE)); - } else { - Log.i(LOG_TAG, "PDP connection has dropped (active=false case). " + Log.i(LOG_TAG, "PDP connection has dropped (active=false case). " + " Reconnecting"); - // Log the network drop on the event log. - int cid = getCellLocationId(); - EventLog.writeEvent(EventLogTags.PDP_NETWORK_DROP, cid, - TelephonyManager.getDefault().getNetworkType()); + // Log the network drop on the event log. + int cid = getCellLocationId(); + EventLog.writeEvent(EventLogTags.PDP_NETWORK_DROP, cid, + TelephonyManager.getDefault().getNetworkType()); - cleanUpConnection(true, apnContext); - } + cleanUpConnection(true, apnContext); } } } @@ -1178,7 +1168,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { // It's possible the PDP context went down and we weren't notified. // Start polling the context list in an attempt to recover. if (DBG) log("no DATAIN in a while; polling PDP"); - mPhone.mCM.getDataCallList(obtainMessage(EVENT_GET_PDP_LIST_COMPLETE)); + mPhone.mCM.getDataCallList(obtainMessage(EVENT_DATA_STATE_CHANGED)); mNoRecvPollCount++; @@ -1613,7 +1603,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { protected void onPollPdp() { if (getOverallState() == State.CONNECTED) { // only poll when connected - mPhone.mCM.getPDPContextList(this.obtainMessage(EVENT_GET_PDP_LIST_COMPLETE)); + mPhone.mCM.getDataCallList(this.obtainMessage(EVENT_DATA_STATE_CHANGED)); sendMessageDelayed(obtainMessage(EVENT_POLL_PDP), POLL_PDP_MILLIS); } } @@ -1893,11 +1883,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { break; case EVENT_DATA_STATE_CHANGED: - onDataStateChanged((AsyncResult) msg.obj, false); - break; - - case EVENT_GET_PDP_LIST_COMPLETE: - onDataStateChanged((AsyncResult) msg.obj, true); + onDataStateChanged((AsyncResult) msg.obj); break; case EVENT_POLL_PDP: