am cb0c5f16: Merge "Change RIL initialization." into honeycomb-LTE
* commit 'cb0c5f16e9131e73cda38ce18c00a31b1d5be2c3': Change RIL initialization.
This commit is contained in:
@@ -106,10 +106,32 @@ public class PhoneFactory {
|
|||||||
Settings.Secure.PREFERRED_NETWORK_MODE, preferredNetworkMode);
|
Settings.Secure.PREFERRED_NETWORK_MODE, preferredNetworkMode);
|
||||||
Log.i(LOG_TAG, "Network Mode set to " + Integer.toString(networkMode));
|
Log.i(LOG_TAG, "Network Mode set to " + Integer.toString(networkMode));
|
||||||
|
|
||||||
//Get preferredNetworkMode from Settings.System
|
// Get cdmaSubscription
|
||||||
int cdmaSubscription = Settings.Secure.getInt(context.getContentResolver(),
|
// TODO: Change when the ril will provides a way to know at runtime
|
||||||
Settings.Secure.PREFERRED_CDMA_SUBSCRIPTION, preferredCdmaSubscription);
|
// the configuration, bug 4202572. And the ril issues the
|
||||||
Log.i(LOG_TAG, "Cdma Subscription set to " + Integer.toString(cdmaSubscription));
|
// 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
|
//reads the system properties and makes commandsinterface
|
||||||
sCommandsInterface = new RIL(context, networkMode, cdmaSubscription);
|
sCommandsInterface = new RIL(context, networkMode, cdmaSubscription);
|
||||||
|
|||||||
@@ -235,9 +235,6 @@ public final class RIL extends BaseCommands implements CommandsInterface {
|
|||||||
// WAKE_LOCK_TIMEOUT occurs.
|
// WAKE_LOCK_TIMEOUT occurs.
|
||||||
int mRequestMessagesWaiting;
|
int mRequestMessagesWaiting;
|
||||||
|
|
||||||
// Is this the first radio state change?
|
|
||||||
private boolean mInitialRadioStateChange = true;
|
|
||||||
|
|
||||||
//I'd rather this be LinkedList or something
|
//I'd rather this be LinkedList or something
|
||||||
ArrayList<RILRequest> mRequestsList = new ArrayList<RILRequest>();
|
ArrayList<RILRequest> mRequestsList = new ArrayList<RILRequest>();
|
||||||
|
|
||||||
@@ -614,11 +611,6 @@ public final class RIL extends BaseCommands implements CommandsInterface {
|
|||||||
|
|
||||||
|
|
||||||
//***** Constructors
|
//***** Constructors
|
||||||
public
|
|
||||||
RIL(Context context) {
|
|
||||||
this(context, RILConstants.PREFERRED_NETWORK_MODE,
|
|
||||||
RILConstants.PREFERRED_CDMA_SUBSCRIPTION);
|
|
||||||
}
|
|
||||||
|
|
||||||
public RIL(Context context, int networkMode, int cdmaSubscription) {
|
public RIL(Context context, int networkMode, int cdmaSubscription) {
|
||||||
super(context);
|
super(context);
|
||||||
@@ -1395,24 +1387,6 @@ public final class RIL extends BaseCommands implements CommandsInterface {
|
|||||||
|
|
||||||
public void
|
public void
|
||||||
setRadioPower(boolean on, Message result) {
|
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);
|
RILRequest rr = RILRequest.obtain(RIL_REQUEST_RADIO_POWER, result);
|
||||||
|
|
||||||
rr.mp.writeInt(1);
|
rr.mp.writeInt(1);
|
||||||
@@ -2059,26 +2033,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void switchToRadioState(RadioState newState) {
|
private void switchToRadioState(RadioState newState) {
|
||||||
|
setRadioState(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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2468,7 +2423,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
|
|||||||
case RIL_UNSOL_OEM_HOOK_RAW: ret = responseRaw(p); break;
|
case RIL_UNSOL_OEM_HOOK_RAW: ret = responseRaw(p); break;
|
||||||
case RIL_UNSOL_RINGBACK_TONE: ret = responseInts(p); break;
|
case RIL_UNSOL_RINGBACK_TONE: ret = responseInts(p); break;
|
||||||
case RIL_UNSOL_RESEND_INCALL_MUTE: ret = responseVoid(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_CDMA_PRL_CHANGED: ret = responseInts(p); break;
|
||||||
case RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE: ret = responseVoid(p); break;
|
case RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE: ret = responseVoid(p); break;
|
||||||
case RIL_UNSOL_RIL_CONNECTED: ret = responseInts(p); break;
|
case RIL_UNSOL_RIL_CONNECTED: ret = responseInts(p); break;
|
||||||
@@ -2776,7 +2731,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RIL_UNSOL_CDMA_SUBSCRIPTION_CHANGED:
|
case RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED:
|
||||||
if (RILJ_LOGD) unsljLogRet(response, ret);
|
if (RILJ_LOGD) unsljLogRet(response, ret);
|
||||||
|
|
||||||
if (mCdmaSubscriptionChangedRegistrants != null) {
|
if (mCdmaSubscriptionChangedRegistrants != null) {
|
||||||
@@ -2805,6 +2760,11 @@ public final class RIL extends BaseCommands implements CommandsInterface {
|
|||||||
|
|
||||||
case RIL_UNSOL_RIL_CONNECTED: {
|
case RIL_UNSOL_RIL_CONNECTED: {
|
||||||
if (RILJ_LOGD) unsljLogRet(response, ret);
|
if (RILJ_LOGD) unsljLogRet(response, ret);
|
||||||
|
|
||||||
|
// Initial conditions
|
||||||
|
setRadioPower(false, null);
|
||||||
|
setPreferredNetworkType(mNetworkMode, null);
|
||||||
|
setCdmaSubscriptionSource(mCdmaSubscription, null);
|
||||||
notifyRegistrantsRilConnectionChanged(((int[])ret)[0]);
|
notifyRegistrantsRilConnectionChanged(((int[])ret)[0]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3555,7 +3515,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
|
|||||||
case RIL_UNSOL_OEM_HOOK_RAW: return "UNSOL_OEM_HOOK_RAW";
|
case RIL_UNSOL_OEM_HOOK_RAW: return "UNSOL_OEM_HOOK_RAW";
|
||||||
case RIL_UNSOL_RINGBACK_TONE: return "UNSOL_RINGBACK_TONG";
|
case RIL_UNSOL_RINGBACK_TONE: return "UNSOL_RINGBACK_TONG";
|
||||||
case RIL_UNSOL_RESEND_INCALL_MUTE: return "UNSOL_RESEND_INCALL_MUTE";
|
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_CDMA_PRL_CHANGED: return "UNSOL_CDMA_PRL_CHANGED";
|
||||||
case RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE: return "UNSOL_EXIT_EMERGENCY_CALLBACK_MODE";
|
case RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE: return "UNSOL_EXIT_EMERGENCY_CALLBACK_MODE";
|
||||||
case RIL_UNSOL_RIL_CONNECTED: return "UNSOL_RIL_CONNECTED";
|
case RIL_UNSOL_RIL_CONNECTED: return "UNSOL_RIL_CONNECTED";
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ cat include/telephony/ril.h | \
|
|||||||
int RIL_UNSOL_OEM_HOOK_RAW = 1028;
|
int RIL_UNSOL_OEM_HOOK_RAW = 1028;
|
||||||
int RIL_UNSOL_RINGBACK_TONE = 1029;
|
int RIL_UNSOL_RINGBACK_TONE = 1029;
|
||||||
int RIL_UNSOL_RESEND_INCALL_MUTE = 1030;
|
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_CDMA_PRL_CHANGED = 1032;
|
||||||
int RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE = 1033;
|
int RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE = 1033;
|
||||||
int RIL_UNSOL_RIL_CONNECTED = 1034;
|
int RIL_UNSOL_RIL_CONNECTED = 1034;
|
||||||
|
|||||||
Reference in New Issue
Block a user