Seperate RIL constants from the framework.

We have two sets of constants for network type.  One used by the RIL can't
be changed without big pains with OEM/Radio vendors.  The other has been published
as part of the framework and can't be easily changed either.

Separate the two so it's clear where one should be used versus the other.

bug:5717664
Change-Id: Ibf21f9165662e75557c7254fc9ad9a4870ba4af9
This commit is contained in:
Robert Greenwalt
2012-02-17 13:14:08 -08:00
parent dc210ade0a
commit 1434d7b855
11 changed files with 169 additions and 132 deletions

View File

@ -355,14 +355,14 @@ public abstract class DataConnection extends StateMachine {
if (DBG) log("NotifyDisconnectCompleted DisconnectParams=" + dp);
}
protected int getRadioTechnology(int defaultRadioTechnology) {
int radioTechnology;
protected int getRilRadioTechnology(int defaultRilRadioTechnology) {
int rilRadioTechnology;
if (mRilVersion < 6) {
radioTechnology = defaultRadioTechnology;
rilRadioTechnology = defaultRilRadioTechnology;
} else {
radioTechnology = phone.getServiceState().getRadioTechnology() + 2;
rilRadioTechnology = phone.getServiceState().getRilRadioTechnology() + 2;
}
return radioTechnology;
return rilRadioTechnology;
}
/*

View File

@ -40,6 +40,7 @@ import android.preference.PreferenceManager;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
@ -1165,15 +1166,14 @@ public abstract class DataConnectionTracker extends Handler {
}
protected String getReryConfig(boolean forDefault) {
int rt = mPhone.getServiceState().getRadioTechnology();
int nt = mPhone.getServiceState().getNetworkType();
if ((rt == ServiceState.RADIO_TECHNOLOGY_IS95A) ||
(rt == ServiceState.RADIO_TECHNOLOGY_IS95B) ||
(rt == ServiceState.RADIO_TECHNOLOGY_1xRTT) ||
(rt == ServiceState.RADIO_TECHNOLOGY_EVDO_0) ||
(rt == ServiceState.RADIO_TECHNOLOGY_EVDO_A) ||
(rt == ServiceState.RADIO_TECHNOLOGY_EVDO_B) ||
(rt == ServiceState.RADIO_TECHNOLOGY_EHRPD)) {
if ((nt == TelephonyManager.NETWORK_TYPE_CDMA) ||
(nt == TelephonyManager.NETWORK_TYPE_1xRTT) ||
(nt == TelephonyManager.NETWORK_TYPE_EVDO_0) ||
(nt == TelephonyManager.NETWORK_TYPE_EVDO_A) ||
(nt == TelephonyManager.NETWORK_TYPE_EVDO_B) ||
(nt == TelephonyManager.NETWORK_TYPE_EHRPD)) {
// CDMA variant
return SystemProperties.get("ro.cdma.data_retry_config");
} else {

View File

@ -149,7 +149,7 @@ public class PhoneProxy extends Handler implements Phone {
logd("LTE ON CDMA property is set. Switch to CDMALTEPhone" +
" newVoiceRadioTech = " + newVoiceRadioTech +
" Active Phone = " + mActivePhone.getPhoneName());
newVoiceRadioTech = ServiceState.RADIO_TECHNOLOGY_1xRTT;
newVoiceRadioTech = ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT;
}
} else {
if ((ServiceState.isCdma(newVoiceRadioTech) &&
@ -165,7 +165,7 @@ public class PhoneProxy extends Handler implements Phone {
}
}
if (newVoiceRadioTech == ServiceState.RADIO_TECHNOLOGY_UNKNOWN) {
if (newVoiceRadioTech == ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN) {
// We need some voice phone object to be active always, so never
// delete the phone without anything to replace it with!
logd("Ignoring voice radio technology changed message. newVoiceRadioTech = Unknown."

View File

@ -54,10 +54,10 @@ public abstract class ServiceStateTracker extends Handler {
protected boolean mDesiredPowerState;
/**
* Values correspond to ServiceState.RADIO_TECHNOLOGY_ definitions.
* Values correspond to ServiceState.RIL_RADIO_TECHNOLOGY_ definitions.
*/
protected int mRadioTechnology = 0;
protected int mNewRadioTechnology = 0;
protected int mRilRadioTechnology = 0;
protected int mNewRilRadioTechnology = 0;
/**
* By default, strength polling is enabled. However, if we're

View File

@ -86,7 +86,7 @@ public class CdmaDataConnection extends DataConnection {
Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp);
msg.obj = cp;
phone.mCM.setupDataCall(
Integer.toString(getRadioTechnology(RILConstants.SETUP_DATA_TECH_CDMA)),
Integer.toString(getRilRadioTechnology(RILConstants.SETUP_DATA_TECH_CDMA)),
Integer.toString(dataProfile),
null, null, null,
Integer.toString(RILConstants.SETUP_DATA_AUTH_PAP_CHAP),

View File

@ -185,19 +185,21 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
@Override
protected void pollStateDone() {
// determine data NetworkType from both LET and CDMA SS
// determine data RadioTechnology from both LET and CDMA SS
if (mLteSS.getState() == ServiceState.STATE_IN_SERVICE) {
//in LTE service
newNetworkType = mLteSS.getRadioTechnology();
mNewRilRadioTechnology = mLteSS.getRilRadioTechnology();
mNewDataConnectionState = mLteSS.getState();
newSS.setRadioTechnology(newNetworkType);
log("pollStateDone LTE/eHRPD STATE_IN_SERVICE newNetworkType = " + newNetworkType);
newSS.setRadioTechnology(mNewRilRadioTechnology);
log("pollStateDone LTE/eHRPD STATE_IN_SERVICE mNewRilRadioTechnology = " +
mNewRilRadioTechnology);
} else {
// LTE out of service, get CDMA Service State
newNetworkType = newSS.getRadioTechnology();
mNewDataConnectionState = radioTechnologyToDataServiceState(newNetworkType);
log("pollStateDone CDMA STATE_IN_SERVICE newNetworkType = " + newNetworkType +
" mNewDataConnectionState = " + mNewDataConnectionState);
mNewRilRadioTechnology = newSS.getRilRadioTechnology();
mNewDataConnectionState = radioTechnologyToDataServiceState(mNewRilRadioTechnology);
log("pollStateDone CDMA STATE_IN_SERVICE mNewRilRadioTechnology = " +
mNewRilRadioTechnology + " mNewDataConnectionState = " +
mNewDataConnectionState);
}
// TODO: Add proper support for LTE Only, we should be looking at
@ -239,7 +241,7 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
boolean hasCdmaDataConnectionChanged =
mDataConnectionState != mNewDataConnectionState;
boolean hasNetworkTypeChanged = networkType != newNetworkType;
boolean hasRadioTechnologyChanged = mRilRadioTechnology != mNewRilRadioTechnology;
boolean hasChanged = !newSS.equals(ss);
@ -251,20 +253,20 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
boolean has4gHandoff =
mNewDataConnectionState == ServiceState.STATE_IN_SERVICE &&
(((networkType == ServiceState.RADIO_TECHNOLOGY_LTE) &&
(newNetworkType == ServiceState.RADIO_TECHNOLOGY_EHRPD)) ||
((networkType == ServiceState.RADIO_TECHNOLOGY_EHRPD) &&
(newNetworkType == ServiceState.RADIO_TECHNOLOGY_LTE)));
(((mRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_LTE) &&
(mNewRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD)) ||
((mRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD) &&
(mNewRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_LTE)));
boolean hasMultiApnSupport =
(((newNetworkType == ServiceState.RADIO_TECHNOLOGY_LTE) ||
(newNetworkType == ServiceState.RADIO_TECHNOLOGY_EHRPD)) &&
((networkType != ServiceState.RADIO_TECHNOLOGY_LTE) &&
(networkType != ServiceState.RADIO_TECHNOLOGY_EHRPD)));
(((mNewRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_LTE) ||
(mNewRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD)) &&
((mRilRadioTechnology != ServiceState.RIL_RADIO_TECHNOLOGY_LTE) &&
(mRilRadioTechnology != ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD)));
boolean hasLostMultiApnSupport =
((newNetworkType >= ServiceState.RADIO_TECHNOLOGY_IS95A) &&
(newNetworkType <= ServiceState.RADIO_TECHNOLOGY_EVDO_A));
((mNewRilRadioTechnology >= ServiceState.RIL_RADIO_TECHNOLOGY_IS95A) &&
(mNewRilRadioTechnology <= ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_A));
if (DBG) {
log("pollStateDone:"
@ -273,7 +275,7 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
+ " hasCdmaDataConnectionAttached=" + hasCdmaDataConnectionAttached
+ " hasCdmaDataConnectionDetached=" + hasCdmaDataConnectionDetached
+ " hasCdmaDataConnectionChanged=" + hasCdmaDataConnectionChanged
+ " hasNetworkTypeChanged = " + hasNetworkTypeChanged
+ " hasRadioTechnologyChanged = " + hasRadioTechnologyChanged
+ " hasChanged=" + hasChanged
+ " hasRoamingOn=" + hasRoamingOn
+ " hasRoamingOff=" + hasRoamingOff
@ -316,13 +318,14 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
newCellLoc = tcl;
mDataConnectionState = mNewDataConnectionState;
networkType = newNetworkType;
mRilRadioTechnology = mNewRilRadioTechnology;
mNewRilRadioTechnology = 0;
newSS.setStateOutOfService(); // clean slate for next time
if (hasNetworkTypeChanged) {
if (hasRadioTechnologyChanged) {
phone.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE,
ServiceState.radioTechnologyToString(networkType));
ServiceState.rilRadioTechnologyToString(mRilRadioTechnology));
}
if (hasRegistered) {
@ -404,7 +407,7 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
mDetachedRegistrants.notifyRegistrants();
}
if ((hasCdmaDataConnectionChanged || hasNetworkTypeChanged)) {
if ((hasCdmaDataConnectionChanged || hasRadioTechnologyChanged)) {
phone.notifyDataConnection(null);
}
@ -446,7 +449,7 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
int evdoSnr = ((ints[offset + 4] > 0) && (ints[offset + 4] <= 8)) ? ints[offset + 4]
: -1;
if (networkType == ServiceState.RADIO_TECHNOLOGY_LTE) {
if (mRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_LTE) {
lteRssi = ints[offset+5];
lteRsrp = ints[offset+6];
lteRsrq = ints[offset+7];
@ -454,7 +457,7 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
lteCqi = ints[offset+9];
}
if (networkType != ServiceState.RADIO_TECHNOLOGY_LTE) {
if (mRilRadioTechnology != ServiceState.RIL_RADIO_TECHNOLOGY_LTE) {
mSignalStrength = new SignalStrength(99, -1, cdmaDbm, cdmaEcio, evdoRssi, evdoEcio,
evdoSnr, false);
} else {
@ -476,7 +479,7 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
// Note: it needs to be confirmed which CDMA network types
// can support voice and data calls concurrently.
// For the time-being, the return value will be false.
return (networkType == ServiceState.RADIO_TECHNOLOGY_LTE);
return (mRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_LTE);
}
/**

View File

@ -86,12 +86,6 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
private int mNitzUpdateDiff = SystemProperties.getInt("ro.nitz_update_diff",
NITZ_UPDATE_DIFF_DEFAULT);
/**
* Values correspond to ServiceState.RADIO_TECHNOLOGY_ definitions.
*/
protected int networkType = 0;
protected int newNetworkType = 0;
private boolean mCdmaRoaming = false;
private int mRoamingIndicator;
private boolean mIsInPrl;
@ -556,10 +550,10 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
/**
* Determine data network type based on radio technology.
*/
protected void setCdmaTechnology(int radioTechnology){
mNewDataConnectionState = radioTechnologyToDataServiceState(radioTechnology);
newSS.setRadioTechnology(radioTechnology);
newNetworkType = radioTechnology;
protected void setCdmaTechnology(int radioTech){
mNewDataConnectionState = radioTechnologyToDataServiceState(radioTech);
newSS.setRadioTechnology(radioTech);
mNewRilRadioTechnology = radioTech;
}
/**
@ -925,7 +919,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
boolean hasCdmaDataConnectionChanged =
mDataConnectionState != mNewDataConnectionState;
boolean hasNetworkTypeChanged = networkType != newNetworkType;
boolean hasRadioTechnologyChanged = mRilRadioTechnology != mNewRilRadioTechnology;
boolean hasChanged = !newSS.equals(ss);
@ -955,15 +949,15 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
newCellLoc = tcl;
mDataConnectionState = mNewDataConnectionState;
networkType = newNetworkType;
mRilRadioTechnology = mNewRilRadioTechnology;
// this new state has been applied - forget it until we get a new new state
newNetworkType = 0;
mNewRilRadioTechnology = 0;
newSS.setStateOutOfService(); // clean slate for next time
if (hasNetworkTypeChanged) {
if (hasRadioTechnologyChanged) {
phone.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE,
ServiceState.radioTechnologyToString(networkType));
ServiceState.rilRadioTechnologyToString(mRilRadioTechnology));
}
if (hasRegistered) {
@ -1030,7 +1024,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
mDetachedRegistrants.notifyRegistrants();
}
if (hasCdmaDataConnectionChanged || hasNetworkTypeChanged) {
if (hasCdmaDataConnectionChanged || hasRadioTechnologyChanged) {
phone.notifyDataConnection(null);
}

View File

@ -100,7 +100,7 @@ public class GsmDataConnection extends DataConnection {
}
phone.mCM.setupDataCall(
Integer.toString(getRadioTechnology(RILConstants.SETUP_DATA_TECH_GSM)),
Integer.toString(getRilRadioTechnology(RILConstants.SETUP_DATA_TECH_GSM)),
Integer.toString(mProfileId),
mApn.apn, mApn.user, mApn.password,
Integer.toString(authType),

View File

@ -2318,7 +2318,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
}
String operator = mPhone.mIccRecords.getOperatorNumeric();
int radioTech = mPhone.getServiceState().getRadioTechnology();
int networkType = mPhone.getServiceState().getNetworkType();
if (requestedApnType.equals(Phone.APN_TYPE_DEFAULT)) {
if (canSetPreferApn && mPreferredApn != null) {
@ -2327,7 +2327,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
+ mPreferredApn.numeric + ":" + mPreferredApn);
}
if (mPreferredApn.numeric.equals(operator)) {
if (mPreferredApn.bearer == 0 || mPreferredApn.bearer == radioTech) {
if (mPreferredApn.bearer == 0 || mPreferredApn.bearer == networkType) {
apnList.add(mPreferredApn);
if (DBG) log("buildWaitingApns: X added preferred apnList=" + apnList);
return apnList;
@ -2346,7 +2346,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
if (mAllApns != null) {
for (ApnSetting apn : mAllApns) {
if (apn.canHandleType(requestedApnType)) {
if (apn.bearer == 0 || apn.bearer == radioTech) {
if (apn.bearer == 0 || apn.bearer == networkType) {
if (DBG) log("apn info : " +apn.toString());
apnList.add(apn);
}

View File

@ -629,7 +629,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
}
newGPRSState = regCodeToServiceState(regState);
mDataRoaming = regCodeIsRoaming(regState);
mNewRadioTechnology = type;
mNewRilRadioTechnology = type;
newSS.setRadioTechnology(type);
break;
@ -746,8 +746,8 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
" mNewMaxDataCalls=" + mNewMaxDataCalls +
" oldReasonDataDenied=" + mReasonDataDenied +
" mNewReasonDataDenied=" + mNewReasonDataDenied +
" oldType=" + ServiceState.radioTechnologyToString(mRadioTechnology) +
" newType=" + ServiceState.radioTechnologyToString(mNewRadioTechnology));
" oldType=" + ServiceState.rilRadioTechnologyToString(mRilRadioTechnology) +
" newType=" + ServiceState.rilRadioTechnologyToString(mNewRilRadioTechnology));
}
boolean hasRegistered =
@ -766,7 +766,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
gprsState == ServiceState.STATE_IN_SERVICE
&& newGPRSState != ServiceState.STATE_IN_SERVICE;
boolean hasRadioTechnologyChanged = mRadioTechnology != mNewRadioTechnology;
boolean hasRadioTechnologyChanged = mRilRadioTechnology != mNewRilRadioTechnology;
boolean hasChanged = !newSS.equals(ss);
@ -800,11 +800,11 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
int cid = -1;
GsmCellLocation loc = ((GsmCellLocation)phone.getCellLocation());
if (loc != null) cid = loc.getCid();
EventLog.writeEvent(EventLogTags.GSM_RAT_SWITCHED, cid, mRadioTechnology,
mNewRadioTechnology);
EventLog.writeEvent(EventLogTags.GSM_RAT_SWITCHED, cid, mRilRadioTechnology,
mNewRilRadioTechnology);
if (DBG) {
log("RAT switched " + ServiceState.radioTechnologyToString(mRadioTechnology) +
" -> " + ServiceState.radioTechnologyToString(mNewRadioTechnology) +
log("RAT switched " + ServiceState.rilRadioTechnologyToString(mRilRadioTechnology) +
" -> " + ServiceState.rilRadioTechnologyToString(mNewRilRadioTechnology) +
" at cell " + cid);
}
}
@ -812,16 +812,16 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
gprsState = newGPRSState;
mReasonDataDenied = mNewReasonDataDenied;
mMaxDataCalls = mNewMaxDataCalls;
mRadioTechnology = mNewRadioTechnology;
mRilRadioTechnology = mNewRilRadioTechnology;
// this new state has been applied - forget it until we get a new new state
mNewRadioTechnology = 0;
mNewRilRadioTechnology = 0;
newSS.setStateOutOfService(); // clean slate for next time
if (hasRadioTechnologyChanged) {
phone.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE,
ServiceState.radioTechnologyToString(mRadioTechnology));
ServiceState.rilRadioTechnologyToString(mRilRadioTechnology));
}
if (hasRegistered) {
@ -1246,7 +1246,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
* that could support voice and data simultaneously.
*/
public boolean isConcurrentVoiceAndDataAllowed() {
return (mRadioTechnology >= ServiceState.RADIO_TECHNOLOGY_UMTS);
return (mRilRadioTechnology >= ServiceState.RIL_RADIO_TECHNOLOGY_UMTS);
}
/**