Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36d26c92 authored by Wink Saville's avatar Wink Saville Committed by Android (Google) Code Review
Browse files

Merge "Fix SPN_STRINGS_UPDATED_ACTION."

parents 3d019afc 0fa0d40b
Loading
Loading
Loading
Loading
+16 −31
Original line number Diff line number Diff line
@@ -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
        //   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();
            plmn = ss.getOperatorAlphaLong(); // mOperatorAlphaLong contains the ONS
            // showSpn = (rule & ...
            showPlmn = true; // showPlmn = (rule & ...

        } 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;
    }

+7 −2
Original line number Diff line number Diff line
@@ -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);