diff options
author | Robert Greenwalt <robdroid@android.com> | 2010-06-06 12:10:00 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-06-06 12:10:00 -0700 |
commit | 9c4ed1394bb16b1d76758127a9b5d73bd363adaf (patch) | |
tree | 3f7f3f36ce1efa79e9072d312220e5ae2066ad71 /telephony | |
parent | fae5cb2b356a1fef172b43066180a7ab4c32dbac (diff) | |
parent | f9610b3842e030138c1dc327a3a467aaea02c227 (diff) | |
download | frameworks_base-9c4ed1394bb16b1d76758127a9b5d73bd363adaf.zip frameworks_base-9c4ed1394bb16b1d76758127a9b5d73bd363adaf.tar.gz frameworks_base-9c4ed1394bb16b1d76758127a9b5d73bd363adaf.tar.bz2 |
am f9610b38: Merge "Make the DUN apn data secure." into froyo
Merge commit 'f9610b3842e030138c1dc327a3a467aaea02c227' into kraken
* commit 'f9610b3842e030138c1dc327a3a467aaea02c227':
Make the DUN apn data secure.
Diffstat (limited to 'telephony')
-rw-r--r-- | telephony/java/com/android/internal/telephony/gsm/ApnSetting.java | 29 | ||||
-rw-r--r-- | telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java | 23 |
2 files changed, 52 insertions, 0 deletions
diff --git a/telephony/java/com/android/internal/telephony/gsm/ApnSetting.java b/telephony/java/com/android/internal/telephony/gsm/ApnSetting.java index 4cbfc87..05527af 100644 --- a/telephony/java/com/android/internal/telephony/gsm/ApnSetting.java +++ b/telephony/java/com/android/internal/telephony/gsm/ApnSetting.java @@ -55,6 +55,35 @@ public class ApnSetting { this.types = types; } + // data[0] = name + // data[1] = apn + // data[2] = proxy + // data[3] = port + // data[4] = username + // data[5] = password + // data[6] = server + // data[7] = mmsc + // data[8] = mmsproxy + // data[9] = mmsport + // data[10] = mcc + // data[11] = mnc + // data[12] = auth + // data[13] = first type... + public static ApnSetting fromString(String data) { + if (data == null) return null; + String[] a = data.split("\\s*,\\s*"); + if (a.length < 14) return null; + int authType = 0; + try { + authType = Integer.parseInt(a[12]); + } catch (Exception e) { + } + String[] typeArray = new String[a.length - 13]; + System.arraycopy(a, 13, typeArray, 0, a.length - 13); + return new ApnSetting(-1,a[10]+a[11],a[0],a[1],a[2],a[3],a[7],a[8], + a[9],a[4],a[5],authType,typeArray); + } + public String toString() { StringBuilder sb = new StringBuilder(); sb.append(carrier) diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java index 9bc0b26..f6d4491 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java @@ -48,6 +48,7 @@ import android.telephony.gsm.GsmCellLocation; import android.util.EventLog; import android.util.Log; +import com.android.internal.R; import com.android.internal.telephony.DataCallState; import com.android.internal.telephony.DataConnection; import com.android.internal.telephony.DataConnectionTracker; @@ -365,6 +366,10 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { @Override protected boolean isApnTypeAvailable(String type) { + if (type.equals(Phone.APN_TYPE_DUN)) { + return (fetchDunApn() != null); + } + if (allApns != null) { for (ApnSetting apn : allApns) { if (apn.canHandleType(type)) { @@ -1302,6 +1307,17 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { } } + private ApnSetting fetchDunApn() { + Context c = phone.getContext(); + String apnData = Settings.Secure.getString(c.getContentResolver(), + Settings.Secure.TETHER_DUN_APN); + ApnSetting dunSetting = ApnSetting.fromString(apnData); + if (dunSetting != null) return dunSetting; + + apnData = c.getResources().getString(R.string.config_tether_apndata); + return ApnSetting.fromString(apnData); + } + /** * * @return waitingApns list to be used to create PDP @@ -1309,6 +1325,13 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { */ private ArrayList<ApnSetting> buildWaitingApns() { ArrayList<ApnSetting> apnList = new ArrayList<ApnSetting>(); + + if (mRequestedApnType.equals(Phone.APN_TYPE_DUN)) { + ApnSetting dun = fetchDunApn(); + if (dun != null) apnList.add(dun); + return apnList; + } + String operator = mGsmPhone.mSIMRecords.getSIMOperatorNumeric(); if (mRequestedApnType.equals(Phone.APN_TYPE_DEFAULT)) { |