diff options
Diffstat (limited to 'telephony')
8 files changed, 98 insertions, 4 deletions
diff --git a/telephony/java/com/android/internal/telephony/BaseCommands.java b/telephony/java/com/android/internal/telephony/BaseCommands.java index 0fc81b0..076db8b 100644 --- a/telephony/java/com/android/internal/telephony/BaseCommands.java +++ b/telephony/java/com/android/internal/telephony/BaseCommands.java @@ -71,6 +71,7 @@ public abstract class BaseCommands implements CommandsInterface { protected RegistrantList mCdmaSubscriptionChangedRegistrants = new RegistrantList(); protected RegistrantList mCdmaPrlChangedRegistrants = new RegistrantList(); protected RegistrantList mExitEmergencyCallbackModeRegistrants = new RegistrantList(); + protected RegistrantList mRilConnectedRegistrants = new RegistrantList(); protected Registrant mSMSRegistrant; protected Registrant mNITZTimeRegistrant; @@ -96,7 +97,8 @@ public abstract class BaseCommands implements CommandsInterface { protected int mCdmaSubscription; // Type of Phone, GSM or CDMA. Set by CDMAPhone or GSMPhone. protected int mPhoneType; - + // RIL Version + protected int mRilVersion = -1; public BaseCommands(Context context) { 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); } + /** + * {@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 /** * Store new RadioState and send notification based on the changes diff --git a/telephony/java/com/android/internal/telephony/CommandsInterface.java b/telephony/java/com/android/internal/telephony/CommandsInterface.java index 99217b3..1d574ca 100644 --- a/telephony/java/com/android/internal/telephony/CommandsInterface.java +++ b/telephony/java/com/android/internal/telephony/CommandsInterface.java @@ -604,6 +604,20 @@ public interface CommandsInterface { void registerForExitEmergencyCallbackMode(Handler h, int what, Object obj); 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 * diff --git a/telephony/java/com/android/internal/telephony/DataConnection.java b/telephony/java/com/android/internal/telephony/DataConnection.java index 4ab62e6..0ad5296 100644 --- a/telephony/java/com/android/internal/telephony/DataConnection.java +++ b/telephony/java/com/android/internal/telephony/DataConnection.java @@ -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_DEACTIVATE_DONE = 5; protected static final int EVENT_DISCONNECT = 6; + protected static final int EVENT_RIL_CONNECTED = 7; //***** Tag IDs for EventLog protected static final int EVENT_LOG_BAD_DNS_ADDRESS = 50100; @@ -202,6 +203,7 @@ public abstract class DataConnection extends HierarchicalStateMachine { protected ApnSetting mApn; protected int mTag; protected PhoneBase phone; + protected int mRilVersion = -1; protected int cid; protected LinkProperties mLinkProperties = new LinkProperties(); protected LinkCapabilities mCapabilities = new LinkCapabilities(); @@ -320,6 +322,16 @@ public abstract class DataConnection extends HierarchicalStateMachine { 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 @@ -473,6 +485,14 @@ public abstract class DataConnection extends HierarchicalStateMachine { */ 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 protected boolean processMessage(Message msg) { AsyncResult ar; @@ -497,6 +517,20 @@ public abstract class DataConnection extends HierarchicalStateMachine { notifyDisconnectCompleted((DisconnectParams) msg.obj); 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: if (DBG) { log("DcDefaultState: shouldn't happen but ignore msg.what=" + msg.what); diff --git a/telephony/java/com/android/internal/telephony/MccTable.java b/telephony/java/com/android/internal/telephony/MccTable.java index c0bf7ec..fde1b59 100644 --- a/telephony/java/com/android/internal/telephony/MccTable.java +++ b/telephony/java/com/android/internal/telephony/MccTable.java @@ -322,7 +322,7 @@ public final class MccTable table.add(new MccEntry(289,"ge",2)); //Abkhazia (Georgia) table.add(new MccEntry(290,"gl",2)); //Greenland (Denmark) table.add(new MccEntry(292,"sm",2)); //San Marino (Republic of) - table.add(new MccEntry(293,"sl",2)); //Slovenia (Republic of) + table.add(new MccEntry(293,"si",2)); //Slovenia (Republic of) table.add(new MccEntry(294,"mk",2)); //The Former Yugoslav Republic of Macedonia table.add(new MccEntry(295,"li",2)); //Liechtenstein (Principality of) table.add(new MccEntry(297,"me",2)); //Montenegro (Republic of) diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java index b0a265b..2633ca6 100644 --- a/telephony/java/com/android/internal/telephony/RIL.java +++ b/telephony/java/com/android/internal/telephony/RIL.java @@ -605,6 +605,9 @@ public final class RIL extends BaseCommands implements CommandsInterface { }} catch (Throwable 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_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; default: throw new RuntimeException("Unrecognized unsol response: " + response); @@ -2798,6 +2802,25 @@ public final class RIL extends BaseCommands implements CommandsInterface { new AsyncResult (null, null, null)); } 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_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"; default: return "<unknown reponse>"; } } diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java index 4faf297..73dfdc0 100644 --- a/telephony/java/com/android/internal/telephony/RILConstants.java +++ b/telephony/java/com/android/internal/telephony/RILConstants.java @@ -289,4 +289,5 @@ cat include/telephony/ril.h | \ int RIL_UNSOL_CDMA_SUBSCRIPTION_CHANGED = 1031; int RIL_UNSOl_CDMA_PRL_CHANGED = 1032; int RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE = 1033; + int RIL_UNSOL_RIL_CONNECTED = 1034; } diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnection.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnection.java index cccc053..124c888 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnection.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnection.java @@ -84,7 +84,7 @@ public class CdmaDataConnection extends DataConnection { Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp); msg.obj = cp; phone.mCM.setupDataCall( - Integer.toString(RILConstants.SETUP_DATA_TECH_CDMA), + Integer.toString(getRadioTechnology(RILConstants.SETUP_DATA_TECH_CDMA)), Integer.toString(dataProfile), null, null, null, Integer.toString(RILConstants.SETUP_DATA_AUTH_PAP_CHAP), diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnection.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnection.java index 2589de4..f4672d1 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnection.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnection.java @@ -102,7 +102,7 @@ public class GsmDataConnection extends DataConnection { } phone.mCM.setupDataCall( - Integer.toString(RILConstants.SETUP_DATA_TECH_GSM), + Integer.toString(getRadioTechnology(RILConstants.SETUP_DATA_TECH_GSM)), Integer.toString(mProfileId), mApn.apn, mApn.user, mApn.password, Integer.toString(authType), |