diff options
Diffstat (limited to 'telephony')
5 files changed, 68 insertions, 23 deletions
diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index 50c4d41..06b5c26 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -83,6 +83,12 @@ public class ServiceState implements Parcelable { public static final int RADIO_TECHNOLOGY_EVDO_0 = 7; /** @hide */ public static final int RADIO_TECHNOLOGY_EVDO_A = 8; + /** @hide */ + public static final int RADIO_TECHNOLOGY_HSDPA = 9; + /** @hide */ + public static final int RADIO_TECHNOLOGY_HSUPA = 10; + /** @hide */ + public static final int RADIO_TECHNOLOGY_HSPA = 11; /** * Available registration states for GSM, UMTS and CDMA. @@ -366,6 +372,15 @@ public class ServiceState implements Parcelable { case 8: radioTechnology = "EvDo rev. A"; break; + case 9: + radioTechnology = "HSDPA"; + break; + case 10: + radioTechnology = "HSUPA"; + break; + case 11: + radioTechnology = "HSPA"; + break; default: Log.w(LOG_TAG, "mRadioTechnology variable out of range."); break; diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index ed9af66..f3304a3 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -382,6 +382,15 @@ public class TelephonyManager { /** Current network is 1xRTT*/ /** @hide */ public static final int NETWORK_TYPE_1xRTT = 7; + /** Current network is HSDPA */ + /** @hide */ + public static final int NETWORK_TYPE_HSDPA = 8; + /** Current network is HSUPA */ + /** @hide */ + public static final int NETWORK_TYPE_HSUPA = 9; + /** Current network is HSPA */ + /** @hide */ + public static final int NETWORK_TYPE_HSPA = 10; /** * Returns a constant indicating the radio technology (network type) @@ -392,35 +401,25 @@ public class TelephonyManager { * @see #NETWORK_TYPE_GPRS * @see #NETWORK_TYPE_EDGE * @see #NETWORK_TYPE_UMTS + * @see #NETWORK_TYPE_HSDPA + * @see #NETWORK_TYPE_HSUPA + * @see #NETWORK_TYPE_HSPA * @see #NETWORK_TYPE_CDMA * @see #NETWORK_TYPE_EVDO_0 * @see #NETWORK_TYPE_EVDO_A * @see #NETWORK_TYPE_1xRTT */ public int getNetworkType() { - String prop = SystemProperties.get(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE); - if ("GPRS".equals(prop)) { - return NETWORK_TYPE_GPRS; - } - else if ("EDGE".equals(prop)) { - return NETWORK_TYPE_EDGE; - } - else if ("UMTS".equals(prop)) { - return NETWORK_TYPE_UMTS; - } - else if ("CDMA".equals(prop)) { - return NETWORK_TYPE_CDMA; - } - else if ("CDMA - EvDo rev. 0".equals(prop)) { - return NETWORK_TYPE_EVDO_0; - } - else if ("CDMA - EvDo rev. A".equals(prop)) { - return NETWORK_TYPE_EVDO_A; - } - else if ("CDMA - 1xRTT".equals(prop)) { - return NETWORK_TYPE_1xRTT; + try{ + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony.getNetworkType(); + } else { + // This can happen when the ITelephony interface is not up yet. + return NETWORK_TYPE_UNKNOWN; } - else { + } catch(RemoteException ex){ + // This shouldn't happen in the normal case return NETWORK_TYPE_UNKNOWN; } } @@ -440,6 +439,12 @@ public class TelephonyManager { return "EDGE"; case NETWORK_TYPE_UMTS: return "UMTS"; + case NETWORK_TYPE_HSDPA: + return "HSDPA"; + case NETWORK_TYPE_HSUPA: + return "HSUPA"; + case NETWORK_TYPE_HSPA: + return "HSPA"; case NETWORK_TYPE_CDMA: return "CDMA"; case NETWORK_TYPE_EVDO_0: diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index d83b135..cac4de9 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -243,5 +243,9 @@ interface ITelephony { */ int getVoiceMessageCount(); + /** + * Returns the network type + */ + int getNetworkType(); } diff --git a/telephony/java/com/android/internal/telephony/ServiceStateTracker.java b/telephony/java/com/android/internal/telephony/ServiceStateTracker.java index 39806e9..c74bb8d 100644 --- a/telephony/java/com/android/internal/telephony/ServiceStateTracker.java +++ b/telephony/java/com/android/internal/telephony/ServiceStateTracker.java @@ -34,6 +34,14 @@ public abstract class ServiceStateTracker extends Handler { * 1 = GPRS only * 2 = EDGE * 3 = UMTS + * 4 = IS95A + * 5 = IS95B + * 6 = 1xRTT + * 7 = EvDo_0 + * 8 = EvDo_A + * 9 = HSDPA + * 10 = HSUPA + * 11 = HSPA */ protected static final int DATA_ACCESS_UNKNOWN = 0; protected static final int DATA_ACCESS_GPRS = 1; @@ -44,6 +52,9 @@ public abstract class ServiceStateTracker extends Handler { protected static final int DATA_ACCESS_CDMA_1xRTT = 6; protected static final int DATA_ACCESS_CDMA_EvDo_0 = 7; protected static final int DATA_ACCESS_CDMA_EvDo_A = 8; + protected static final int DATA_ACCESS_HSDPA = 9; + protected static final int DATA_ACCESS_HSUPA = 10; + protected static final int DATA_ACCESS_HSPA = 11; //***** Instance Variables protected CommandsInterface cm; diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java index 0c040e6..e7406e2 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java @@ -677,6 +677,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker { newGPRSState = regCodeToServiceState(regState); newDataRoaming = regCodeIsRoaming(regState); newNetworkType = type; + newSS.setRadioTechnology(type); break; case EVENT_POLL_STATE_OPERATOR: @@ -810,6 +811,15 @@ final class GsmServiceStateTracker extends ServiceStateTracker { case DATA_ACCESS_UMTS: ret = "UMTS"; break; + case DATA_ACCESS_HSDPA: + ret = "HSDPA"; + break; + case DATA_ACCESS_HSUPA: + ret = "HSUPA"; + break; + case DATA_ACCESS_HSPA: + ret = "HSPA"; + break; default: Log.e(LOG_TAG, "Wrong network type: " + Integer.toString(type)); break; @@ -1288,7 +1298,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker { * that could support voice and data simultaniously. */ boolean isConcurrentVoiceAndData() { - return (networkType == DATA_ACCESS_UMTS); + return (networkType >= DATA_ACCESS_UMTS); } /** |