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

Commit 50c8a139 authored by Torbjorn Eklund's avatar Torbjorn Eklund
Browse files

Use correct spn text during Wi-Fi Calling and Flight mode

Read and use carrier config flag KEY_WFC_FLIGHT_MODE_SPN_FORMAT_IDX_INT
that controls spn-text during flight mode when Wi-Fi Calling is
registred.

Bug: 117953115
Test: Manual
Change-Id: I2f45e680ab21097a947ecefc3c1086bb5af9bc1e
parent 9981d8ad
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -2262,6 +2262,7 @@ public class ServiceStateTracker extends Handler {

        String wfcVoiceSpnFormat = null;
        String wfcDataSpnFormat = null;
        String wfcFlightSpnFormat = null;
        int combinedRegState = getCombinedRegState();
        if (mPhone.getImsPhone() != null && mPhone.getImsPhone().isWifiCallingEnabled()
                && (combinedRegState == ServiceState.STATE_IN_SERVICE)) {
@@ -2274,6 +2275,7 @@ public class ServiceStateTracker extends Handler {

            int voiceIdx = 0;
            int dataIdx = 0;
            int flightModeIdx = -1;
            boolean useRootLocale = false;
            CarrierConfigManager configLoader = (CarrierConfigManager)
                    mPhone.getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE);
@@ -2284,6 +2286,8 @@ public class ServiceStateTracker extends Handler {
                        voiceIdx = b.getInt(CarrierConfigManager.KEY_WFC_SPN_FORMAT_IDX_INT);
                        dataIdx = b.getInt(
                                CarrierConfigManager.KEY_WFC_DATA_SPN_FORMAT_IDX_INT);
                        flightModeIdx = b.getInt(
                                CarrierConfigManager.KEY_WFC_FLIGHT_MODE_SPN_FORMAT_IDX_INT);
                        useRootLocale =
                                b.getBoolean(CarrierConfigManager.KEY_WFC_SPN_USE_ROOT_LOCALE);
                    }
@@ -2304,9 +2308,15 @@ public class ServiceStateTracker extends Handler {
                loge("updateSpnDisplay: KEY_WFC_DATA_SPN_FORMAT_IDX_INT out of bounds: " + dataIdx);
                dataIdx = 0;
            }
            if (flightModeIdx < 0 || flightModeIdx >= wfcSpnFormats.length) {
                // KEY_WFC_FLIGHT_MODE_SPN_FORMAT_IDX_INT out of bounds. Use the value from
                // voiceIdx.
                flightModeIdx = voiceIdx;
            }

            wfcVoiceSpnFormat = wfcSpnFormats[voiceIdx];
            wfcDataSpnFormat = wfcSpnFormats[dataIdx];
            wfcFlightSpnFormat = wfcSpnFormats[flightModeIdx];
        }

        if (mPhone.isPhoneTypeGsm()) {
@@ -2383,6 +2393,11 @@ public class ServiceStateTracker extends Handler {
                // Show SPN + Wi-Fi Calling If SIM has SPN and SPN display condition
                // is satisfied or SPN override is enabled for this carrier.

                // Handle Flight Mode
                if (mSS.getVoiceRegState() == ServiceState.STATE_POWER_OFF) {
                    wfcVoiceSpnFormat = wfcFlightSpnFormat;
                }

                String originalSpn = spn.trim();
                spn = String.format(wfcVoiceSpnFormat, originalSpn);
                dataSpn = String.format(wfcDataSpnFormat, originalSpn);