Loading src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java +38 −10 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } Loading Loading @@ -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); Loading src/java/com/android/internal/telephony/uicc/RuimRecords.java +43 −5 Original line number Diff line number Diff line Loading @@ -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 Loading Loading
src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java +38 −10 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } Loading Loading @@ -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); Loading
src/java/com/android/internal/telephony/uicc/RuimRecords.java +43 −5 Original line number Diff line number Diff line Loading @@ -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 Loading