Bring back ERI into CDMA-LTE mode

Use ERI mechanism for roaming determination in CDMA-LTE mode.
Also display SPN name from CSIM card as "SPN" field in the status bar.
PLMN field will be derived from ERI text as done in original CDMA phone.

Bug: 4970448
Change-Id: I21382b15e148a8451f4c3fcbbb5d1ed296e41b5a
This commit is contained in:
Kazuhiro Ondo
2011-07-01 15:23:37 -05:00
committed by Wink Saville
parent 97667d0cb3
commit c8e2916d0b
4 changed files with 73 additions and 21 deletions

View File

@@ -1030,13 +1030,8 @@ public class CDMAPhone extends PhoneBase {
case EVENT_NV_READY:{ case EVENT_NV_READY:{
Log.d(LOG_TAG, "Event EVENT_NV_READY Received"); Log.d(LOG_TAG, "Event EVENT_NV_READY Received");
//Inform the Service State Tracker //Inform the Service State Tracker
mEriManager.loadEriFile();
mNvLoadedRegistrants.notifyRegistrants(); mNvLoadedRegistrants.notifyRegistrants();
if(mEriManager.isEriFileLoaded()) { prepareEri();
// when the ERI file is loaded
Log.d(LOG_TAG, "ERI read, notify registrants");
mEriFileLoadedRegistrants.notifyRegistrants();
}
} }
break; break;
@@ -1421,6 +1416,19 @@ public class CDMAPhone extends PhoneBase {
return false; return false;
} }
public void prepareEri() {
mEriManager.loadEriFile();
if(mEriManager.isEriFileLoaded()) {
// when the ERI file is loaded
log("ERI read, notify registrants");
mEriFileLoadedRegistrants.notifyRegistrants();
}
}
public boolean isEriFileLoaded() {
return mEriManager.isEriFileLoaded();
}
protected void log(String s) { protected void log(String s) {
if (DBG) if (DBG)
Log.d(LOG_TAG, "[CDMAPhone] " + s); Log.d(LOG_TAG, "[CDMAPhone] " + s);

View File

@@ -21,13 +21,15 @@ import com.android.internal.telephony.MccTable;
import com.android.internal.telephony.EventLogTags; import com.android.internal.telephony.EventLogTags;
import com.android.internal.telephony.RILConstants; import com.android.internal.telephony.RILConstants;
import android.content.Intent;
import android.telephony.SignalStrength; import android.telephony.SignalStrength;
import android.telephony.ServiceState; import android.telephony.ServiceState;
import android.telephony.cdma.CdmaCellLocation; import android.telephony.cdma.CdmaCellLocation;
import android.os.AsyncResult; import android.os.AsyncResult;
import android.os.Message; import android.os.Message;
import android.provider.Telephony.Intents;
import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.util.EventLog; import android.util.EventLog;
@@ -37,6 +39,7 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
CDMALTEPhone mCdmaLtePhone; CDMALTEPhone mCdmaLtePhone;
private ServiceState mLteSS; // The last LTE state from Voice Registration private ServiceState mLteSS; // The last LTE state from Voice Registration
private String mCurrentSpn = null;
public CdmaLteServiceStateTracker(CDMALTEPhone phone) { public CdmaLteServiceStateTracker(CDMALTEPhone phone) {
super(phone); super(phone);
@@ -73,6 +76,9 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
pollState(); pollState();
// Signal strength polling stops when radio is off. // Signal strength polling stops when radio is off.
queueNextSignalStrengthPoll(); queueNextSignalStrengthPoll();
// load ERI file
phone.prepareEri();
break; break;
case EVENT_SIM_RECORDS_LOADED: case EVENT_SIM_RECORDS_LOADED:
CdmaLteUiccRecords sim = (CdmaLteUiccRecords)phone.mIccRecords; CdmaLteUiccRecords sim = (CdmaLteUiccRecords)phone.mIccRecords;
@@ -84,6 +90,10 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
mIsMinInfoReady = true; mIsMinInfoReady = true;
updateOtaspState(); updateOtaspState();
} }
// SID/NID/PRL is loaded. Poll service state
// again to update to the roaming state with
// the latest variables.
pollState();
break; break;
default: default:
super.handleMessage(msg); super.handleMessage(msg);
@@ -319,7 +329,7 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
} }
if (hasChanged) { if (hasChanged) {
if (cm.getNvState().isNVReady()) { if (phone.isEriFileLoaded()) {
String eriText; String eriText;
// Now the CDMAPhone sees the new ServiceState so it can get the // Now the CDMAPhone sees the new ServiceState so it can get the
// new ERI text // new ERI text
@@ -334,13 +344,6 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
} }
ss.setOperatorAlphaLong(eriText); ss.setOperatorAlphaLong(eriText);
} }
if (cm.getSimState().isSIMReady()) {
// SIM is found on the device. Read the operator name from the card.
ss.setOperatorAlphaLong(phone.mIccRecords.getServiceProviderName());
// If SIM card is present, Eri will not be used. Turn it off
ss.setCdmaEriIconIndex(EriInfo.ROAMING_INDICATOR_OFF);
}
String operatorNumeric; String operatorNumeric;
@@ -464,6 +467,43 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
return provisioningState; return provisioningState;
} }
@Override
protected void updateSpnDisplay() {
// mOperatorAlphaLong contains the ERI text
String plmn = ss.getOperatorAlphaLong();
boolean showSpn = false;
String spn = null;
if (cm.getSimState().isSIMReady()) {
// SIM is found on the device. Read the operator name from the card.
showSpn = ((CdmaLteUiccRecords)phone.mIccRecords).getCsimSpnDisplayCondition();
spn = phone.mIccRecords.getServiceProviderName();
// double check we are not printing identicall test
if (TextUtils.equals(plmn, spn)) showSpn = false;
}
if (!TextUtils.equals(plmn, mCurPlmn) ||
!TextUtils.equals(spn, mCurrentSpn)) {
boolean showPlmn = plmn != null;
if (DBG) {
log(String.format("updateSpnDisplay: changed sending intent" +
" showPlmn='%b' plmn='%s' showSpn='%b' spn='%s'",
showPlmn, plmn, showSpn, spn));
}
Intent intent = new Intent(Intents.SPN_STRINGS_UPDATED_ACTION);
intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
intent.putExtra(Intents.EXTRA_SHOW_SPN, showSpn);
intent.putExtra(Intents.EXTRA_SPN, spn);
intent.putExtra(Intents.EXTRA_SHOW_PLMN, showPlmn);
intent.putExtra(Intents.EXTRA_PLMN, plmn);
phone.getContext().sendStickyBroadcast(intent);
}
mCurPlmn = plmn;
mCurrentSpn = spn;
}
@Override @Override
protected void log(String s) { protected void log(String s) {
Log.d(LOG_TAG, "[CdmaLteSST] " + s); Log.d(LOG_TAG, "[CdmaLteSST] " + s);

View File

@@ -38,7 +38,7 @@ public final class CdmaLteUiccRecords extends SIMRecords {
// From CSIM application // From CSIM application
private byte[] mEFpl = null; private byte[] mEFpl = null;
private byte[] mEFli = null; private byte[] mEFli = null;
boolean csimSpnDisplayCondition = false; boolean mCsimSpnDisplayCondition = false;
private String mMdn; private String mMdn;
private String mMin; private String mMin;
private String mPrlVersion; private String mPrlVersion;
@@ -235,7 +235,7 @@ public final class CdmaLteUiccRecords extends SIMRecords {
IccUtils.bytesToHexString(data)); IccUtils.bytesToHexString(data));
// C.S0065 for EF_SPN decoding // C.S0065 for EF_SPN decoding
csimSpnDisplayCondition = ((0x02 & data[0]) > 0)?true:false; mCsimSpnDisplayCondition = ((0x01 & data[0]) != 0) ? true : false;
int encoding = data[1]; int encoding = data[1];
int language = data[2]; int language = data[2];
@@ -272,7 +272,7 @@ public final class CdmaLteUiccRecords extends SIMRecords {
log("spn decode error: " + e); log("spn decode error: " + e);
} }
if (DBG) log("spn=" + spn); if (DBG) log("spn=" + spn);
if (DBG) log("spnCondition=" + csimSpnDisplayCondition); if (DBG) log("spnCondition=" + mCsimSpnDisplayCondition);
phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, spn); phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, spn);
} }
@@ -437,6 +437,10 @@ public final class CdmaLteUiccRecords extends SIMRecords {
return mPrlVersion; return mPrlVersion;
} }
public boolean getCsimSpnDisplayCondition() {
return mCsimSpnDisplayCondition;
}
@Override @Override
public boolean isProvisioned() { public boolean isProvisioned() {
// If UICC card has CSIM app, look for MDN and MIN field // If UICC card has CSIM app, look for MDN and MIN field

View File

@@ -127,7 +127,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
private static final String WAKELOCK_TAG = "ServiceStateTracker"; private static final String WAKELOCK_TAG = "ServiceStateTracker";
/** Contains the name of the registered network in CDMA (either ONS or ERI text). */ /** Contains the name of the registered network in CDMA (either ONS or ERI text). */
private String curPlmn = null; protected String mCurPlmn = null;
protected String mMdn; protected String mMdn;
private int mHomeSystemId[] = null; private int mHomeSystemId[] = null;
@@ -484,7 +484,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
// mOperatorAlphaLong contains the ERI text // mOperatorAlphaLong contains the ERI text
String plmn = ss.getOperatorAlphaLong(); String plmn = ss.getOperatorAlphaLong();
if (!TextUtils.equals(plmn, curPlmn)) { if (!TextUtils.equals(plmn, mCurPlmn)) {
// Allow A blank plmn, "" to set showPlmn to true. Previously, we // Allow A blank plmn, "" to set showPlmn to true. Previously, we
// would set showPlmn to true only if plmn was not empty, i.e. was not // would set showPlmn to true only if plmn was not empty, i.e. was not
// null and not blank. But this would cause us to incorrectly display // null and not blank. But this would cause us to incorrectly display
@@ -503,7 +503,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
phone.getContext().sendStickyBroadcast(intent); phone.getContext().sendStickyBroadcast(intent);
} }
curPlmn = plmn; mCurPlmn = plmn;
} }
@Override @Override