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

Commit e4892047 authored by Hariprasad Jayakumar's avatar Hariprasad Jayakumar Committed by Linux Build Service Account
Browse files

Telephony: Consider dataRegState to determine SPN display

There may be situations where 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.

Change-Id: Iab17ed07611b6fd95d6bc6ee3e2e095f6700e3ba
CRs-Fixed: 532471
parent 1847c4b6
Loading
Loading
Loading
Loading
+21 −3
Original line number Diff line number Diff line
@@ -594,8 +594,9 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
        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
@@ -608,7 +609,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
            }
            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) &&
@@ -655,6 +656,23 @@ final class GsmServiceStateTracker 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;
    }

    /**
     * Handle the result of one of the pollState()-related requests
     */