diff options
author | Wink Saville <wink@google.com> | 2011-04-15 15:41:35 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-04-15 15:41:35 -0700 |
commit | 5ae172b97e3dd9ae670f41753f8cf96b401d5dca (patch) | |
tree | c2e4b9b938e4c7e7660c49619855a7bd870f169c /telephony | |
parent | 231942afa2b681221152780b05a593139c050457 (diff) | |
parent | 93a3f72aa0475e08bbe7de8d512f7149428aaf2d (diff) | |
download | frameworks_base-5ae172b97e3dd9ae670f41753f8cf96b401d5dca.zip frameworks_base-5ae172b97e3dd9ae670f41753f8cf96b401d5dca.tar.gz frameworks_base-5ae172b97e3dd9ae670f41753f8cf96b401d5dca.tar.bz2 |
am 93a3f72a: am cb0c5f16: Merge "Change RIL initialization." into honeycomb-LTE
* commit '93a3f72aa0475e08bbe7de8d512f7149428aaf2d':
Change RIL initialization.
Diffstat (limited to 'telephony')
3 files changed, 36 insertions, 54 deletions
diff --git a/telephony/java/com/android/internal/telephony/PhoneFactory.java b/telephony/java/com/android/internal/telephony/PhoneFactory.java index ab0bb63..27d6017 100644 --- a/telephony/java/com/android/internal/telephony/PhoneFactory.java +++ b/telephony/java/com/android/internal/telephony/PhoneFactory.java @@ -106,10 +106,32 @@ public class PhoneFactory { Settings.Secure.PREFERRED_NETWORK_MODE, preferredNetworkMode); Log.i(LOG_TAG, "Network Mode set to " + Integer.toString(networkMode)); - //Get preferredNetworkMode from Settings.System - int cdmaSubscription = Settings.Secure.getInt(context.getContentResolver(), - Settings.Secure.PREFERRED_CDMA_SUBSCRIPTION, preferredCdmaSubscription); - Log.i(LOG_TAG, "Cdma Subscription set to " + Integer.toString(cdmaSubscription)); + // Get cdmaSubscription + // TODO: Change when the ril will provides a way to know at runtime + // 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); + switch (lteOnCdma) { + case 0: + cdmaSubscription = RILConstants.SUBSCRIPTION_FROM_NV; + Log.i(LOG_TAG, "lteOnCdma is 0 use SUBSCRIPTION_FROM_NV"); + break; + case 1: + cdmaSubscription = RILConstants.SUBSCRIPTION_FROM_RUIM; + Log.i(LOG_TAG, "lteOnCdma is 1 use SUBSCRIPTION_FROM_RUIM"); + break; + case -1: + default: + //Get cdmaSubscription mode from Settings.System + cdmaSubscription = Settings.Secure.getInt(context.getContentResolver(), + Settings.Secure.PREFERRED_CDMA_SUBSCRIPTION, + preferredCdmaSubscription); + Log.i(LOG_TAG, "lteOnCdma not set, using PREFERRED_CDMA_SUBSCRIPTION"); + break; + } + Log.i(LOG_TAG, "Cdma Subscription set to " + cdmaSubscription); //reads the system properties and makes commandsinterface sCommandsInterface = new RIL(context, networkMode, cdmaSubscription); diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java index 863daef..ad5b5da 100644 --- a/telephony/java/com/android/internal/telephony/RIL.java +++ b/telephony/java/com/android/internal/telephony/RIL.java @@ -234,9 +234,6 @@ public final class RIL extends BaseCommands implements CommandsInterface { // WAKE_LOCK_TIMEOUT occurs. int mRequestMessagesWaiting; - // Is this the first radio state change? - private boolean mInitialRadioStateChange = true; - //I'd rather this be LinkedList or something ArrayList<RILRequest> mRequestsList = new ArrayList<RILRequest>(); @@ -613,11 +610,6 @@ public final class RIL extends BaseCommands implements CommandsInterface { //***** Constructors - public - RIL(Context context) { - this(context, RILConstants.PREFERRED_NETWORK_MODE, - RILConstants.PREFERRED_CDMA_SUBSCRIPTION); - } public RIL(Context context, int networkMode, int cdmaSubscription) { super(context); @@ -1394,24 +1386,6 @@ public final class RIL extends BaseCommands implements CommandsInterface { public void setRadioPower(boolean on, Message result) { - //if radio is OFF set preferred NW type and cmda subscription - if(mInitialRadioStateChange) { - synchronized (mStateMonitor) { - if (!mState.isOn()) { - setPreferredNetworkType(mNetworkMode, null); - - RILRequest rrCs = RILRequest.obtain( - RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE, null); - rrCs.mp.writeInt(1); - rrCs.mp.writeInt(mCdmaSubscription); - if (RILJ_LOGD) { - riljLog(rrCs.serialString() + "> " - + requestToString(rrCs.mRequest) + " : " + mCdmaSubscription); - } - send(rrCs); - } - } - } RILRequest rr = RILRequest.obtain(RIL_REQUEST_RADIO_POWER, result); rr.mp.writeInt(1); @@ -2058,26 +2032,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { } private void switchToRadioState(RadioState newState) { - - if (mInitialRadioStateChange) { - if (newState.isOn()) { - /* If this is our first notification, make sure the radio - * is powered off. This gets the radio into a known state, - * since it's possible for the phone proc to have restarted - * (eg, if it or the runtime crashed) without the RIL - * and/or radio knowing. - */ - if (RILJ_LOGD) Log.d(LOG_TAG, "Radio ON @ init; reset to OFF"); - setRadioPower(false, null); - } else { - if (RILJ_LOGD) Log.d(LOG_TAG, "Radio OFF @ init"); - setRadioState(newState); - setPreferredNetworkType(mNetworkMode, null); - } - mInitialRadioStateChange = false; - } else { - setRadioState(newState); - } + setRadioState(newState); } /** @@ -2467,7 +2422,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { case RIL_UNSOL_OEM_HOOK_RAW: ret = responseRaw(p); break; case RIL_UNSOL_RINGBACK_TONE: ret = responseInts(p); break; case RIL_UNSOL_RESEND_INCALL_MUTE: ret = responseVoid(p); break; - case RIL_UNSOL_CDMA_SUBSCRIPTION_CHANGED: ret = responseInts(p); break; + case RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED: ret = responseInts(p); break; case RIL_UNSOl_CDMA_PRL_CHANGED: ret = responseInts(p); break; case RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE: ret = responseVoid(p); break; case RIL_UNSOL_RIL_CONNECTED: ret = responseInts(p); break; @@ -2775,7 +2730,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { } break; - case RIL_UNSOL_CDMA_SUBSCRIPTION_CHANGED: + case RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED: if (RILJ_LOGD) unsljLogRet(response, ret); if (mCdmaSubscriptionChangedRegistrants != null) { @@ -2804,6 +2759,11 @@ public final class RIL extends BaseCommands implements CommandsInterface { case RIL_UNSOL_RIL_CONNECTED: { if (RILJ_LOGD) unsljLogRet(response, ret); + + // Initial conditions + setRadioPower(false, null); + setPreferredNetworkType(mNetworkMode, null); + setCdmaSubscriptionSource(mCdmaSubscription, null); notifyRegistrantsRilConnectionChanged(((int[])ret)[0]); break; } @@ -3554,7 +3514,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { case RIL_UNSOL_OEM_HOOK_RAW: return "UNSOL_OEM_HOOK_RAW"; case RIL_UNSOL_RINGBACK_TONE: return "UNSOL_RINGBACK_TONG"; case RIL_UNSOL_RESEND_INCALL_MUTE: return "UNSOL_RESEND_INCALL_MUTE"; - case RIL_UNSOL_CDMA_SUBSCRIPTION_CHANGED: return "CDMA_SUBSCRIPTION_CHANGED"; + case RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED: return "CDMA_SUBSCRIPTION_SOURCE_CHANGED"; case RIL_UNSOl_CDMA_PRL_CHANGED: return "UNSOL_CDMA_PRL_CHANGED"; case RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE: return "UNSOL_EXIT_EMERGENCY_CALLBACK_MODE"; case RIL_UNSOL_RIL_CONNECTED: return "UNSOL_RIL_CONNECTED"; diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java index 73dfdc0..2a27926 100644 --- a/telephony/java/com/android/internal/telephony/RILConstants.java +++ b/telephony/java/com/android/internal/telephony/RILConstants.java @@ -286,7 +286,7 @@ cat include/telephony/ril.h | \ int RIL_UNSOL_OEM_HOOK_RAW = 1028; int RIL_UNSOL_RINGBACK_TONE = 1029; int RIL_UNSOL_RESEND_INCALL_MUTE = 1030; - int RIL_UNSOL_CDMA_SUBSCRIPTION_CHANGED = 1031; + int RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED = 1031; int RIL_UNSOl_CDMA_PRL_CHANGED = 1032; int RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE = 1033; int RIL_UNSOL_RIL_CONNECTED = 1034; |