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

Commit 00137c6a authored by Zhang Fang's avatar Zhang Fang
Browse files

Fix the wrong CDMA carrier text in expanded status bar

After updating operator, the expanded status bar will update SPN.
For GSM, it will display "no service" if service is out of service.
For CDMA, it always displays SPN which set from RuimRecords.java
 and it displays CDMA carrier.

Check current service state whether out of service, if yes, display
 "no service" instead of SPN.

Change-Id: I71bb32443e0cfaa8c2d77f928b428febed94fca8
CRs-Fixed: 711942
parent a82f430b
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.app.AlarmManager;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.os.AsyncResult;
import android.os.Build;
@@ -579,6 +580,14 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
        // mOperatorAlphaLong contains the ERI text
        String plmn = mSS.getOperatorAlphaLong();

        int combinedRegState = getCombinedRegState();
        if (combinedRegState == ServiceState.STATE_OUT_OF_SERVICE) {
            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 + "'");
        }

        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
@@ -602,6 +611,23 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
        mCurPlmn = plmn;
    }

    /**
     * Consider dataRegState if voiceRegState is OOS to determine SPN to be
     * displayed
     */
    private int getCombinedRegState() {
        int regState = mSS.getVoiceRegState();
        int dataRegState = mSS.getDataRegState();

        if ((regState == ServiceState.STATE_OUT_OF_SERVICE)
                && (dataRegState == ServiceState.STATE_IN_SERVICE)) {
            log("getCombinedRegState: return STATE_IN_SERVICE as Data is in service");
            regState = dataRegState;
        }

        return regState;
    }

    @Override
    protected Phone getPhone() {
        return mPhone;