case EVENT_NV_READY:{
Log.d(LOG_TAG, "Event EVENT_NV_READY Received");
//Inform the Service State Tracker
- mEriManager.loadEriFile();
mNvLoadedRegistrants.notifyRegistrants();
- if(mEriManager.isEriFileLoaded()) {
- // when the ERI file is loaded
- Log.d(LOG_TAG, "ERI read, notify registrants");
- mEriFileLoadedRegistrants.notifyRegistrants();
- }
+ prepareEri();
}
break;
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) {
if (DBG)
Log.d(LOG_TAG, "[CDMAPhone] " + s);
import com.android.internal.telephony.EventLogTags;
import com.android.internal.telephony.RILConstants;
+import android.content.Intent;
import android.telephony.SignalStrength;
import android.telephony.ServiceState;
import android.telephony.cdma.CdmaCellLocation;
import android.os.AsyncResult;
import android.os.Message;
+import android.provider.Telephony.Intents;
-
+import android.text.TextUtils;
import android.util.Log;
import android.util.EventLog;
CDMALTEPhone mCdmaLtePhone;
private ServiceState mLteSS; // The last LTE state from Voice Registration
+ private String mCurrentSpn = null;
public CdmaLteServiceStateTracker(CDMALTEPhone phone) {
super(phone);
pollState();
// Signal strength polling stops when radio is off.
queueNextSignalStrengthPoll();
+
+ // load ERI file
+ phone.prepareEri();
break;
case EVENT_SIM_RECORDS_LOADED:
CdmaLteUiccRecords sim = (CdmaLteUiccRecords)phone.mIccRecords;
mIsMinInfoReady = true;
updateOtaspState();
}
+ // SID/NID/PRL is loaded. Poll service state
+ // again to update to the roaming state with
+ // the latest variables.
+ pollState();
break;
default:
super.handleMessage(msg);
}
if (hasChanged) {
- if (cm.getNvState().isNVReady()) {
+ if (phone.isEriFileLoaded()) {
String eriText;
// Now the CDMAPhone sees the new ServiceState so it can get the
// new ERI text
}
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;
}
@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
protected void log(String s) {
Log.d(LOG_TAG, "[CdmaLteSST] " + s);
}
// From CSIM application
private byte[] mEFpl = null;
private byte[] mEFli = null;
- boolean csimSpnDisplayCondition = false;
+ boolean mCsimSpnDisplayCondition = false;
private String mMdn;
private String mMin;
private String mPrlVersion;
IccUtils.bytesToHexString(data));
// 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 language = data[2];
log("spn decode error: " + e);
}
if (DBG) log("spn=" + spn);
- if (DBG) log("spnCondition=" + csimSpnDisplayCondition);
+ if (DBG) log("spnCondition=" + mCsimSpnDisplayCondition);
phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, spn);
}
return mPrlVersion;
}
+ public boolean getCsimSpnDisplayCondition() {
+ return mCsimSpnDisplayCondition;
+ }
+
@Override
public boolean isProvisioned() {
// If UICC card has CSIM app, look for MDN and MIN field
private static final String WAKELOCK_TAG = "ServiceStateTracker";
/** 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;
private int mHomeSystemId[] = null;
// mOperatorAlphaLong contains the ERI text
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
// 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
phone.getContext().sendStickyBroadcast(intent);
}
- curPlmn = plmn;
+ mCurPlmn = plmn;
}
@Override