diff options
author | Wink Saville <wink@google.com> | 2011-02-01 19:22:15 -0800 |
---|---|---|
committer | Wink Saville <wink@google.com> | 2011-02-01 19:22:15 -0800 |
commit | 9d72be33181f1bd1386017ce0b0ce17d8ce1cb66 (patch) | |
tree | a736c3b787235290dded5344e37150edf443c461 /telephony/java | |
parent | 3b8657debcbcf1bb4e66ac797d7ea15d737ecb42 (diff) | |
download | frameworks_base-9d72be33181f1bd1386017ce0b0ce17d8ce1cb66.zip frameworks_base-9d72be33181f1bd1386017ce0b0ce17d8ce1cb66.tar.gz frameworks_base-9d72be33181f1bd1386017ce0b0ce17d8ce1cb66.tar.bz2 |
Add TelephonyManager.getCurrentPhoneType
The new method getCurrentPhoneType has the old behavior of getPhoneType
and does not check for voice capable. This allows code to assume
the old behavior.
bug: 3198435
Change-Id: I0542838ceca2f757cceb6cd7f795e95fe886523e
Diffstat (limited to 'telephony/java')
-rw-r--r-- | telephony/java/android/telephony/CellLocation.java | 8 | ||||
-rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 26 |
2 files changed, 24 insertions, 10 deletions
diff --git a/telephony/java/android/telephony/CellLocation.java b/telephony/java/android/telephony/CellLocation.java index 2edfc23..5eaa5a0 100644 --- a/telephony/java/android/telephony/CellLocation.java +++ b/telephony/java/android/telephony/CellLocation.java @@ -61,9 +61,9 @@ public abstract class CellLocation { * @hide */ public static CellLocation newFromBundle(Bundle bundle) { - // TelephonyManager.getDefault().getPhoneType() handles the case when + // TelephonyManager.getDefault().getCurrentPhoneType() handles the case when // ITelephony interface is not up yet. - switch(TelephonyManager.getDefault().getPhoneType()) { + switch(TelephonyManager.getDefault().getCurrentPhoneType()) { case Phone.PHONE_TYPE_CDMA: return new CdmaCellLocation(bundle); case Phone.PHONE_TYPE_GSM: @@ -89,9 +89,9 @@ public abstract class CellLocation { * */ public static CellLocation getEmpty() { - // TelephonyManager.getDefault().getPhoneType() handles the case when + // TelephonyManager.getDefault().getCurrentPhoneType() handles the case when // ITelephony interface is not up yet. - switch(TelephonyManager.getDefault().getPhoneType()) { + switch(TelephonyManager.getDefault().getCurrentPhoneType()) { case Phone.PHONE_TYPE_CDMA: return new CdmaCellLocation(); case Phone.PHONE_TYPE_GSM: diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 01f2bae..b0f0a43 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -276,19 +276,18 @@ public class TelephonyManager { public static final int PHONE_TYPE_SIP = Phone.PHONE_TYPE_SIP; /** - * Returns a constant indicating the device phone type. This - * indicates the type of radio used to transmit voice calls. + * Returns the current phone type. + * TODO: This is a last minute change and hence hidden. * * @see #PHONE_TYPE_NONE * @see #PHONE_TYPE_GSM * @see #PHONE_TYPE_CDMA * @see #PHONE_TYPE_SIP + * + * {@hide} */ - public int getPhoneType() { + public int getCurrentPhoneType() { try{ - if (!isVoiceCapable()) { - return PHONE_TYPE_NONE; - } ITelephony telephony = getITelephony(); if (telephony != null) { return telephony.getActivePhoneType(); @@ -307,6 +306,21 @@ public class TelephonyManager { } } + /** + * Returns a constant indicating the device phone type. This + * indicates the type of radio used to transmit voice calls. + * + * @see #PHONE_TYPE_NONE + * @see #PHONE_TYPE_GSM + * @see #PHONE_TYPE_CDMA + * @see #PHONE_TYPE_SIP + */ + public int getPhoneType() { + if (!isVoiceCapable()) { + return PHONE_TYPE_NONE; + } + return getCurrentPhoneType(); + } private int getPhoneTypeFromProperty() { int type = |