diff options
author | Robert Greenwalt <rgreenwalt@google.com> | 2011-12-02 16:05:51 -0800 |
---|---|---|
committer | Robert Greenwalt <rgreenwalt@google.com> | 2011-12-02 16:42:18 -0800 |
commit | 7cb88dda5b9ee7c19f0f6c3c7a240eb1674fe2f4 (patch) | |
tree | e6af4a48ac6251049f5445ae855f7a0c3888556b /telephony | |
parent | 0433c157141b9122f6c61498e909770f1db27c7c (diff) | |
download | frameworks_base-7cb88dda5b9ee7c19f0f6c3c7a240eb1674fe2f4.zip frameworks_base-7cb88dda5b9ee7c19f0f6c3c7a240eb1674fe2f4.tar.gz frameworks_base-7cb88dda5b9ee7c19f0f6c3c7a240eb1674fe2f4.tar.bz2 |
Be careful sharing connections when dun is in play
A request for a DUN connection should only use the carriers requested dun connection. Don't
share another connection unless it matches the carriers settings.
bug:5701374
Change-Id: I75a65fcfce1b218bd9ca4ce2ab85cbe850813321
Diffstat (limited to 'telephony')
-rwxr-xr-x | telephony/java/com/android/internal/telephony/ApnSetting.java | 7 | ||||
-rw-r--r-- | telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java | 16 |
2 files changed, 22 insertions, 1 deletions
diff --git a/telephony/java/com/android/internal/telephony/ApnSetting.java b/telephony/java/com/android/internal/telephony/ApnSetting.java index 002ffad9..980bb49 100755 --- a/telephony/java/com/android/internal/telephony/ApnSetting.java +++ b/telephony/java/com/android/internal/telephony/ApnSetting.java @@ -189,4 +189,11 @@ public class ApnSetting { } return false; } + + // TODO - if we have this function we should also have hashCode. + // Also should handle changes in type order and perhaps case-insensitivity + public boolean equals(Object o) { + if (o instanceof ApnSetting == false) return false; + return (this.toString().equals(o.toString())); + } } diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java index de09dfb..11f1623 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java @@ -1720,11 +1720,25 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { private DataConnection checkForConnectionForApnContext(ApnContext apnContext) { // Loop through all apnContexts looking for one with a conn that satisfies this apnType String apnType = apnContext.getApnType(); + ApnSetting dunSetting = null; + + if (Phone.APN_TYPE_DUN.equals(apnType)) { + dunSetting = fetchDunApn(); + } + for (ApnContext c : mApnContexts.values()) { DataConnection conn = c.getDataConnection(); if (conn != null) { ApnSetting apnSetting = c.getApnSetting(); - if (apnSetting != null && apnSetting.canHandleType(apnType)) { + if (dunSetting != null) { + if (dunSetting.equals(apnSetting)) { + if (DBG) { + log("checkForConnectionForApnContext: apnContext=" + apnContext + + " found conn=" + conn); + } + return conn; + } + } else if (apnSetting != null && apnSetting.canHandleType(apnType)) { if (DBG) { log("checkForConnectionForApnContext: apnContext=" + apnContext + " found conn=" + conn); |