@@ -175,7 +175,7 @@ protected void onActionIntentReconnectAlarm(Intent intent) {
175175
176176 public GsmDataConnectionTracker (PhoneBase p ) {
177177 super (p );
178-
178+ if ( DBG ) log ( "GsmDCT.constructor" );
179179 p .mCM .registerForAvailable (this , EVENT_RADIO_AVAILABLE , null );
180180 p .mCM .registerForOffOrNotAvailable (this , EVENT_RADIO_OFF_OR_NOT_AVAILABLE , null );
181181 p .mIccRecords .registerForRecordsLoaded (this , EVENT_RECORDS_LOADED , null );
@@ -212,6 +212,7 @@ public GsmDataConnectionTracker(PhoneBase p) {
212212
213213 @ Override
214214 public void dispose () {
215+ if (DBG ) log ("GsmDCT.dispose" );
215216 cleanUpAllConnections (false , null );
216217
217218 super .dispose ();
@@ -835,10 +836,11 @@ private void cleanUpConnection(boolean tearDown, ApnContext apnContext) {
835836 return ;
836837 }
837838
839+ DataConnectionAc dcac = apnContext .getDataConnectionAc ();
838840 if (DBG ) {
839- log ("cleanUpConnection: tearDown=" + tearDown + " reason=" + apnContext .getReason ());
841+ log ("cleanUpConnection: E tearDown=" + tearDown + " reason=" + apnContext .getReason () +
842+ " apnContext=" + apnContext );
840843 }
841- DataConnectionAc dcac = apnContext .getDataConnectionAc ();
842844 if (tearDown ) {
843845 if (apnContext .isDisconnected ()) {
844846 // The request is tearDown and but ApnContext is not connected.
@@ -901,6 +903,10 @@ private void cleanUpConnection(boolean tearDown, ApnContext apnContext) {
901903 cancelReconnectAlarm (dcac );
902904 }
903905 }
906+ if (DBG ) {
907+ log ("cleanUpConnection: X tearDown=" + tearDown + " reason=" + apnContext .getReason () +
908+ " apnContext=" + apnContext + " dc=" + apnContext .getDataConnection ());
909+ }
904910 }
905911
906912 /**
@@ -986,29 +992,39 @@ private boolean dataConnectionNotInUse(DataConnectionAc dcac) {
986992 private GsmDataConnection findFreeDataConnection () {
987993 for (DataConnectionAc dcac : mDataConnectionAsyncChannels .values ()) {
988994 if (dcac .isInactiveSync () && dataConnectionNotInUse (dcac )) {
989- log ("findFreeDataConnection: found free GsmDataConnection" );
990- return (GsmDataConnection ) dcac .dataConnection ;
995+ DataConnection dc = dcac .dataConnection ;
996+ if (DBG ) {
997+ log ("findFreeDataConnection: found free GsmDataConnection=" +
998+ " dcac=" + dcac + " dc=" + dc );
999+ }
1000+ return (GsmDataConnection ) dc ;
9911001 }
9921002 }
9931003 log ("findFreeDataConnection: NO free GsmDataConnection" );
9941004 return null ;
9951005 }
9961006
9971007 protected GsmDataConnection findReadyDataConnection (ApnSetting apn ) {
998- if (DBG )
999- log ("findReadyDataConnection: apn string <" +
1000- (apn !=null ?(apn .toString ()):"null" ) +">" );
10011008 if (apn == null ) {
10021009 return null ;
10031010 }
1011+ if (DBG ) {
1012+ log ("findReadyDataConnection: apn string <" + apn + ">" +
1013+ " dcacs.size=" + mDataConnectionAsyncChannels .size ());
1014+ }
10041015 for (DataConnectionAc dcac : mDataConnectionAsyncChannels .values ()) {
10051016 ApnSetting apnSetting = dcac .getApnSettingSync ();
10061017 if (DBG ) {
10071018 log ("findReadyDataConnection: dc apn string <" +
10081019 (apnSetting != null ? (apnSetting .toString ()) : "null" ) + ">" );
10091020 }
10101021 if ((apnSetting != null ) && TextUtils .equals (apnSetting .toString (), apn .toString ())) {
1011- return (GsmDataConnection ) dcac .dataConnection ;
1022+ DataConnection dc = dcac .dataConnection ;
1023+ if (DBG ) {
1024+ log ("findReadyDataConnection: found ready GsmDataConnection=" +
1025+ " dcac=" + dcac + " dc=" + dc );
1026+ }
1027+ return (GsmDataConnection ) dc ;
10121028 }
10131029 }
10141030 return null ;
@@ -1129,6 +1145,8 @@ private DataConnectionAc findDataConnectionAcByCid(int cid) {
11291145 private List <ApnContext > findApnContextToClean (Collection <DataConnectionAc > dcacs ) {
11301146 if (dcacs == null ) return null ;
11311147
1148+ if (DBG ) log ("findApnContextToClean(ar): E dcacs=" + dcacs );
1149+
11321150 ArrayList <ApnContext > list = new ArrayList <ApnContext >();
11331151 for (ApnContext apnContext : mApnContexts .values ()) {
11341152 if (apnContext .getState () == State .CONNECTED ) {
@@ -1144,7 +1162,7 @@ private List<ApnContext> findApnContextToClean(Collection<DataConnectionAc> dcac
11441162 // ApnContext does not have dcac reported in data call list.
11451163 // Fetch all the ApnContexts that map to this dcac which are in
11461164 // INITING state too.
1147- if (DBG ) log ("onDataStateChanged (ar): Connected apn not found in the list (" +
1165+ if (DBG ) log ("findApnContextToClean (ar): Connected apn not found in the list (" +
11481166 apnContext .toString () + ")" );
11491167 if (apnContext .getDataConnectionAc () != null ) {
11501168 list .addAll (apnContext .getDataConnectionAc ().getApnListSync ());
@@ -1154,6 +1172,7 @@ private List<ApnContext> findApnContextToClean(Collection<DataConnectionAc> dcac
11541172 }
11551173 }
11561174 }
1175+ if (DBG ) log ("findApnContextToClean(ar): X list=" + list );
11571176 return list ;
11581177 }
11591178
@@ -1236,6 +1255,10 @@ private void onDataStateChanged (AsyncResult ar) {
12361255 // If the same address type was removed and added we need to cleanup
12371256 CompareResult <LinkAddress > car =
12381257 result .oldLp .compareAddresses (result .newLp );
1258+ if (DBG ) {
1259+ log ("onDataStateChanged: oldLp=" + result .oldLp +
1260+ " newLp=" + result .newLp + " car=" + car );
1261+ }
12391262 boolean needToClean = false ;
12401263 for (LinkAddress added : car .added ) {
12411264 for (LinkAddress removed : car .removed ) {
@@ -1249,7 +1272,8 @@ private void onDataStateChanged (AsyncResult ar) {
12491272 if (needToClean ) {
12501273 if (DBG ) {
12511274 log ("onDataStateChanged(ar): addr change, cleanup apns=" +
1252- connectedApns );
1275+ connectedApns + " oldLp=" + result .oldLp +
1276+ " newLp=" + result .newLp );
12531277 }
12541278 apnsToCleanup .addAll (connectedApns );
12551279 } else {
@@ -1285,6 +1309,7 @@ private void onDataStateChanged (AsyncResult ar) {
12851309 }
12861310
12871311 // Cleanup those dropped connections
1312+ if (DBG ) log ("onDataStateChange(ar): apnsToCleanup=" + apnsToCleanup );
12881313 for (ApnContext apnContext : apnsToCleanup ) {
12891314 cleanUpConnection (true , apnContext );
12901315 }
@@ -2256,7 +2281,7 @@ private GsmDataConnection createDataConnection() {
22562281 filter .addAction (INTENT_RECONNECT_ALARM + '.' + id );
22572282 mPhone .getContext ().registerReceiver (mIntentReceiver , filter , null , mPhone );
22582283
2259- if (DBG ) log ("createDataConnection() X id=" + id );
2284+ if (DBG ) log ("createDataConnection() X id=" + id + " dc=" + conn );
22602285 return conn ;
22612286 }
22622287
0 commit comments