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

Commit b28c5032 authored by Jayachandran C's avatar Jayachandran C
Browse files

Use PLMN instead of SPN override for Rogers, DTAG and Telstra

Rogers, DTAG and Telstra want the actual SIM card SPN to be displayed

Having SPN override in /etc/spn-conf.xml always overrides SPN of the SIM
card irrespective of Wi-Fi calling registered or not. Carriers doesn't
like this as they don't see SIM card SPN even when the device is camped
on cellular RATs.

This CL
 1) Removes the carriers Rogers, DTAG and Telstra from spn-conf.xml.
 2) Adds a logic in updateSpnDisplay() to use PLMN if SPN is empty
    and Voice over Wi-Fi is registered case.

Test: Tested using T-Mobile SIM card after removing T-Mobile entries
      from the /etc/spn-conf.xml.

Bug: 64137294
Bug: 64139429
Change-Id: Ia350b4d06739f47d5da4eba0a5b0970af6db5f36
parent 1cc0f110
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -2162,8 +2162,15 @@ public class ServiceStateTracker extends Handler {

        String wfcVoiceSpnFormat = null;
        String wfcDataSpnFormat = null;
        if (mPhone.getImsPhone() != null && mPhone.getImsPhone().isWifiCallingEnabled()) {
            // In Wi-Fi Calling mode show SPN+WiFi
        int combinedRegState = getCombinedRegState();
        if (mPhone.getImsPhone() != null && mPhone.getImsPhone().isWifiCallingEnabled()
                && (combinedRegState == ServiceState.STATE_IN_SERVICE)) {
            // In Wi-Fi Calling mode show SPN or PLMN + WiFi Calling
            //
            // 1) Show SPN + Wi-Fi Calling If SIM has SPN and SPN display condition
            //    is satisfied or SPN override is enabled for this carrier
            //
            // 2) Show PLMN + Wi-Fi Calling if there is no valid SPN in case 1

            String[] wfcSpnFormats = mPhone.getContext().getResources().getStringArray(
                    com.android.internal.R.array.wfcSpnFormats);
@@ -2188,7 +2195,6 @@ public class ServiceStateTracker extends Handler {
            wfcDataSpnFormat = wfcSpnFormats[dataIdx];
        }

        int combinedRegState = getCombinedRegState();
        if (mPhone.isPhoneTypeGsm()) {
            // The values of plmn/showPlmn change in different scenarios.
            // 1) No service but emergency call allowed -> expected
@@ -2253,13 +2259,19 @@ public class ServiceStateTracker extends Handler {

            if (!TextUtils.isEmpty(spn) && !TextUtils.isEmpty(wfcVoiceSpnFormat) &&
                    !TextUtils.isEmpty(wfcDataSpnFormat)) {
                // In Wi-Fi Calling mode show SPN+WiFi
                // Show SPN + Wi-Fi Calling If SIM has SPN and SPN display condition
                // is satisfied or SPN override is enabled for this carrier.

                String originalSpn = spn.trim();
                spn = String.format(wfcVoiceSpnFormat, originalSpn);
                dataSpn = String.format(wfcDataSpnFormat, originalSpn);
                showSpn = true;
                showPlmn = false;
            } else if (!TextUtils.isEmpty(plmn) && !TextUtils.isEmpty(wfcVoiceSpnFormat)) {
                // Show PLMN + Wi-Fi Calling if there is no valid SPN in the above case

                String originalPlmn = plmn.trim();
                plmn = String.format(wfcVoiceSpnFormat, originalPlmn);
            } else if (mSS.getVoiceRegState() == ServiceState.STATE_POWER_OFF
                    || (showPlmn && TextUtils.equals(spn, plmn))) {
                // airplane mode or spn equals plmn, do not show spn