am 1bf518d8: Merge "Add TelephonyManager.getCurrentPhoneType" into honeycomb
* commit '1bf518d8b333768e26bacf340f88f7d4ba8b9a91': Add TelephonyManager.getCurrentPhoneType
This commit is contained in:
@@ -1781,7 +1781,7 @@ public class AccountManagerService
|
|||||||
// will return a different value, but we *don't* erase the
|
// will return a different value, but we *don't* erase the
|
||||||
// passwords. We only erase them if it has a different
|
// passwords. We only erase them if it has a different
|
||||||
// subscriber ID once it's provisioned.
|
// subscriber ID once it's provisioned.
|
||||||
if (telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) {
|
if (telephonyManager.getCurrentPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) {
|
||||||
IBinder service = ServiceManager.checkService(Context.TELEPHONY_SERVICE);
|
IBinder service = ServiceManager.checkService(Context.TELEPHONY_SERVICE);
|
||||||
if (service == null) {
|
if (service == null) {
|
||||||
Log.w(TAG, "call to checkService(TELEPHONY_SERVICE) failed");
|
Log.w(TAG, "call to checkService(TELEPHONY_SERVICE) failed");
|
||||||
|
|||||||
@@ -61,9 +61,9 @@ public abstract class CellLocation {
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static CellLocation newFromBundle(Bundle bundle) {
|
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.
|
// ITelephony interface is not up yet.
|
||||||
switch(TelephonyManager.getDefault().getPhoneType()) {
|
switch(TelephonyManager.getDefault().getCurrentPhoneType()) {
|
||||||
case Phone.PHONE_TYPE_CDMA:
|
case Phone.PHONE_TYPE_CDMA:
|
||||||
return new CdmaCellLocation(bundle);
|
return new CdmaCellLocation(bundle);
|
||||||
case Phone.PHONE_TYPE_GSM:
|
case Phone.PHONE_TYPE_GSM:
|
||||||
@@ -89,9 +89,9 @@ public abstract class CellLocation {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static CellLocation getEmpty() {
|
public static CellLocation getEmpty() {
|
||||||
// TelephonyManager.getDefault().getPhoneType() handles the case when
|
// TelephonyManager.getDefault().getCurrentPhoneType() handles the case when
|
||||||
// ITelephony interface is not up yet.
|
// ITelephony interface is not up yet.
|
||||||
switch(TelephonyManager.getDefault().getPhoneType()) {
|
switch(TelephonyManager.getDefault().getCurrentPhoneType()) {
|
||||||
case Phone.PHONE_TYPE_CDMA:
|
case Phone.PHONE_TYPE_CDMA:
|
||||||
return new CdmaCellLocation();
|
return new CdmaCellLocation();
|
||||||
case Phone.PHONE_TYPE_GSM:
|
case Phone.PHONE_TYPE_GSM:
|
||||||
|
|||||||
@@ -276,19 +276,18 @@ public class TelephonyManager {
|
|||||||
public static final int PHONE_TYPE_SIP = Phone.PHONE_TYPE_SIP;
|
public static final int PHONE_TYPE_SIP = Phone.PHONE_TYPE_SIP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a constant indicating the device phone type. This
|
* Returns the current phone type.
|
||||||
* indicates the type of radio used to transmit voice calls.
|
* TODO: This is a last minute change and hence hidden.
|
||||||
*
|
*
|
||||||
* @see #PHONE_TYPE_NONE
|
* @see #PHONE_TYPE_NONE
|
||||||
* @see #PHONE_TYPE_GSM
|
* @see #PHONE_TYPE_GSM
|
||||||
* @see #PHONE_TYPE_CDMA
|
* @see #PHONE_TYPE_CDMA
|
||||||
* @see #PHONE_TYPE_SIP
|
* @see #PHONE_TYPE_SIP
|
||||||
|
*
|
||||||
|
* {@hide}
|
||||||
*/
|
*/
|
||||||
public int getPhoneType() {
|
public int getCurrentPhoneType() {
|
||||||
try{
|
try{
|
||||||
if (!isVoiceCapable()) {
|
|
||||||
return PHONE_TYPE_NONE;
|
|
||||||
}
|
|
||||||
ITelephony telephony = getITelephony();
|
ITelephony telephony = getITelephony();
|
||||||
if (telephony != null) {
|
if (telephony != null) {
|
||||||
return telephony.getActivePhoneType();
|
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() {
|
private int getPhoneTypeFromProperty() {
|
||||||
int type =
|
int type =
|
||||||
|
|||||||
Reference in New Issue
Block a user