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

Commit 49a8f162 authored by Shiva Kishore Tekale's avatar Shiva Kishore Tekale Committed by Ruthwar Kumar Ambeer
Browse files

Telephony: Use data and voice states for SPN

SPN display text is based on both voice service state
and data service state.
Eg - Voice service state is OOS and data service state
is IN_SERVICE. In such cases, both regStates need to be
considered to determine what to show in UI for SPN.
Fix the wrong CDMA carrier text in expanded status bar.
After updating operator, the expanded status bar will
update SPN
For GSM, SPN is "no service" if service is out of service.
For CDMA, SPN is CDMA carrier. Check current service
state whether out of service, if yes, display "no service"
instead of SPN.
CRs-Fixed: 711942, 532471

Change-Id: Ic46ac0c7e3af51a380bb2db5d71a71bf9595c2ec
parent 9a1c5901
Loading
Loading
Loading
Loading
+28 −4
Original line number Diff line number Diff line
@@ -2110,8 +2110,9 @@ public class ServiceStateTracker extends Handler {
            String plmn = null;
            boolean showPlmn = false;
            int rule = (iccRecords != null) ? iccRecords.getDisplayRule(mSS.getOperatorNumeric()) : 0;
            if (mSS.getVoiceRegState() == ServiceState.STATE_OUT_OF_SERVICE
                    || mSS.getVoiceRegState() == ServiceState.STATE_EMERGENCY_ONLY) {
            int combinedRegState = getCombinedRegState();
            if (combinedRegState == ServiceState.STATE_OUT_OF_SERVICE
                    || combinedRegState == ServiceState.STATE_EMERGENCY_ONLY) {
                showPlmn = true;
                if (mEmergencyOnly) {
                    // No service but emergency call allowed
@@ -2124,7 +2125,7 @@ public class ServiceStateTracker extends Handler {
                }
                if (DBG) log("updateSpnDisplay: radio is on but out " +
                        "of service, set plmn='" + plmn + "'");
            } else if (mSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE) {
            } else if (combinedRegState == ServiceState.STATE_IN_SERVICE) {
                // In either home or roaming service
                plmn = mSS.getOperatorAlphaLong();
                showPlmn = !TextUtils.isEmpty(plmn) &&
@@ -2242,6 +2243,15 @@ public class ServiceStateTracker extends Handler {
                subId = subIds[0];
            }

            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 (mSubId != subId || !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
@@ -4869,6 +4879,20 @@ public class ServiceStateTracker extends Handler {
        return isInNetwork(b, network, CarrierConfigManager.KEY_CDMA_NONROAMING_NETWORKS_STRING_ARRAY);
    }

   /**
     * Consider dataRegState if voiceRegState is OOS to determine SPN to be displayed
     */
    protected 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;
    }

  /** Check if the device is shutting down. */
    public boolean isDeviceShuttingDown() {
        return mDeviceShuttingDown;