Permalink
Browse files

When the SIM_READY set current preferred network type.

This looks to fix a problem where the nv_data.bin file
file gets corrupted. When greping a radio log for "md5" if something
like following is seen:

  RIL(s)  : load_md5_state: MD5 state 1
  RIL(s)  : check_md5:
  RIL(s)  : compute_md5: path /efs/nv_data.bin
  RIL(s)  : check_md5: MD5 fail. orignal md5 '628647a8e5c6cac2d586199417c0103c' computed md5 '58a635cbaf5fe4ffb2797aeaa2b32709' (rild)
  RIL(s)  : check_md5:
  RIL(s)  : compute_md5: path /efs/.nv_data.bak

It means that corruption was detected and a back version was used
which is ok. Apparently that backup version can have the default
network type revert to 2G only thus causing the symptoms reported
in b/5695729 where after taking an OTA 2G becomes the default.

By calling setCurrentPreferredNetworkType when the sim is ready we
can reset the the network type to 3G.

Note: I also tried calling setCurrentPreferredNetworkType in
EVENT_RADIO_AVAILABLE but that didn't work and we would see
the response to setPreferredNetworkType failing as the ril wasn't ready.

  RILJ    : setCurrentPreferredNetworkType: 0
  RILJ    : [0004]> REQUEST_SET_PREFERRED_NETWORK_TYPE : 0
  RILJ    : [0004]< REQUEST_SET_PREFERRED_NETWORK_TYPE error: com.android.internal.telephony.CommandException: RADIO_NOT_AVAILABLE


Bug: 5695729
Change-Id: Ibbd29cda0b201a8c08f4dcfa5cec211611e1d599
  • Loading branch information...
1 parent ca0a68c commit 975d348c18f7b9d378bebf3f69e6197b261705f0 Wink Saville committed Dec 8, 2011
View
7 telephony/java/com/android/internal/telephony/BaseCommands.java
@@ -683,6 +683,13 @@ public void unregisterForRilConnected(Handler h) {
mRilConnectedRegistrants.remove(h);
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setCurrentPreferredNetworkType() {
+ }
+
//***** Protected Methods
/**
* Store new RadioState and send notification based on the changes
View
6 telephony/java/com/android/internal/telephony/CommandsInterface.java
@@ -1311,6 +1311,12 @@ void setFacilityLockForApp(String facility, boolean lockState, String password,
void queryAvailableBandMode (Message response);
/**
+ * Set the current preferred network type. This will be the last
+ * networkType that was passed to setPreferredNetworkType.
+ */
+ void setCurrentPreferredNetworkType();
+
+ /**
* Requests to set the preferred network type for searching and registering
* (CS/PS domain, RAT, and operation mode)
* @param networkType one of NT_*_TYPE
View
11 telephony/java/com/android/internal/telephony/RIL.java
@@ -1823,13 +1823,24 @@ public void handleCallSetupRequestFromSim(
/**
* {@inheritDoc}
*/
+ @Override
+ public void setCurrentPreferredNetworkType() {
+ if (RILJ_LOGD) riljLog("setCurrentPreferredNetworkType: " + mSetPreferredNetworkType);
+ setPreferredNetworkType(mSetPreferredNetworkType, null);
+ }
+ private int mSetPreferredNetworkType;
+
+ /**
+ * {@inheritDoc}
+ */
public void setPreferredNetworkType(int networkType , Message response) {
RILRequest rr = RILRequest.obtain(
RILConstants.RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE, response);
rr.mp.writeInt(1);
rr.mp.writeInt(networkType);
+ mSetPreferredNetworkType = networkType;
mPreferredNetworkType = networkType;
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
View
6 telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
@@ -257,6 +257,9 @@ public void handleMessage (Message msg) {
break;
case EVENT_RUIM_READY:
+ // TODO: Consider calling setCurrentPreferredNetworkType as we do in GsmSST.
+ // cm.setCurrentPreferredNetworkType();
+
// The RUIM is now ready i.e if it was locked it has been
// unlocked. At this stage, the radio is already powered on.
isSubscriptionFromRuim = true;
@@ -277,6 +280,9 @@ public void handleMessage (Message msg) {
break;
case EVENT_NV_READY:
+ // TODO: Consider calling setCurrentPreferredNetworkType as we do in GsmSST.
+ // cm.setCurrentPreferredNetworkType();
+
isSubscriptionFromRuim = false;
// For Non-RUIM phones, the subscription information is stored in
// Non Volatile. Here when Non-Volatile is ready, we can poll the CDMA
View
3 telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
@@ -270,6 +270,9 @@ public void handleMessage (Message msg) {
break;
case EVENT_SIM_READY:
+ // Set the network type, in case the radio does not restore it.
+ cm.setCurrentPreferredNetworkType();
+
// The SIM is now ready i.e if it was locked
// it has been unlocked. At this stage, the radio is already
// powered on.

0 comments on commit 975d348

Please sign in to comment.