Merge "Add getLteOnCdamMode." into honeycomb-LTE

This commit is contained in:
Wink Saville
2011-05-13 09:09:43 -07:00
committed by Android (Google) Code Review
13 changed files with 150 additions and 66 deletions

View File

@@ -30,7 +30,6 @@ import com.android.internal.telephony.ITelephony;
import com.android.internal.telephony.ITelephonyRegistry;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.RILConstants;
import com.android.internal.telephony.TelephonyProperties;
import java.util.List;
@@ -630,6 +629,28 @@ public class TelephonyManager {
}
}
/**
* Return if the current radio is LTE on CDMA. This
* is a tri-state return value as for a period of time
* the mode may be unknown.
*
* @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE}
* or {@link Phone#LTE_ON_CDMA_TRUE}
*
* @hide
*/
public int getLteOnCdmaMode() {
try {
return getITelephony().getLteOnCdmaMode();
} catch (RemoteException ex) {
// Assume no ICC card if remote exception which shouldn't happen
return Phone.LTE_ON_CDMA_UNKNOWN;
} catch (NullPointerException ex) {
// This could happen before phone restarts due to crashing
return Phone.LTE_ON_CDMA_UNKNOWN;
}
}
//
//
// Subscriber Info

View File

@@ -22,6 +22,7 @@ import android.os.RegistrantList;
import android.os.Registrant;
import android.os.Handler;
import android.os.AsyncResult;
import android.os.SystemProperties;
import android.util.Config;
import android.util.Log;
@@ -792,4 +793,27 @@ public abstract class BaseCommands implements CommandsInterface {
protected void onRadioAvailable() {
}
/**
* {@inheritDoc}
*/
@Override
public int getLteOnCdmaMode() {
return getLteOnCdmaModeStatic();
}
/**
* Return if the current radio is LTE on CDMA. This
* is a tri-state return value as for a period of time
* the mode may be unknown.
*
* @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE}
* or {@link Phone#LTE_ON_CDMA_TRUE}
*/
public static int getLteOnCdmaModeStatic() {
int retVal = SystemProperties.getInt(TelephonyProperties.PROPERTY_NETWORK_LTE_ON_CDMA,
Phone.LTE_ON_CDMA_FALSE);
Log.d(LOG_TAG, "getLteOnCdmaMode=" + retVal);
return retVal;
}
}

View File

@@ -27,8 +27,6 @@ import android.os.SystemProperties;
* {@hide}
*/
public interface CommandsInterface {
static final boolean LTE_AVAILABLE_ON_CDMA =
SystemProperties.getBoolean(TelephonyProperties.PROPERTY_NETWORK_LTE_ON_CDMA, false);
enum RadioState {
RADIO_OFF(0), /* Radio explictly powered off (eg CFUN=0) */
RADIO_UNAVAILABLE(0), /* Radio unavailable (eg, resetting or not booted) */
@@ -79,7 +77,7 @@ public interface CommandsInterface {
}
public boolean isGsm() {
if (LTE_AVAILABLE_ON_CDMA) {
if (BaseCommands.getLteOnCdmaModeStatic() == Phone.LTE_ON_CDMA_TRUE) {
return false;
} else {
return this == SIM_NOT_READY
@@ -89,7 +87,7 @@ public interface CommandsInterface {
}
public boolean isCdma() {
if (LTE_AVAILABLE_ON_CDMA) {
if (BaseCommands.getLteOnCdmaModeStatic() == Phone.LTE_ON_CDMA_TRUE) {
return true;
} else {
return this == RUIM_NOT_READY
@@ -1572,4 +1570,14 @@ public interface CommandsInterface {
* Callback message containing {@link IccCardStatus} structure for the card.
*/
public void getIccCardStatus(Message result);
/**
* Return if the current radio is LTE on CDMA. This
* is a tri-state return value as for a period of time
* the mode may be unknown.
*
* @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE}
* or {@link Phone#LTE_ON_CDMA_TRUE}
*/
public int getLteOnCdmaMode();
}

View File

@@ -259,5 +259,15 @@ interface ITelephony {
* Return true if an ICC card is present
*/
boolean hasIccCard();
/**
* Return if the current radio is LTE on CDMA. This
* is a tri-state return value as for a period of time
* the mode may be unknown.
*
* @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE}
* or {@link PHone#LTE_ON_CDMA_TRUE}
*/
int getLteOnCdmaMode();
}

View File

@@ -88,9 +88,6 @@ public abstract class IccCard {
private static final int EVENT_QUERY_FACILITY_FDN_DONE = 10;
private static final int EVENT_CHANGE_FACILITY_FDN_DONE = 11;
static final boolean LTE_AVAILABLE_ON_CDMA =
SystemProperties.getBoolean(TelephonyProperties.PROPERTY_NETWORK_LTE_ON_CDMA, false);
/*
UNKNOWN is a transient state, for example, after uesr inputs ICC pin under
PIN_REQUIRED state, the query for ICC status returns UNKNOWN before it
@@ -436,7 +433,8 @@ public abstract class IccCard {
/*
* TODO: We need to try to remove this, maybe if the RIL sends up a RIL_UNSOL_SIM_REFRESH?
*/
if (oldState != State.READY && newState == State.READY && LTE_AVAILABLE_ON_CDMA) {
if (oldState != State.READY && newState == State.READY &&
mPhone.getLteOnCdmaMode() == Phone.LTE_ON_CDMA_TRUE) {
if (mPhone.mIccRecords instanceof SIMRecords) {
((SIMRecords)mPhone.mIccRecords).onSimReady();
}
@@ -627,7 +625,8 @@ public abstract class IccCard {
currentRadioState == RadioState.SIM_NOT_READY ||
currentRadioState == RadioState.RUIM_NOT_READY ||
currentRadioState == RadioState.NV_NOT_READY ||
(currentRadioState == RadioState.NV_READY && !LTE_AVAILABLE_ON_CDMA)) {
(currentRadioState == RadioState.NV_READY &&
(mPhone.getLteOnCdmaMode() != Phone.LTE_ON_CDMA_TRUE))) {
return IccCard.State.NOT_READY;
}
@@ -635,9 +634,8 @@ public abstract class IccCard {
currentRadioState == RadioState.SIM_READY ||
currentRadioState == RadioState.RUIM_LOCKED_OR_ABSENT ||
currentRadioState == RadioState.RUIM_READY ||
(currentRadioState == RadioState.NV_READY && LTE_AVAILABLE_ON_CDMA)) {
(currentRadioState == RadioState.NV_READY &&
(mPhone.getLteOnCdmaMode() == Phone.LTE_ON_CDMA_TRUE))) {
int index;
// check for CDMA radio technology

View File

@@ -21,6 +21,7 @@ import android.net.LinkCapabilities;
import android.net.LinkProperties;
import android.os.Handler;
import android.os.Message;
import android.os.SystemProperties;
import android.telephony.CellLocation;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
@@ -193,6 +194,11 @@ public interface Phone {
static final int PHONE_TYPE_CDMA = RILConstants.CDMA_PHONE;
static final int PHONE_TYPE_SIP = RILConstants.SIP_PHONE;
// Modes for LTE_ON_CDMA
static final int LTE_ON_CDMA_UNKNOWN = RILConstants.LTE_ON_CDMA_UNKNOWN;
static final int LTE_ON_CDMA_FALSE = RILConstants.LTE_ON_CDMA_FALSE;
static final int LTE_ON_CDMA_TRUE = RILConstants.LTE_ON_CDMA_TRUE;
// Used for preferred network type
// Note NT_* substitute RILConstants.NETWORK_MODE_* above the Phone
int NT_MODE_WCDMA_PREF = RILConstants.NETWORK_MODE_WCDMA_PREF;
@@ -1698,6 +1704,14 @@ public interface Phone {
*/
void unsetOnEcbModeExitResponse(Handler h);
/**
* Return if the current radio is LTE on CDMA. This
* is a tri-state return value as for a period of time
* the mode may be unknown.
*
* @return {@link #LTE_ON_CDMA_UNKNOWN}, {@link #LTE_ON_CDMA_FALSE} or {@link #LTE_ON_CDMA_TRUE}
*/
public int getLteOnCdmaMode();
/**
* TODO: Adding a function for each property is not good.

View File

@@ -1140,4 +1140,12 @@ public abstract class PhoneBase extends Handler implements Phone {
public void notifyDataConnectionFailed(String reason, String apnType) {
mNotifier.notifyDataConnectionFailed(this, reason, apnType);
}
/**
* {@inheritDoc}
*/
@Override
public int getLteOnCdmaMode() {
return mCM.getLteOnCdmaMode();
}
}

View File

@@ -36,8 +36,6 @@ public class PhoneFactory {
static final String LOG_TAG = "PHONE";
static final int SOCKET_OPEN_RETRY_MILLIS = 2 * 1000;
static final int SOCKET_OPEN_MAX_RETRY = 3;
static final boolean LTE_AVAILABLE_ON_CDMA =
SystemProperties.getBoolean(TelephonyProperties.PROPERTY_NETWORK_LTE_ON_CDMA, false);
//***** Class Variables
@@ -111,18 +109,17 @@ public class PhoneFactory {
// the configuration, bug 4202572. And the ril issues the
// RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED, bug 4295439.
int cdmaSubscription;
int lteOnCdma = SystemProperties.getInt(
TelephonyProperties.PROPERTY_NETWORK_LTE_ON_CDMA, -1);
int lteOnCdma = BaseCommands.getLteOnCdmaModeStatic();
switch (lteOnCdma) {
case 0:
case Phone.LTE_ON_CDMA_FALSE:
cdmaSubscription = RILConstants.SUBSCRIPTION_FROM_NV;
Log.i(LOG_TAG, "lteOnCdma is 0 use SUBSCRIPTION_FROM_NV");
break;
case 1:
case Phone.LTE_ON_CDMA_TRUE:
cdmaSubscription = RILConstants.SUBSCRIPTION_FROM_RUIM;
Log.i(LOG_TAG, "lteOnCdma is 1 use SUBSCRIPTION_FROM_RUIM");
break;
case -1:
case Phone.LTE_ON_CDMA_UNKNOWN:
default:
//Get cdmaSubscription mode from Settings.System
cdmaSubscription = Settings.Secure.getInt(context.getContentResolver(),
@@ -142,14 +139,18 @@ public class PhoneFactory {
sProxyPhone = new PhoneProxy(new GSMPhone(context,
sCommandsInterface, sPhoneNotifier));
} else if (phoneType == Phone.PHONE_TYPE_CDMA) {
if (LTE_AVAILABLE_ON_CDMA == false ) {
Log.i(LOG_TAG, "Creating CDMAPhone");
sProxyPhone = new PhoneProxy(new CDMAPhone(context,
sCommandsInterface, sPhoneNotifier));
} else {
Log.i(LOG_TAG, "Creating CDMALTEPhone");
sProxyPhone = new PhoneProxy(new CDMALTEPhone(context,
switch (BaseCommands.getLteOnCdmaModeStatic()) {
case Phone.LTE_ON_CDMA_TRUE:
Log.i(LOG_TAG, "Creating CDMALTEPhone");
sProxyPhone = new PhoneProxy(new CDMALTEPhone(context,
sCommandsInterface, sPhoneNotifier));
break;
case Phone.LTE_ON_CDMA_FALSE:
default:
Log.i(LOG_TAG, "Creating CDMAPhone");
sProxyPhone = new PhoneProxy(new CDMAPhone(context,
sCommandsInterface, sPhoneNotifier));
break;
}
}
@@ -185,8 +186,7 @@ public class PhoneFactory {
return Phone.PHONE_TYPE_CDMA;
case RILConstants.NETWORK_MODE_LTE_ONLY:
if (SystemProperties.getBoolean(TelephonyProperties.PROPERTY_NETWORK_LTE_ON_CDMA,
false)) {
if (BaseCommands.getLteOnCdmaModeStatic() == Phone.LTE_ON_CDMA_TRUE) {
return Phone.PHONE_TYPE_CDMA;
} else {
return Phone.PHONE_TYPE_GSM;
@@ -209,15 +209,22 @@ public class PhoneFactory {
}
public static Phone getCdmaPhone() {
Phone phone;
synchronized(PhoneProxy.lockForRadioTechnologyChange) {
if (LTE_AVAILABLE_ON_CDMA == false) {
Phone phone = new CDMAPhone(sContext, sCommandsInterface, sPhoneNotifier);
return phone;
} else {
Phone phone = new CDMALTEPhone(sContext, sCommandsInterface, sPhoneNotifier);
return phone;
switch (BaseCommands.getLteOnCdmaModeStatic()) {
case Phone.LTE_ON_CDMA_TRUE: {
phone = new CDMALTEPhone(sContext, sCommandsInterface, sPhoneNotifier);
break;
}
case Phone.LTE_ON_CDMA_FALSE:
case Phone.LTE_ON_CDMA_UNKNOWN:
default: {
phone = new CDMAPhone(sContext, sCommandsInterface, sPhoneNotifier);
break;
}
}
}
return phone;
}
public static Phone getGsmPhone() {

View File

@@ -836,4 +836,12 @@ public class PhoneProxy extends Handler implements Phone {
public boolean isCspPlmnEnabled() {
return mActivePhone.isCspPlmnEnabled();
}
/**
* {@inheritDoc}
*/
@Override
public int getLteOnCdmaMode() {
return mActivePhone.getLteOnCdmaMode();
}
}

View File

@@ -614,35 +614,13 @@ public final class RIL extends BaseCommands implements CommandsInterface {
public RIL(Context context, int networkMode, int cdmaSubscription) {
super(context);
if (RILJ_LOGD) {
riljLog("RIL(context, networkMode=" + networkMode +
" cdmaSubscription=" + cdmaSubscription + ")");
}
mCdmaSubscription = cdmaSubscription;
mNetworkMode = networkMode;
//At startup mPhoneType is first set from networkMode
switch(networkMode) {
case RILConstants.NETWORK_MODE_WCDMA_PREF:
case RILConstants.NETWORK_MODE_GSM_ONLY:
case RILConstants.NETWORK_MODE_WCDMA_ONLY:
case RILConstants.NETWORK_MODE_GSM_UMTS:
mPhoneType = RILConstants.GSM_PHONE;
break;
case RILConstants.NETWORK_MODE_CDMA:
case RILConstants.NETWORK_MODE_CDMA_NO_EVDO:
case RILConstants.NETWORK_MODE_EVDO_NO_CDMA:
mPhoneType = RILConstants.CDMA_PHONE;
break;
case RILConstants.NETWORK_MODE_GLOBAL:
mPhoneType = RILConstants.CDMA_PHONE;
break;
case RILConstants.NETWORK_MODE_LTE_ONLY:
if (SystemProperties.getBoolean(TelephonyProperties.PROPERTY_NETWORK_LTE_ON_CDMA,
false)) {
mPhoneType = RILConstants.CDMA_PHONE;
} else {
mPhoneType = RILConstants.GSM_PHONE;
}
break;
default:
mPhoneType = RILConstants.CDMA_PHONE;
}
mPhoneType = RILConstants.NO_PHONE;
PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, LOG_TAG);
@@ -3565,7 +3543,9 @@ public final class RIL extends BaseCommands implements CommandsInterface {
send(rr);
}
public void setPhoneType(int phoneType) { //Set by CDMAPhone and GSMPhone constructor
@Override
public void setPhoneType(int phoneType) { // Called by CDMAPhone and GSMPhone constructor
if (RILJ_LOGD) riljLog("setPhoneType=" + phoneType + " old value=" + mPhoneType);
mPhoneType = phoneType;
}

View File

@@ -86,6 +86,10 @@ public interface RILConstants {
int CDMA_PHONE = 2;
int SIP_PHONE = 3;
int LTE_ON_CDMA_UNKNOWN = -1;
int LTE_ON_CDMA_FALSE = 0;
int LTE_ON_CDMA_TRUE = 1;
int CDM_TTY_MODE_DISABLED = 0;
int CDM_TTY_MODE_ENABLED = 1;

View File

@@ -28,6 +28,7 @@ import android.util.Log;
import com.android.internal.telephony.AdnRecord;
import com.android.internal.telephony.AdnRecordCache;
import com.android.internal.telephony.AdnRecordLoader;
import com.android.internal.telephony.BaseCommands;
import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.IccFileHandler;
import com.android.internal.telephony.IccRecords;
@@ -35,6 +36,7 @@ import com.android.internal.telephony.IccUtils;
import com.android.internal.telephony.IccVmFixedException;
import com.android.internal.telephony.IccVmNotSupportedException;
import com.android.internal.telephony.MccTable;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneBase;
import java.util.ArrayList;
@@ -495,8 +497,7 @@ public final class SIMRecords extends IccRecords {
}
// STOPSHIP: to be removed
if (SystemProperties.getInt(com.android.internal.telephony.TelephonyProperties
.PROPERTY_NETWORK_LTE_ON_CDMA, 0) == 1) {
if (BaseCommands.getLteOnCdmaModeStatic() == Phone.LTE_ON_CDMA_TRUE) {
Log.e(LOG_TAG, "getOperatorNumeric: STOPSHIP bad numeric operators in lte");
return SystemProperties.get("ro.cdma.home.operator.numeric", "310004");
}

View File

@@ -19,6 +19,7 @@ package com.android.internal.telephony.gsm;
import android.util.Log;
import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneBase;
import com.android.internal.telephony.TelephonyProperties;
import android.os.SystemProperties;
@@ -47,7 +48,7 @@ public final class SimCard extends IccCard {
mPhone.mCM.registerForSIMReady(mHandler, EVENT_ICC_READY, null);
updateStateProperty();
if(SystemProperties.getBoolean(TelephonyProperties.PROPERTY_NETWORK_LTE_ON_CDMA, false)) {
if(mPhone.getLteOnCdmaMode() == Phone.LTE_ON_CDMA_TRUE) {
mPhone.mCM.registerForNVReady(mHandler, EVENT_ICC_READY, null);
}
}