aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErica Chang <echang@cyngn.com>2015-04-09 12:37:20 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2015-04-10 22:37:54 +0000
commit92181e5046744bc5afcecad23374a704552005fb (patch)
tree5911436a41a369e68e113c046b39bc1230033188
parent52a9b6921b72072e61b58e49d31eeed300a2aa6f (diff)
downloadandroid_frameworks_opt_telephony-92181e5046744bc5afcecad23374a704552005fb.tar.gz
android_frameworks_opt_telephony-92181e5046744bc5afcecad23374a704552005fb.tar.bz2
android_frameworks_opt_telephony-92181e5046744bc5afcecad23374a704552005fb.zip
Telephony: add CDMA SPN display rule
Change-Id: Ie7c271441f6f7dfaf85f506735c8fd33c88732a4
-rw-r--r--src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java48
-rw-r--r--src/java/com/android/internal/telephony/uicc/RuimRecords.java48
2 files changed, 81 insertions, 15 deletions
diff --git a/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
index 5276962b7..6a66b34cd 100644
--- a/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
+++ b/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
@@ -132,6 +132,9 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
/** Contains the name of the registered network in CDMA (either ONS or ERI text). */
protected String mCurPlmn = null;
+ protected String mCurSpn = null;
+ protected boolean mCurShowPlmn = false;
+ protected boolean mCurShowSpn = false;
protected String mMdn;
protected int mHomeSystemId[] = null;
@@ -582,36 +585,58 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
@Override
protected void updateSpnDisplay() {
// mOperatorAlphaLong contains the ERI text
- String plmn = mSS.getOperatorAlphaLong();
+ String plmn = null;
+ String spn = null;
+ boolean showPlmn = false;
+ boolean showSpn = false;
+ int rule = 0;
+ int combinedRegState;
+
+ rule = (mIccRecords != null) ? mIccRecords.getDisplayRule(mSS.getOperatorNumeric()) : 0;
+ combinedRegState = getCombinedRegState();
- int combinedRegState = getCombinedRegState();
if (combinedRegState == ServiceState.STATE_OUT_OF_SERVICE) {
+ // display out of service
+ showPlmn = true;
plmn = Resources.getSystem().getText(com.android.internal.
R.string.lockscreen_carrier_default).toString();
if (DBG) log("updateSpnDisplay: radio is on but out " +
"of service, set plmn='" + plmn + "'");
+ } else if (combinedRegState == ServiceState.STATE_IN_SERVICE) {
+ // depends on the rule and whether plmn or spn is null
+ plmn = mSS.getOperatorAlphaLong();
+ showPlmn = ( !TextUtils.isEmpty(plmn)) &&
+ ((rule & RuimRecords.SPN_RULE_SHOW_PLMN) == RuimRecords.SPN_RULE_SHOW_PLMN);
+ spn = (mIccRecords != null) ? mIccRecords.getServiceProviderName() : "";
+ showSpn = (!TextUtils.isEmpty(spn)) &&
+ ((rule & RuimRecords.SPN_RULE_SHOW_SPN) == RuimRecords.SPN_RULE_SHOW_SPN);
+ } else {
+ // power off state (airplane mode), show nothing
}
- 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
- // "No Service". Now showPlmn is set to true for any non null string.
- boolean showPlmn = plmn != null;
+ // Update if any value changes
+ if (showPlmn != mCurShowPlmn
+ || showSpn != mCurShowSpn
+ || !TextUtils.equals(spn, mCurSpn)
+ || !TextUtils.equals(plmn, mCurPlmn)) {
+
if (DBG) {
log(String.format("updateSpnDisplay: changed sending intent" +
" showPlmn='%b' plmn='%s'", showPlmn, plmn));
}
Intent intent = new Intent(TelephonyIntents.SPN_STRINGS_UPDATED_ACTION);
intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
- intent.putExtra(TelephonyIntents.EXTRA_SHOW_SPN, false);
- intent.putExtra(TelephonyIntents.EXTRA_SPN, "");
+ intent.putExtra(TelephonyIntents.EXTRA_SHOW_SPN, showSpn);
+ intent.putExtra(TelephonyIntents.EXTRA_SPN, spn);
intent.putExtra(TelephonyIntents.EXTRA_SHOW_PLMN, showPlmn);
intent.putExtra(TelephonyIntents.EXTRA_PLMN, plmn);
SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhone.getPhoneId());
mPhone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL);
}
+ mCurShowSpn = showSpn;
+ mCurShowPlmn = showPlmn;
+ mCurSpn = spn;
mCurPlmn = plmn;
}
@@ -2002,6 +2027,9 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
pw.println(" mSavedAtTime=" + mSavedAtTime);
pw.println(" mWakeLock=" + mWakeLock);
pw.println(" mCurPlmn=" + mCurPlmn);
+ pw.println(" mCurShowPmn=" + mCurShowPlmn);
+ pw.println(" mCurSpn=" + mCurSpn);
+ pw.println(" mCurShowSpn=" + mCurShowSpn);
pw.println(" mMdn=" + mMdn);
pw.println(" mHomeSystemId=" + mHomeSystemId);
pw.println(" mHomeNetworkId=" + mHomeNetworkId);
diff --git a/src/java/com/android/internal/telephony/uicc/RuimRecords.java b/src/java/com/android/internal/telephony/uicc/RuimRecords.java
index 702d10320..ae3076ae8 100644
--- a/src/java/com/android/internal/telephony/uicc/RuimRecords.java
+++ b/src/java/com/android/internal/telephony/uicc/RuimRecords.java
@@ -1008,13 +1008,51 @@ public final class RuimRecords extends IccRecords {
/**
* {@inheritDoc}
- *
- * No Display rule for RUIMs yet.
*/
@Override
- public int getDisplayRule(String plmn) {
- // TODO together with spn
- return 0;
+ public int getDisplayRule(String plmnNumeric) {
+ int rule = 0;
+
+ if ((mContext != null) && mContext.getResources().getBoolean(
+ com.android.internal.R.bool.def_telephony_spn_spec_enabled)) {
+ // Always display the SPN only from RUIM
+ rule = SPN_RULE_SHOW_SPN;
+ } else if (mParentApp != null && mParentApp.getUiccCard() != null &&
+ mParentApp.getUiccCard().getOperatorBrandOverride() != null) {
+ // use operator brand override
+ rule = SPN_RULE_SHOW_PLMN;
+ } else if (TextUtils.isEmpty(getServiceProviderName())) {
+ // EF_SPN content not found on this RUIM, or not yet loaded
+ rule = SPN_RULE_SHOW_PLMN;
+ } else if (isOnMatchingPlmn(plmnNumeric)) {
+ // on home network
+ if (mCsimSpnDisplayCondition && !TextUtils.isEmpty(getServiceProviderName())) {
+ // check CSIM SPN Display Condition (applicable on home network),
+ // but only if SPN was found on this RUIM
+ rule = SPN_RULE_SHOW_SPN;
+ } else {
+ // CSIM SPN Display does not require a SPN display, or SPN not found on RUIM,
+ // then revert to currently registered network
+ rule = SPN_RULE_SHOW_PLMN;
+ }
+ } else {
+ // roaming, use the currently registered network
+ rule = SPN_RULE_SHOW_PLMN;
+ }
+
+ return rule;
+ }
+
+ /**
+ * Checks if currently registered PLMN is home PLMN
+ * (PLMN numeric matches the one reported in CSIM)
+ */
+ private boolean isOnMatchingPlmn(String plmnNumeric) {
+ if (plmnNumeric == null) return false;
+ if (plmnNumeric.equals(getOperatorNumeric())) {
+ return true;
+ }
+ return false;
}
@Override