diff options
13 files changed, 150 insertions, 66 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 23b67e3f27fa..8732e2199890 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -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 diff --git a/telephony/java/com/android/internal/telephony/BaseCommands.java b/telephony/java/com/android/internal/telephony/BaseCommands.java index ce67390a6044..9fc4667a4f34 100644 --- a/telephony/java/com/android/internal/telephony/BaseCommands.java +++ b/telephony/java/com/android/internal/telephony/BaseCommands.java @@ -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.Log; /** @@ -791,4 +792,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; + } } diff --git a/telephony/java/com/android/internal/telephony/CommandsInterface.java b/telephony/java/com/android/internal/telephony/CommandsInterface.java index 96788effd9f4..bd549eac2186 100644 --- a/telephony/java/com/android/internal/telephony/CommandsInterface.java +++ b/telephony/java/com/android/internal/telephony/CommandsInterface.java @@ -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(); } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 3c4bb12ff7bc..da233ccf14d8 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -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(); } diff --git a/telephony/java/com/android/internal/telephony/IccCard.java b/telephony/java/com/android/internal/telephony/IccCard.java index f186c07d2c6b..9956ae8cca7d 100644 --- a/telephony/java/com/android/internal/telephony/IccCard.java +++ b/telephony/java/com/android/internal/telephony/IccCard.java @@ -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 diff --git a/telephony/java/com/android/internal/telephony/Phone.java b/telephony/java/com/android/internal/telephony/Phone.java index b99f39b9ccdd..ddf066eefe53 100644 --- a/telephony/java/com/android/internal/telephony/Phone.java +++ b/telephony/java/com/android/internal/telephony/Phone.java @@ -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. diff --git a/telephony/java/com/android/internal/telephony/PhoneBase.java b/telephony/java/com/android/internal/telephony/PhoneBase.java index cb0c26ad63e0..b77e13426f6a 100644 --- a/telephony/java/com/android/internal/telephony/PhoneBase.java +++ b/telephony/java/com/android/internal/telephony/PhoneBase.java @@ -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(); + } } diff --git a/telephony/java/com/android/internal/telephony/PhoneFactory.java b/telephony/java/com/android/internal/telephony/PhoneFactory.java index a04623f99ac1..6a2d7c9e5cbc 100644 --- a/telephony/java/com/android/internal/telephony/PhoneFactory.java +++ b/telephony/java/com/android/internal/telephony/PhoneFactory.java @@ -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() { diff --git a/telephony/java/com/android/internal/telephony/PhoneProxy.java b/telephony/java/com/android/internal/telephony/PhoneProxy.java index a3fc25d3f410..68f1c5fe2422 100644 --- a/telephony/java/com/android/internal/telephony/PhoneProxy.java +++ b/telephony/java/com/android/internal/telephony/PhoneProxy.java @@ -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(); + } } diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java index d1c6b293039b..0621cfd3bd5f 100644 --- a/telephony/java/com/android/internal/telephony/RIL.java +++ b/telephony/java/com/android/internal/telephony/RIL.java @@ -613,35 +613,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); @@ -3564,7 +3542,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; } diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java index 2a27926459df..f5d6c51e66fe 100644 --- a/telephony/java/com/android/internal/telephony/RILConstants.java +++ b/telephony/java/com/android/internal/telephony/RILConstants.java @@ -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; diff --git a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java index e0323e349a3f..27cde78470fc 100755 --- a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java +++ b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java @@ -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"); } diff --git a/telephony/java/com/android/internal/telephony/gsm/SimCard.java b/telephony/java/com/android/internal/telephony/gsm/SimCard.java index 09df49f0c75f..b63c1d767016 100644 --- a/telephony/java/com/android/internal/telephony/gsm/SimCard.java +++ b/telephony/java/com/android/internal/telephony/gsm/SimCard.java @@ -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); } } |