Skip to content

Commit 8d27f20

Browse files
author
Robert Greenwalt
committed
Add a config to set Dun capabilities.
Since CDMA doesn't use APN settings there was no place to say what a cdma device's DUN connection would support, so by default normal device originating traffic would be blocked on a tethering single-connection device. With this change you can (via overlay) say that it supports everything so mms and on-device browsing/email will still work even when on a dun connection. The reason to allow both: some carriers will charge per byte for dun access and so they don't want lots of non-tethering traffic used (costs the user alot) but other carriers just use a dun connection to limit access to tethering, but once there give unlimited data, so it makes sense to support everything there. bug:5972599 Change-Id: I78fd7f3ac63c51a0560b659ed5ec219b10a93f8d
1 parent 08eb7dd commit 8d27f20

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

core/res/res/values/config.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,13 @@
227227
<item>4</item>
228228
</integer-array>
229229

230+
<!-- If the DUN connection for this CDMA device supports more than just DUN -->
231+
<!-- traffic you should list them here. -->
232+
<!-- If this device is not CDMA this is ignored. If this list is empty on -->
233+
<!-- a DUN-requiring CDMA device, the DUN APN will just support just DUN. -->
234+
<string-array translatable="false" name="config_cdma_dun_supported_types">
235+
</string-array>
236+
230237
<!-- String containing the apn value for tethering. May be overriden by secure settings
231238
TETHER_DUN_APN. Value is a comma separated series of strings:
232239
"name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"

telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
9393
Phone.APN_TYPE_MMS,
9494
Phone.APN_TYPE_HIPRI };
9595

96+
private String[] mDunApnTypes = {
97+
Phone.APN_TYPE_DUN };
98+
9699
private static final int mDefaultApnId = DataConnectionTracker.APN_DEFAULT_ID;
97100

98101
/* Constructor */
@@ -118,6 +121,21 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
118121

119122
createAllDataConnectionList();
120123
broadcastMessenger();
124+
125+
Context c = mCdmaPhone.getContext();
126+
String[] t = c.getResources().getStringArray(
127+
com.android.internal.R.array.config_cdma_dun_supported_types);
128+
if (t != null && t.length > 0) {
129+
ArrayList<String> temp = new ArrayList<String>();
130+
for(int i=0; i< t.length; i++) {
131+
if (!Phone.APN_TYPE_DUN.equalsIgnoreCase(t[i])) {
132+
temp.add(t[i]);
133+
}
134+
}
135+
temp.add(0, Phone.APN_TYPE_DUN);
136+
mDunApnTypes = temp.toArray(t);
137+
}
138+
121139
}
122140

123141
@Override
@@ -343,8 +361,7 @@ private boolean setupData(String reason) {
343361
String[] types;
344362
int apnId;
345363
if (mRequestedApnType.equals(Phone.APN_TYPE_DUN)) {
346-
types = new String[1];
347-
types[0] = Phone.APN_TYPE_DUN;
364+
types = mDunApnTypes;
348365
apnId = DataConnectionTracker.APN_DUN_ID;
349366
} else {
350367
types = mDefaultApnTypes;

0 commit comments

Comments
 (0)