Merge "Fix SPN_STRINGS_UPDATED_ACTION."

This commit is contained in:
Wink Saville
2010-11-18 15:42:04 -08:00
committed by Android (Google) Code Review
2 changed files with 22 additions and 32 deletions

View File

@@ -128,10 +128,6 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
private PowerManager.WakeLock mWakeLock;
private static final String WAKELOCK_TAG = "ServiceStateTracker";
/** Track of SPN display rules, so we only broadcast intent if something changes. */
private String curSpn = null;
private int curSpnRule = 0;
/** Contains the name of the registered network in CDMA (either ONS or ERI text). */
private String curPlmn = null;
@@ -620,40 +616,29 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
@Override
protected void updateSpnDisplay() {
String spn = "";
boolean showSpn = false;
String plmn = "";
boolean showPlmn = false;
int rule = 0;
if (cm.getRadioState().isRUIMReady()) {
// TODO RUIM SPN is not implemented, EF_SPN has to be read and Display Condition
// Character Encoding, Language Indicator and SPN has to be set
// rule = phone.mRuimRecords.getDisplayRule(ss.getOperatorNumeric());
// spn = phone.mSIMRecords.getServiceProvideName();
plmn = ss.getOperatorAlphaLong(); // mOperatorAlphaLong contains the ONS
// showSpn = (rule & ...
showPlmn = true; // showPlmn = (rule & ...
// TODO RUIM SPN is not implemented, EF_SPN has to be read and Display Condition
// Character Encoding, Language Indicator and SPN has to be set, something like below:
// if (cm.getRadioState().isRUIMReady()) {
// rule = phone.mRuimRecords.getDisplayRule(ss.getOperatorNumeric());
// spn = phone.mSIMRecords.getServiceProvideName();
// }
} else {
// In this case there is no SPN available from RUIM, we show the ERI text
plmn = ss.getOperatorAlphaLong(); // mOperatorAlphaLong contains the ERI text
showPlmn = true;
}
if (rule != curSpnRule
|| !TextUtils.equals(spn, curSpn)
|| !TextUtils.equals(plmn, curPlmn)) {
// mOperatorAlphaLong contains the ERI text
String plmn = ss.getOperatorAlphaLong();
if (!TextUtils.equals(plmn, curPlmn)) {
boolean showPlmn = (plmn != null) && !TextUtils.equals(plmn, "");
Log.d(LOG_TAG,
String.format("updateSpnDisplay: changed sending intent" +
" showPlmn='%b' plmn='%s'", showPlmn, plmn));
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_SPN, false);
intent.putExtra(Intents.EXTRA_SPN, "");
intent.putExtra(Intents.EXTRA_SHOW_PLMN, showPlmn);
intent.putExtra(Intents.EXTRA_PLMN, plmn);
phone.getContext().sendStickyBroadcast(intent);
}
curSpnRule = rule;
curSpn = spn;
curPlmn = plmn;
}

View File

@@ -599,16 +599,21 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
if (mEmergencyOnly && cm.getRadioState().isOn()) {
plmn = Resources.getSystem().
getText(com.android.internal.R.string.emergency_calls_only).toString();
Log.d(LOG_TAG, "updateSpnDisplay: emergency only and radio is on plmn='" + plmn + "'");
}
if (rule != curSpnRule
|| !TextUtils.equals(spn, curSpn)
|| !TextUtils.equals(plmn, curPlmn)) {
boolean showSpn = !mEmergencyOnly
boolean showSpn = !mEmergencyOnly && !TextUtils.isEmpty(spn)
&& (rule & SIMRecords.SPN_RULE_SHOW_SPN) == SIMRecords.SPN_RULE_SHOW_SPN;
boolean showPlmn =
boolean showPlmn = !TextUtils.isEmpty(plmn) &&
(rule & SIMRecords.SPN_RULE_SHOW_PLMN) == SIMRecords.SPN_RULE_SHOW_PLMN;
Log.d(LOG_TAG,
String.format("updateSpnDisplay: changed sending intent" + " rule=" + rule +
" 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);