Skip to content

Commit 2e2849a

Browse files
Wink SavilleAndroid (Google) Code Review
authored andcommitted
Merge "Empty DC's apnList when the DC is free." into jb-dev
2 parents 72404a8 + b44b13a commit 2e2849a

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -996,9 +996,23 @@ private ArrayList<ApnSetting> createApnList(Cursor cursor) {
996996
}
997997

998998
private boolean dataConnectionNotInUse(DataConnectionAc dcac) {
999+
if (DBG) log("dataConnectionNotInUse: check if dcac is inuse dc=" + dcac.dataConnection);
9991000
for (ApnContext apnContext : mApnContexts.values()) {
1000-
if (apnContext.getDataConnectionAc() == dcac) return false;
1001+
if (apnContext.getDataConnectionAc() == dcac) {
1002+
if (DBG) log("dataConnectionNotInUse: in use by apnContext=" + apnContext);
1003+
return false;
1004+
}
1005+
}
1006+
// TODO: Fix retry handling so free DataConnections have empty apnlists.
1007+
// Probably move retry handling into DataConnections and reduce complexity
1008+
// of DCT.
1009+
for (ApnContext apnContext : dcac.getApnListSync()) {
1010+
if (DBG) {
1011+
log("dataConnectionNotInUse: removing apnContext=" + apnContext);
1012+
}
1013+
dcac.removeApnContextSync(apnContext);
10011014
}
1015+
if (DBG) log("dataConnectionNotInUse: not in use return true");
10021016
return true;
10031017
}
10041018

@@ -2131,14 +2145,14 @@ protected void onDataSetupComplete(AsyncResult ar) {
21312145
protected void onDisconnectDone(int connId, AsyncResult ar) {
21322146
ApnContext apnContext = null;
21332147

2134-
if(DBG) log("onDisconnectDone: EVENT_DISCONNECT_DONE connId=" + connId);
21352148
if (ar.userObj instanceof ApnContext) {
21362149
apnContext = (ApnContext) ar.userObj;
21372150
} else {
2138-
loge("Invalid ar in onDisconnectDone");
2151+
loge("onDisconnectDone: Invalid ar in onDisconnectDone, ignore");
21392152
return;
21402153
}
21412154

2155+
if(DBG) log("onDisconnectDone: EVENT_DISCONNECT_DONE apnContext=" + apnContext);
21422156
apnContext.setState(State.IDLE);
21432157

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

0 commit comments

Comments
 (0)