Skip to content

Commit 2a7b5ab

Browse files
Robert GreenwaltAndroid (Google) Code Review
authored andcommitted
Merge "Be careful sharing connections when dun is in play" into ics-mr1
2 parents 2f1e1e4 + 7cb88dd commit 2a7b5ab

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

telephony/java/com/android/internal/telephony/ApnSetting.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,11 @@ public boolean canHandleType(String type) {
189189
}
190190
return false;
191191
}
192+
193+
// TODO - if we have this function we should also have hashCode.
194+
// Also should handle changes in type order and perhaps case-insensitivity
195+
public boolean equals(Object o) {
196+
if (o instanceof ApnSetting == false) return false;
197+
return (this.toString().equals(o.toString()));
198+
}
192199
}

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1720,11 +1720,25 @@ private void applyNewState(ApnContext apnContext, boolean enabled, boolean met)
17201720
private DataConnection checkForConnectionForApnContext(ApnContext apnContext) {
17211721
// Loop through all apnContexts looking for one with a conn that satisfies this apnType
17221722
String apnType = apnContext.getApnType();
1723+
ApnSetting dunSetting = null;
1724+
1725+
if (Phone.APN_TYPE_DUN.equals(apnType)) {
1726+
dunSetting = fetchDunApn();
1727+
}
1728+
17231729
for (ApnContext c : mApnContexts.values()) {
17241730
DataConnection conn = c.getDataConnection();
17251731
if (conn != null) {
17261732
ApnSetting apnSetting = c.getApnSetting();
1727-
if (apnSetting != null && apnSetting.canHandleType(apnType)) {
1733+
if (dunSetting != null) {
1734+
if (dunSetting.equals(apnSetting)) {
1735+
if (DBG) {
1736+
log("checkForConnectionForApnContext: apnContext=" + apnContext +
1737+
" found conn=" + conn);
1738+
}
1739+
return conn;
1740+
}
1741+
} else if (apnSetting != null && apnSetting.canHandleType(apnType)) {
17281742
if (DBG) {
17291743
log("checkForConnectionForApnContext: apnContext=" + apnContext +
17301744
" found conn=" + conn);

0 commit comments

Comments
 (0)