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
This commit is contained in:
Wink Saville
2011-12-07 20:07:54 -08:00
parent ca0a68cc8a
commit 975d348c18
5 changed files with 33 additions and 0 deletions

View File

@@ -683,6 +683,13 @@ public abstract class BaseCommands implements CommandsInterface {
mRilConnectedRegistrants.remove(h);
}
/**
* {@inheritDoc}
*/
@Override
public void setCurrentPreferredNetworkType() {
}
//***** Protected Methods
/**
* Store new RadioState and send notification based on the changes

View File

@@ -1310,6 +1310,12 @@ public interface CommandsInterface {
*/
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)

View File

@@ -1820,6 +1820,16 @@ public final class RIL extends BaseCommands implements CommandsInterface {
send(rr);
}
/**
* {@inheritDoc}
*/
@Override
public void setCurrentPreferredNetworkType() {
if (RILJ_LOGD) riljLog("setCurrentPreferredNetworkType: " + mSetPreferredNetworkType);
setPreferredNetworkType(mSetPreferredNetworkType, null);
}
private int mSetPreferredNetworkType;
/**
* {@inheritDoc}
*/
@@ -1830,6 +1840,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
rr.mp.writeInt(1);
rr.mp.writeInt(networkType);
mSetPreferredNetworkType = networkType;
mPreferredNetworkType = networkType;
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)

View File

@@ -257,6 +257,9 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
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 class CdmaServiceStateTracker extends ServiceStateTracker {
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 File

@@ -270,6 +270,9 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
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.