Merge "Add RIL_UNSOL_RIL_CONNECTED and pass radio technology + 2 to setupDataCall." into honeycomb-LTE
This commit is contained in:
@@ -71,6 +71,7 @@ public abstract class BaseCommands implements CommandsInterface {
|
|||||||
protected RegistrantList mCdmaSubscriptionChangedRegistrants = new RegistrantList();
|
protected RegistrantList mCdmaSubscriptionChangedRegistrants = new RegistrantList();
|
||||||
protected RegistrantList mCdmaPrlChangedRegistrants = new RegistrantList();
|
protected RegistrantList mCdmaPrlChangedRegistrants = new RegistrantList();
|
||||||
protected RegistrantList mExitEmergencyCallbackModeRegistrants = new RegistrantList();
|
protected RegistrantList mExitEmergencyCallbackModeRegistrants = new RegistrantList();
|
||||||
|
protected RegistrantList mRilConnectedRegistrants = new RegistrantList();
|
||||||
|
|
||||||
protected Registrant mSMSRegistrant;
|
protected Registrant mSMSRegistrant;
|
||||||
protected Registrant mNITZTimeRegistrant;
|
protected Registrant mNITZTimeRegistrant;
|
||||||
@@ -96,7 +97,8 @@ public abstract class BaseCommands implements CommandsInterface {
|
|||||||
protected int mCdmaSubscription;
|
protected int mCdmaSubscription;
|
||||||
// Type of Phone, GSM or CDMA. Set by CDMAPhone or GSMPhone.
|
// Type of Phone, GSM or CDMA. Set by CDMAPhone or GSMPhone.
|
||||||
protected int mPhoneType;
|
protected int mPhoneType;
|
||||||
|
// RIL Version
|
||||||
|
protected int mRilVersion = -1;
|
||||||
|
|
||||||
public BaseCommands(Context context) {
|
public BaseCommands(Context context) {
|
||||||
mContext = context; // May be null (if so we won't log statistics)
|
mContext = context; // May be null (if so we won't log statistics)
|
||||||
@@ -639,6 +641,25 @@ public abstract class BaseCommands implements CommandsInterface {
|
|||||||
mExitEmergencyCallbackModeRegistrants.remove(h);
|
mExitEmergencyCallbackModeRegistrants.remove(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void registerForRilConnected(Handler h, int what, Object obj) {
|
||||||
|
Log.d(LOG_TAG, "registerForRilConnected h=" + h + " w=" + what);
|
||||||
|
Registrant r = new Registrant (h, what, obj);
|
||||||
|
mRilConnectedRegistrants.add(r);
|
||||||
|
if (mRilVersion != -1) {
|
||||||
|
Log.d(LOG_TAG, "Notifying: ril connected mRilVersion=" + mRilVersion);
|
||||||
|
r.notifyRegistrant(new AsyncResult(null, new Integer(mRilVersion), null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unregisterForRilConnected(Handler h) {
|
||||||
|
mRilConnectedRegistrants.remove(h);
|
||||||
|
}
|
||||||
|
|
||||||
//***** Protected Methods
|
//***** Protected Methods
|
||||||
/**
|
/**
|
||||||
* Store new RadioState and send notification based on the changes
|
* Store new RadioState and send notification based on the changes
|
||||||
|
|||||||
@@ -604,6 +604,20 @@ public interface CommandsInterface {
|
|||||||
void registerForExitEmergencyCallbackMode(Handler h, int what, Object obj);
|
void registerForExitEmergencyCallbackMode(Handler h, int what, Object obj);
|
||||||
void unregisterForExitEmergencyCallbackMode(Handler h);
|
void unregisterForExitEmergencyCallbackMode(Handler h);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers the handler for RIL_UNSOL_RIL_CONNECT events.
|
||||||
|
*
|
||||||
|
* When ril connects or disconnects a message is sent to the registrant
|
||||||
|
* which contains an AsyncResult, ar, in msg.obj. The ar.result is an
|
||||||
|
* Integer which is the version of the ril or -1 if the ril disconnected.
|
||||||
|
*
|
||||||
|
* @param h Handler for notification message.
|
||||||
|
* @param what User-defined message code.
|
||||||
|
* @param obj User object.
|
||||||
|
*/
|
||||||
|
void registerForRilConnected(Handler h, int what, Object obj);
|
||||||
|
void unregisterForRilConnected(Handler h);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Supply the ICC PIN to the ICC card
|
* Supply the ICC PIN to the ICC card
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -194,6 +194,7 @@ public abstract class DataConnection extends HierarchicalStateMachine {
|
|||||||
protected static final int EVENT_GET_LAST_FAIL_DONE = 4;
|
protected static final int EVENT_GET_LAST_FAIL_DONE = 4;
|
||||||
protected static final int EVENT_DEACTIVATE_DONE = 5;
|
protected static final int EVENT_DEACTIVATE_DONE = 5;
|
||||||
protected static final int EVENT_DISCONNECT = 6;
|
protected static final int EVENT_DISCONNECT = 6;
|
||||||
|
protected static final int EVENT_RIL_CONNECTED = 7;
|
||||||
|
|
||||||
//***** Tag IDs for EventLog
|
//***** Tag IDs for EventLog
|
||||||
protected static final int EVENT_LOG_BAD_DNS_ADDRESS = 50100;
|
protected static final int EVENT_LOG_BAD_DNS_ADDRESS = 50100;
|
||||||
@@ -202,6 +203,7 @@ public abstract class DataConnection extends HierarchicalStateMachine {
|
|||||||
protected ApnSetting mApn;
|
protected ApnSetting mApn;
|
||||||
protected int mTag;
|
protected int mTag;
|
||||||
protected PhoneBase phone;
|
protected PhoneBase phone;
|
||||||
|
protected int mRilVersion = -1;
|
||||||
protected int cid;
|
protected int cid;
|
||||||
protected LinkProperties mLinkProperties = new LinkProperties();
|
protected LinkProperties mLinkProperties = new LinkProperties();
|
||||||
protected LinkCapabilities mCapabilities = new LinkCapabilities();
|
protected LinkCapabilities mCapabilities = new LinkCapabilities();
|
||||||
@@ -320,6 +322,16 @@ public abstract class DataConnection extends HierarchicalStateMachine {
|
|||||||
clearSettings();
|
clearSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected int getRadioTechnology(int defaultRadioTechnology) {
|
||||||
|
int radioTechnology;
|
||||||
|
if (mRilVersion < 6) {
|
||||||
|
radioTechnology = defaultRadioTechnology;
|
||||||
|
} else {
|
||||||
|
radioTechnology = phone.getServiceState().getRadioTechnology() + 2;
|
||||||
|
}
|
||||||
|
return radioTechnology;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* **************************************************************************
|
* **************************************************************************
|
||||||
* Begin Members and methods owned by DataConnectionTracker but stored
|
* Begin Members and methods owned by DataConnectionTracker but stored
|
||||||
@@ -472,6 +484,14 @@ public abstract class DataConnection extends HierarchicalStateMachine {
|
|||||||
* The parent state for all other states.
|
* The parent state for all other states.
|
||||||
*/
|
*/
|
||||||
private class DcDefaultState extends HierarchicalState {
|
private class DcDefaultState extends HierarchicalState {
|
||||||
|
@Override
|
||||||
|
protected void enter() {
|
||||||
|
phone.mCM.registerForRilConnected(getHandler(), EVENT_RIL_CONNECTED, null);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void exit() {
|
||||||
|
phone.mCM.unregisterForRilConnected(getHandler());
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
protected boolean processMessage(Message msg) {
|
protected boolean processMessage(Message msg) {
|
||||||
AsyncResult ar;
|
AsyncResult ar;
|
||||||
@@ -497,6 +517,20 @@ public abstract class DataConnection extends HierarchicalStateMachine {
|
|||||||
notifyDisconnectCompleted((DisconnectParams) msg.obj);
|
notifyDisconnectCompleted((DisconnectParams) msg.obj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EVENT_RIL_CONNECTED:
|
||||||
|
ar = (AsyncResult)msg.obj;
|
||||||
|
if (ar.exception == null) {
|
||||||
|
mRilVersion = (Integer)ar.result;
|
||||||
|
if (DBG) {
|
||||||
|
log("DcDefaultState: msg.what=EVENT_RIL_CONNECTED mRilVersion=" +
|
||||||
|
mRilVersion);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log("Unexpected exception on EVENT_RIL_CONNECTED");
|
||||||
|
mRilVersion = -1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
log("DcDefaultState: shouldn't happen but ignore msg.what=" + msg.what);
|
log("DcDefaultState: shouldn't happen but ignore msg.what=" + msg.what);
|
||||||
|
|||||||
@@ -605,6 +605,9 @@ public final class RIL extends BaseCommands implements CommandsInterface {
|
|||||||
}} catch (Throwable tr) {
|
}} catch (Throwable tr) {
|
||||||
Log.e(LOG_TAG,"Uncaught exception", tr);
|
Log.e(LOG_TAG,"Uncaught exception", tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We're disconnected so we don't know the ril version */
|
||||||
|
notifyRegistrantsRilConnectionChanged(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2468,6 +2471,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
|
|||||||
case RIL_UNSOL_CDMA_SUBSCRIPTION_CHANGED: ret = responseInts(p); break;
|
case RIL_UNSOL_CDMA_SUBSCRIPTION_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;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new RuntimeException("Unrecognized unsol response: " + response);
|
throw new RuntimeException("Unrecognized unsol response: " + response);
|
||||||
@@ -2798,6 +2802,25 @@ public final class RIL extends BaseCommands implements CommandsInterface {
|
|||||||
new AsyncResult (null, null, null));
|
new AsyncResult (null, null, null));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RIL_UNSOL_RIL_CONNECTED: {
|
||||||
|
if (RILJ_LOGD) unsljLogRet(response, ret);
|
||||||
|
notifyRegistrantsRilConnectionChanged(((int[])ret)[0]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifiy all registrants that the ril has connected or disconnected.
|
||||||
|
*
|
||||||
|
* @param rilVer is the version of the ril or -1 if disconnected.
|
||||||
|
*/
|
||||||
|
private void notifyRegistrantsRilConnectionChanged(int rilVer) {
|
||||||
|
mRilVersion = rilVer;
|
||||||
|
if (mRilConnectedRegistrants != null) {
|
||||||
|
mRilConnectedRegistrants.notifyRegistrants(
|
||||||
|
new AsyncResult (null, new Integer(rilVer), null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3535,6 +3558,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
|
|||||||
case RIL_UNSOL_CDMA_SUBSCRIPTION_CHANGED: return "CDMA_SUBSCRIPTION_CHANGED";
|
case RIL_UNSOL_CDMA_SUBSCRIPTION_CHANGED: return "CDMA_SUBSCRIPTION_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";
|
||||||
default: return "<unknown reponse>";
|
default: return "<unknown reponse>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -289,4 +289,5 @@ cat include/telephony/ril.h | \
|
|||||||
int RIL_UNSOL_CDMA_SUBSCRIPTION_CHANGED = 1031;
|
int RIL_UNSOL_CDMA_SUBSCRIPTION_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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public class CdmaDataConnection extends DataConnection {
|
|||||||
Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp);
|
Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp);
|
||||||
msg.obj = cp;
|
msg.obj = cp;
|
||||||
phone.mCM.setupDataCall(
|
phone.mCM.setupDataCall(
|
||||||
Integer.toString(RILConstants.SETUP_DATA_TECH_CDMA),
|
Integer.toString(getRadioTechnology(RILConstants.SETUP_DATA_TECH_CDMA)),
|
||||||
Integer.toString(dataProfile),
|
Integer.toString(dataProfile),
|
||||||
null, null, null,
|
null, null, null,
|
||||||
Integer.toString(RILConstants.SETUP_DATA_AUTH_PAP_CHAP),
|
Integer.toString(RILConstants.SETUP_DATA_AUTH_PAP_CHAP),
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class GsmDataConnection extends DataConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
phone.mCM.setupDataCall(
|
phone.mCM.setupDataCall(
|
||||||
Integer.toString(RILConstants.SETUP_DATA_TECH_GSM),
|
Integer.toString(getRadioTechnology(RILConstants.SETUP_DATA_TECH_GSM)),
|
||||||
Integer.toString(mProfileId),
|
Integer.toString(mProfileId),
|
||||||
mApn.apn, mApn.user, mApn.password,
|
mApn.apn, mApn.user, mApn.password,
|
||||||
Integer.toString(authType),
|
Integer.toString(authType),
|
||||||
|
|||||||
Reference in New Issue
Block a user