diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-04-14 12:52:28 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-04-14 12:52:28 -0700 |
commit | ab6f5c6e86276602605382be73b8df2b08ed494d (patch) | |
tree | 812cb0a67dafe5518152f021085a1f9ce7508eba /telephony | |
parent | 407d69c82692ab6b0426c5680bb1c6e6ce6398ac (diff) | |
parent | 42ad56ead40f6c5986bd2d298b1d36f42da489a1 (diff) | |
download | frameworks_base-ab6f5c6e86276602605382be73b8df2b08ed494d.zip frameworks_base-ab6f5c6e86276602605382be73b8df2b08ed494d.tar.gz frameworks_base-ab6f5c6e86276602605382be73b8df2b08ed494d.tar.bz2 |
Merge change 142 into donut
* changes:
telephony: Add support for bringing up GSM data connections for GPS SUPL.
Diffstat (limited to 'telephony')
3 files changed, 29 insertions, 13 deletions
diff --git a/telephony/java/com/android/internal/telephony/Phone.java b/telephony/java/com/android/internal/telephony/Phone.java index 62949b0..3f210ca 100644 --- a/telephony/java/com/android/internal/telephony/Phone.java +++ b/telephony/java/com/android/internal/telephony/Phone.java @@ -113,9 +113,12 @@ public interface Phone { static final String APN_TYPE_DEFAULT = "default"; /** APN type for MMS traffic */ static final String APN_TYPE_MMS = "mms"; + /** APN type for SUPL assisted GPS */ + static final String APN_TYPE_SUPL = "supl"; // "Features" accessible through the connectivity manager static final String FEATURE_ENABLE_MMS = "enableMMS"; + static final String FEATURE_ENABLE_SUPL = "enableSUPL"; /** * Return codes for <code>enableApnType()</code> diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java index ed617ef..87e8b62 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java @@ -228,6 +228,9 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { Log.d(LOG_TAG, "Request to enableApnType("+type+")"); if (TextUtils.equals(type, Phone.APN_TYPE_MMS)) { return Phone.APN_ALREADY_ACTIVE; + } else if (TextUtils.equals(type, Phone.APN_TYPE_SUPL)) { + Log.w(LOG_TAG, "Phone.APN_TYPE_SUPL not enabled for CDMA"); + return Phone.APN_REQUEST_FAILED; } else { return Phone.APN_REQUEST_FAILED; } diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java index e2da7cb..1b07add 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java @@ -131,7 +131,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { private static int APN_DEFAULT_ID = 0; private static int APN_MMS_ID = 1; - private static int APN_NUM_TYPES = 2; + private static int APN_SUPL_ID = 2; + private static int APN_NUM_TYPES = 3; private boolean[] dataEnabled = new boolean[APN_NUM_TYPES]; @@ -322,8 +323,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { /** * Ensure that we are connected to an APN of the specified type. - * @param type the APN type (currently the only valid value - * is {@link Phone#APN_TYPE_MMS}) + * @param type the APN type (currently the only valid values + * are {@link Phone#APN_TYPE_MMS} and {@link Phone#APN_TYPE_SUPL}) * @return the result of the operation. Success is indicated by * a return value of either {@code Phone.APN_ALREADY_ACTIVE} or * {@code Phone.APN_REQUEST_STARTED}. In the latter case, a broadcast @@ -331,9 +332,11 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { * the APN has been established. */ protected int enableApnType(String type) { - if (!TextUtils.equals(type, Phone.APN_TYPE_MMS)) { + if (!TextUtils.equals(type, Phone.APN_TYPE_MMS) && + !TextUtils.equals(type, Phone.APN_TYPE_SUPL)) { return Phone.APN_REQUEST_FAILED; } + // If already active, return Log.d(LOG_TAG, "enableApnType("+type+")"); if (isApnTypeActive(type)) { @@ -371,7 +374,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { */ protected int disableApnType(String type) { Log.d(LOG_TAG, "disableApnType("+type+")"); - if (TextUtils.equals(type, Phone.APN_TYPE_MMS)) { + if (TextUtils.equals(type, Phone.APN_TYPE_MMS) || + TextUtils.equals(type, Phone.APN_TYPE_SUPL)) { removeMessages(EVENT_RESTORE_DEFAULT_APN); setEnabled(type, false); if (isApnTypeActive(Phone.APN_TYPE_DEFAULT)) { @@ -439,6 +443,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { return dataEnabled[APN_DEFAULT_ID]; } else if (TextUtils.equals(apnType, Phone.APN_TYPE_MMS)) { return dataEnabled[APN_MMS_ID]; + } else if (TextUtils.equals(apnType, Phone.APN_TYPE_SUPL)) { + return dataEnabled[APN_SUPL_ID]; } else { return false; } @@ -450,9 +456,12 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { dataEnabled[APN_DEFAULT_ID] = enable; } else if (TextUtils.equals(apnType, Phone.APN_TYPE_MMS)) { dataEnabled[APN_MMS_ID] = enable; + } else if (TextUtils.equals(apnType, Phone.APN_TYPE_SUPL)) { + dataEnabled[APN_SUPL_ID] = enable; } Log.d(LOG_TAG, "dataEnabled[DEFAULT_APN]=" + dataEnabled[APN_DEFAULT_ID] + - " dataEnabled[MMS_APN]=" + dataEnabled[APN_MMS_ID]); + " dataEnabled[MMS_APN]=" + dataEnabled[APN_MMS_ID] + + " dataEnabled[SUPL_APN]=" + dataEnabled[APN_SUPL_ID]); } /** @@ -476,13 +485,14 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { return trySetupData(Phone.REASON_DATA_ENABLED); } else if (!enable) { setEnabled(Phone.APN_TYPE_DEFAULT, false); - // Don't tear down if there is an active APN and it handles MMS. + // Don't tear down if there is an active APN and it handles MMS or SUPL. // TODO: This isn't very general. - if (!isApnTypeActive(Phone.APN_TYPE_MMS) || !isEnabled(Phone.APN_TYPE_MMS)) { - cleanUpConnection(true, Phone.REASON_DATA_DISABLED); - return true; + if ((isApnTypeActive(Phone.APN_TYPE_MMS) && isEnabled(Phone.APN_TYPE_MMS)) || + (isApnTypeActive(Phone.APN_TYPE_SUPL) && isEnabled(Phone.APN_TYPE_SUPL))) { + return false; } - return false; + cleanUpConnection(true, Phone.REASON_DATA_DISABLED); + return true; } else { // isEnabled && enable return true; @@ -513,7 +523,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { * {@code true} otherwise. */ public boolean getAnyDataEnabled() { - return dataEnabled[APN_DEFAULT_ID] || dataEnabled[APN_MMS_ID]; + return dataEnabled[APN_DEFAULT_ID] || dataEnabled[APN_MMS_ID] || dataEnabled[APN_SUPL_ID]; } /** @@ -1316,7 +1326,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { * rather an app that inadvertantly fails to reset to the * default APN, or that dies before doing so. */ - if (dataEnabled[APN_MMS_ID]) { + if (dataEnabled[APN_MMS_ID] || dataEnabled[APN_SUPL_ID]) { removeMessages(EVENT_RESTORE_DEFAULT_APN); sendMessageDelayed(obtainMessage(EVENT_RESTORE_DEFAULT_APN), getRestoreDefaultApnDelay()); |