am 3436eb81
: Merge change 26129 into eclair
Merge commit '3436eb81cdd52ed5bfeb64f3240bbeae6760c317' into eclair-plus-aosp * commit '3436eb81cdd52ed5bfeb64f3240bbeae6760c317': Add Phone.getPhoneType() operation.
This commit is contained in:
@ -125112,6 +125112,17 @@
|
|||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
</field>
|
</field>
|
||||||
|
<field name="PHONE_TYPE_CDMA"
|
||||||
|
type="int"
|
||||||
|
transient="false"
|
||||||
|
volatile="false"
|
||||||
|
value="2"
|
||||||
|
static="true"
|
||||||
|
final="true"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
</field>
|
||||||
<field name="PHONE_TYPE_GSM"
|
<field name="PHONE_TYPE_GSM"
|
||||||
type="int"
|
type="int"
|
||||||
transient="false"
|
transient="false"
|
||||||
|
@ -26,11 +26,10 @@ import android.provider.Settings;
|
|||||||
import android.telephony.cdma.CdmaCellLocation;
|
import android.telephony.cdma.CdmaCellLocation;
|
||||||
import android.telephony.gsm.GsmCellLocation;
|
import android.telephony.gsm.GsmCellLocation;
|
||||||
import com.android.internal.telephony.ITelephony;
|
import com.android.internal.telephony.ITelephony;
|
||||||
import com.android.internal.telephony.RILConstants;
|
import com.android.internal.telephony.Phone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract class that represents the location of the device. Currently the only
|
* Abstract class that represents the location of the device. {@more}
|
||||||
* subclass is {@link android.telephony.gsm.GsmCellLocation}. {@more}
|
|
||||||
*/
|
*/
|
||||||
public abstract class CellLocation {
|
public abstract class CellLocation {
|
||||||
|
|
||||||
@ -64,11 +63,13 @@ public abstract class CellLocation {
|
|||||||
public static CellLocation newFromBundle(Bundle bundle) {
|
public static CellLocation newFromBundle(Bundle bundle) {
|
||||||
// TelephonyManager.getDefault().getPhoneType() handles the case when
|
// TelephonyManager.getDefault().getPhoneType() handles the case when
|
||||||
// ITelephony interface is not up yet.
|
// ITelephony interface is not up yet.
|
||||||
int type = TelephonyManager.getDefault().getPhoneType();
|
switch(TelephonyManager.getDefault().getPhoneType()) {
|
||||||
if (type == RILConstants.CDMA_PHONE) {
|
case Phone.PHONE_TYPE_CDMA:
|
||||||
return new CdmaCellLocation(bundle);
|
return new CdmaCellLocation(bundle);
|
||||||
} else {
|
case Phone.PHONE_TYPE_GSM:
|
||||||
return new GsmCellLocation(bundle);
|
return new GsmCellLocation(bundle);
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,17 +79,20 @@ public abstract class CellLocation {
|
|||||||
public abstract void fillInNotifierBundle(Bundle bundle);
|
public abstract void fillInNotifierBundle(Bundle bundle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a new CellLocation object representing an unknown location.
|
* Return a new CellLocation object representing an unknown
|
||||||
|
* location, or null for unknown/none phone radio types.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static CellLocation getEmpty() {
|
public static CellLocation getEmpty() {
|
||||||
// TelephonyManager.getDefault().getPhoneType() handles the case when
|
// TelephonyManager.getDefault().getPhoneType() handles the case when
|
||||||
// ITelephony interface is not up yet.
|
// ITelephony interface is not up yet.
|
||||||
int type = TelephonyManager.getDefault().getPhoneType();
|
switch(TelephonyManager.getDefault().getPhoneType()) {
|
||||||
if (type == RILConstants.CDMA_PHONE) {
|
case Phone.PHONE_TYPE_CDMA:
|
||||||
return new CdmaCellLocation();
|
return new CdmaCellLocation();
|
||||||
} else {
|
case Phone.PHONE_TYPE_GSM:
|
||||||
return new GsmCellLocation();
|
return new GsmCellLocation();
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -263,22 +263,12 @@ public class TelephonyManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** No phone radio. */
|
||||||
* No phone module
|
public static final int PHONE_TYPE_NONE = Phone.PHONE_TYPE_NONE;
|
||||||
*
|
/** Phone radio is GSM. */
|
||||||
*/
|
public static final int PHONE_TYPE_GSM = Phone.PHONE_TYPE_GSM;
|
||||||
public static final int PHONE_TYPE_NONE = RILConstants.NO_PHONE;
|
/** Phone radio is CDMA. */
|
||||||
|
public static final int PHONE_TYPE_CDMA = Phone.PHONE_TYPE_CDMA;
|
||||||
/**
|
|
||||||
* GSM phone
|
|
||||||
*/
|
|
||||||
public static final int PHONE_TYPE_GSM = RILConstants.GSM_PHONE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CDMA phone
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
public static final int PHONE_TYPE_CDMA = RILConstants.CDMA_PHONE;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a constant indicating the device phone type.
|
* Returns a constant indicating the device phone type.
|
||||||
@ -291,11 +281,7 @@ public class TelephonyManager {
|
|||||||
try{
|
try{
|
||||||
ITelephony telephony = getITelephony();
|
ITelephony telephony = getITelephony();
|
||||||
if (telephony != null) {
|
if (telephony != null) {
|
||||||
if(telephony.getActivePhoneType() == RILConstants.CDMA_PHONE) {
|
return telephony.getActivePhoneType();
|
||||||
return PHONE_TYPE_CDMA;
|
|
||||||
} else {
|
|
||||||
return PHONE_TYPE_GSM;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// This can happen when the ITelephony interface is not up yet.
|
// This can happen when the ITelephony interface is not up yet.
|
||||||
return getPhoneTypeFromProperty();
|
return getPhoneTypeFromProperty();
|
||||||
|
@ -676,7 +676,7 @@ public abstract class BaseCommands implements CommandsInterface {
|
|||||||
mRadioTechnologyChangedRegistrants.notifyRegistrants();
|
mRadioTechnologyChangedRegistrants.notifyRegistrants();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mState.isGsm() && !oldState.isOn() && (mPhoneType == RILConstants.CDMA_PHONE)) {
|
if (mState.isGsm() && !oldState.isOn() && (mPhoneType == Phone.PHONE_TYPE_CDMA)) {
|
||||||
Log.d(LOG_TAG,"Notifying: radio technology change CDMA OFF to GSM");
|
Log.d(LOG_TAG,"Notifying: radio technology change CDMA OFF to GSM");
|
||||||
mRadioTechnologyChangedRegistrants.notifyRegistrants();
|
mRadioTechnologyChangedRegistrants.notifyRegistrants();
|
||||||
}
|
}
|
||||||
@ -686,7 +686,7 @@ public abstract class BaseCommands implements CommandsInterface {
|
|||||||
mRadioTechnologyChangedRegistrants.notifyRegistrants();
|
mRadioTechnologyChangedRegistrants.notifyRegistrants();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mState.isCdma() && !oldState.isOn() && (mPhoneType == RILConstants.GSM_PHONE)) {
|
if (mState.isCdma() && !oldState.isOn() && (mPhoneType == Phone.PHONE_TYPE_GSM)) {
|
||||||
Log.d(LOG_TAG,"Notifying: radio technology change GSM OFF to CDMA");
|
Log.d(LOG_TAG,"Notifying: radio technology change GSM OFF to CDMA");
|
||||||
mRadioTechnologyChangedRegistrants.notifyRegistrants();
|
mRadioTechnologyChangedRegistrants.notifyRegistrants();
|
||||||
}
|
}
|
||||||
|
@ -1256,6 +1256,7 @@ public interface CommandsInterface {
|
|||||||
|
|
||||||
/** Set the Phone type created */
|
/** Set the Phone type created */
|
||||||
void setPhoneType(int phoneType);
|
void setPhoneType(int phoneType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query the CDMA roaming preference setting
|
* Query the CDMA roaming preference setting
|
||||||
*
|
*
|
||||||
|
@ -173,6 +173,11 @@ public interface Phone {
|
|||||||
static final int BM_AUS2_BAND = 5; // GSM-900 / DCS-1800 / WCDMA-850
|
static final int BM_AUS2_BAND = 5; // GSM-900 / DCS-1800 / WCDMA-850
|
||||||
static final int BM_BOUNDARY = 6; // upper band boundary
|
static final int BM_BOUNDARY = 6; // upper band boundary
|
||||||
|
|
||||||
|
// Radio Type
|
||||||
|
static final int PHONE_TYPE_NONE = RILConstants.NO_PHONE;
|
||||||
|
static final int PHONE_TYPE_GSM = RILConstants.GSM_PHONE;
|
||||||
|
static final int PHONE_TYPE_CDMA = RILConstants.CDMA_PHONE;
|
||||||
|
|
||||||
// Used for preferred network type
|
// Used for preferred network type
|
||||||
// Note NT_* substitute RILConstants.NETWORK_MODE_* above the Phone
|
// Note NT_* substitute RILConstants.NETWORK_MODE_* above the Phone
|
||||||
int NT_MODE_WCDMA_PREF = RILConstants.NETWORK_MODE_WCDMA_PREF;
|
int NT_MODE_WCDMA_PREF = RILConstants.NETWORK_MODE_WCDMA_PREF;
|
||||||
@ -287,6 +292,12 @@ public interface Phone {
|
|||||||
*/
|
*/
|
||||||
String getPhoneName();
|
String getPhoneName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a numerical identifier for the phone radio interface.
|
||||||
|
* @return PHONE_TYPE_XXX as defined above.
|
||||||
|
*/
|
||||||
|
int getPhoneType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of string identifiers for the APN types serviced by the
|
* Returns an array of string identifiers for the APN types serviced by the
|
||||||
* currently active or last connected APN.
|
* currently active or last connected APN.
|
||||||
|
@ -740,6 +740,8 @@ public abstract class PhoneBase extends Handler implements Phone {
|
|||||||
|
|
||||||
public abstract String getPhoneName();
|
public abstract String getPhoneName();
|
||||||
|
|
||||||
|
public abstract int getPhoneType();
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public int getVoiceMessageCount(){
|
public int getVoiceMessageCount(){
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -108,11 +108,11 @@ public class PhoneFactory {
|
|||||||
sCommandsInterface = new RIL(context, networkMode, cdmaSubscription);
|
sCommandsInterface = new RIL(context, networkMode, cdmaSubscription);
|
||||||
|
|
||||||
int phoneType = getPhoneType(networkMode);
|
int phoneType = getPhoneType(networkMode);
|
||||||
if (phoneType == RILConstants.GSM_PHONE) {
|
if (phoneType == Phone.PHONE_TYPE_GSM) {
|
||||||
sProxyPhone = new PhoneProxy(new GSMPhone(context,
|
sProxyPhone = new PhoneProxy(new GSMPhone(context,
|
||||||
sCommandsInterface, sPhoneNotifier));
|
sCommandsInterface, sPhoneNotifier));
|
||||||
Log.i(LOG_TAG, "Creating GSMPhone");
|
Log.i(LOG_TAG, "Creating GSMPhone");
|
||||||
} else if (phoneType == RILConstants.CDMA_PHONE) {
|
} else if (phoneType == Phone.PHONE_TYPE_CDMA) {
|
||||||
sProxyPhone = new PhoneProxy(new CDMAPhone(context,
|
sProxyPhone = new PhoneProxy(new CDMAPhone(context,
|
||||||
sCommandsInterface, sPhoneNotifier));
|
sCommandsInterface, sPhoneNotifier));
|
||||||
Log.i(LOG_TAG, "Creating CDMAPhone");
|
Log.i(LOG_TAG, "Creating CDMAPhone");
|
||||||
@ -135,18 +135,18 @@ public class PhoneFactory {
|
|||||||
case RILConstants.NETWORK_MODE_CDMA:
|
case RILConstants.NETWORK_MODE_CDMA:
|
||||||
case RILConstants.NETWORK_MODE_CDMA_NO_EVDO:
|
case RILConstants.NETWORK_MODE_CDMA_NO_EVDO:
|
||||||
case RILConstants.NETWORK_MODE_EVDO_NO_CDMA:
|
case RILConstants.NETWORK_MODE_EVDO_NO_CDMA:
|
||||||
return RILConstants.CDMA_PHONE;
|
return Phone.PHONE_TYPE_CDMA;
|
||||||
|
|
||||||
case RILConstants.NETWORK_MODE_WCDMA_PREF:
|
case RILConstants.NETWORK_MODE_WCDMA_PREF:
|
||||||
case RILConstants.NETWORK_MODE_GSM_ONLY:
|
case RILConstants.NETWORK_MODE_GSM_ONLY:
|
||||||
case RILConstants.NETWORK_MODE_WCDMA_ONLY:
|
case RILConstants.NETWORK_MODE_WCDMA_ONLY:
|
||||||
case RILConstants.NETWORK_MODE_GSM_UMTS:
|
case RILConstants.NETWORK_MODE_GSM_UMTS:
|
||||||
return RILConstants.GSM_PHONE;
|
return Phone.PHONE_TYPE_GSM;
|
||||||
|
|
||||||
case RILConstants.NETWORK_MODE_GLOBAL:
|
case RILConstants.NETWORK_MODE_GLOBAL:
|
||||||
return RILConstants.CDMA_PHONE;
|
return Phone.PHONE_TYPE_CDMA;
|
||||||
default:
|
default:
|
||||||
return RILConstants.GSM_PHONE;
|
return Phone.PHONE_TYPE_GSM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,6 +191,10 @@ public class PhoneProxy extends Handler implements Phone {
|
|||||||
return mActivePhone.getPhoneName();
|
return mActivePhone.getPhoneName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getPhoneType() {
|
||||||
|
return mActivePhone.getPhoneType();
|
||||||
|
}
|
||||||
|
|
||||||
public String[] getActiveApnTypes() {
|
public String[] getActiveApnTypes() {
|
||||||
return mActivePhone.getActiveApnTypes();
|
return mActivePhone.getActiveApnTypes();
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,6 @@ import com.android.internal.telephony.PhoneBase;
|
|||||||
import com.android.internal.telephony.PhoneNotifier;
|
import com.android.internal.telephony.PhoneNotifier;
|
||||||
import com.android.internal.telephony.PhoneProxy;
|
import com.android.internal.telephony.PhoneProxy;
|
||||||
import com.android.internal.telephony.PhoneSubInfo;
|
import com.android.internal.telephony.PhoneSubInfo;
|
||||||
import com.android.internal.telephony.RILConstants;
|
|
||||||
import com.android.internal.telephony.TelephonyIntents;
|
import com.android.internal.telephony.TelephonyIntents;
|
||||||
import com.android.internal.telephony.TelephonyProperties;
|
import com.android.internal.telephony.TelephonyProperties;
|
||||||
|
|
||||||
@ -143,7 +142,7 @@ public class CDMAPhone extends PhoneBase {
|
|||||||
boolean unitTestMode) {
|
boolean unitTestMode) {
|
||||||
super(notifier, context, ci, unitTestMode);
|
super(notifier, context, ci, unitTestMode);
|
||||||
|
|
||||||
mCM.setPhoneType(RILConstants.CDMA_PHONE);
|
mCM.setPhoneType(Phone.PHONE_TYPE_CDMA);
|
||||||
mCT = new CdmaCallTracker(this);
|
mCT = new CdmaCallTracker(this);
|
||||||
mSST = new CdmaServiceStateTracker (this);
|
mSST = new CdmaServiceStateTracker (this);
|
||||||
mSMS = new CdmaSMSDispatcher(this);
|
mSMS = new CdmaSMSDispatcher(this);
|
||||||
@ -171,7 +170,7 @@ public class CDMAPhone extends PhoneBase {
|
|||||||
|
|
||||||
//Change the system setting
|
//Change the system setting
|
||||||
SystemProperties.set(TelephonyProperties.CURRENT_ACTIVE_PHONE,
|
SystemProperties.set(TelephonyProperties.CURRENT_ACTIVE_PHONE,
|
||||||
new Integer(RILConstants.CDMA_PHONE).toString());
|
new Integer(Phone.PHONE_TYPE_CDMA).toString());
|
||||||
|
|
||||||
// This is needed to handle phone process crashes
|
// This is needed to handle phone process crashes
|
||||||
String inEcm=SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE, "false");
|
String inEcm=SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE, "false");
|
||||||
@ -261,23 +260,24 @@ public class CDMAPhone extends PhoneBase {
|
|||||||
return mSST.ss;
|
return mSST.ss;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Phone.State
|
public Phone.State getState() {
|
||||||
getState() {
|
|
||||||
return mCT.state;
|
return mCT.state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String
|
public String getPhoneName() {
|
||||||
getPhoneName() {
|
|
||||||
return "CDMA";
|
return "CDMA";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getPhoneType() {
|
||||||
|
return Phone.PHONE_TYPE_CDMA;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean canTransfer() {
|
public boolean canTransfer() {
|
||||||
Log.e(LOG_TAG, "canTransfer: not possible in CDMA");
|
Log.e(LOG_TAG, "canTransfer: not possible in CDMA");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CdmaCall
|
public CdmaCall getRingingCall() {
|
||||||
getRingingCall() {
|
|
||||||
return mCT.ringingCall;
|
return mCT.ringingCall;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,6 @@ import com.android.internal.telephony.PhoneBase;
|
|||||||
import com.android.internal.telephony.PhoneNotifier;
|
import com.android.internal.telephony.PhoneNotifier;
|
||||||
import com.android.internal.telephony.PhoneProxy;
|
import com.android.internal.telephony.PhoneProxy;
|
||||||
import com.android.internal.telephony.PhoneSubInfo;
|
import com.android.internal.telephony.PhoneSubInfo;
|
||||||
import com.android.internal.telephony.RILConstants;
|
|
||||||
import com.android.internal.telephony.TelephonyProperties;
|
import com.android.internal.telephony.TelephonyProperties;
|
||||||
import com.android.internal.telephony.gsm.stk.StkService;
|
import com.android.internal.telephony.gsm.stk.StkService;
|
||||||
import com.android.internal.telephony.test.SimulatedRadioControl;
|
import com.android.internal.telephony.test.SimulatedRadioControl;
|
||||||
@ -141,7 +140,7 @@ public class GSMPhone extends PhoneBase {
|
|||||||
mSimulatedRadioControl = (SimulatedRadioControl) ci;
|
mSimulatedRadioControl = (SimulatedRadioControl) ci;
|
||||||
}
|
}
|
||||||
|
|
||||||
mCM.setPhoneType(RILConstants.GSM_PHONE);
|
mCM.setPhoneType(Phone.PHONE_TYPE_GSM);
|
||||||
mCT = new GsmCallTracker(this);
|
mCT = new GsmCallTracker(this);
|
||||||
mSST = new GsmServiceStateTracker (this);
|
mSST = new GsmServiceStateTracker (this);
|
||||||
mSMS = new GsmSMSDispatcher(this);
|
mSMS = new GsmSMSDispatcher(this);
|
||||||
@ -201,7 +200,7 @@ public class GSMPhone extends PhoneBase {
|
|||||||
|
|
||||||
//Change the system property
|
//Change the system property
|
||||||
SystemProperties.set(TelephonyProperties.CURRENT_ACTIVE_PHONE,
|
SystemProperties.set(TelephonyProperties.CURRENT_ACTIVE_PHONE,
|
||||||
new Integer(RILConstants.GSM_PHONE).toString());
|
new Integer(Phone.PHONE_TYPE_GSM).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
@ -262,27 +261,27 @@ public class GSMPhone extends PhoneBase {
|
|||||||
return mSST.cellLoc;
|
return mSST.cellLoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Phone.State
|
public Phone.State getState() {
|
||||||
getState() {
|
|
||||||
return mCT.state;
|
return mCT.state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String
|
public String getPhoneName() {
|
||||||
getPhoneName() {
|
|
||||||
return "GSM";
|
return "GSM";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getPhoneType() {
|
||||||
|
return Phone.PHONE_TYPE_GSM;
|
||||||
|
}
|
||||||
|
|
||||||
public SignalStrength getSignalStrength() {
|
public SignalStrength getSignalStrength() {
|
||||||
return mSST.mSignalStrength;
|
return mSST.mSignalStrength;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean
|
public boolean getMessageWaitingIndicator() {
|
||||||
getMessageWaitingIndicator() {
|
|
||||||
return mSIMRecords.getVoiceMessageWaiting();
|
return mSIMRecords.getVoiceMessageWaiting();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean
|
public boolean getCallForwardingIndicator() {
|
||||||
getCallForwardingIndicator() {
|
|
||||||
return mSIMRecords.getVoiceCallForwardingFlag();
|
return mSIMRecords.getVoiceCallForwardingFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user