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

Commit 9e5b111e authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix "No service" is not shown without SIM" am: bc9bd7ef am: dec27413

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/1267641

Change-Id: I0b17e54c18c324b470ee6363c16ba01e292749c7
parents 1e92b658 dec27413
Loading
Loading
Loading
Loading
+15 −4
Original line number Original line Diff line number Diff line
@@ -539,6 +539,8 @@ public class ServiceStateTracker extends Handler {
    /** To identify whether EVENT_SIM_READY is received or not */
    /** To identify whether EVENT_SIM_READY is received or not */
    private boolean mIsSimReady = false;
    private boolean mIsSimReady = false;


    private String mLastKnownNetworkCountry = "";

    @UnsupportedAppUsage
    @UnsupportedAppUsage
    private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
    private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
        @Override
        @Override
@@ -564,6 +566,12 @@ public class ServiceStateTracker extends Handler {
            } else if (intent.getAction().equals(ACTION_RADIO_OFF)) {
            } else if (intent.getAction().equals(ACTION_RADIO_OFF)) {
                mAlarmSwitch = false;
                mAlarmSwitch = false;
                powerOffRadioSafely();
                powerOffRadioSafely();
            } else if (intent.getAction().equals(TelephonyManager.ACTION_NETWORK_COUNTRY_CHANGED)) {
                String lastKnownNetworkCountry = intent.getStringExtra(
                        TelephonyManager.EXTRA_LAST_KNOWN_NETWORK_COUNTRY);
                if (!mLastKnownNetworkCountry.equals(lastKnownNetworkCountry)) {
                    updateSpnDisplay();
                }
            }
            }
        }
        }
    };
    };
@@ -685,6 +693,9 @@ public class ServiceStateTracker extends Handler {
        filter = new IntentFilter();
        filter = new IntentFilter();
        filter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
        filter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
        context.registerReceiver(mIntentReceiver, filter);
        context.registerReceiver(mIntentReceiver, filter);
        filter = new IntentFilter();
        filter.addAction(TelephonyManager.ACTION_NETWORK_COUNTRY_CHANGED);
        context.registerReceiver(mIntentReceiver, filter);


        mPhone.notifyOtaspChanged(TelephonyManager.OTASP_UNINITIALIZED);
        mPhone.notifyOtaspChanged(TelephonyManager.OTASP_UNINITIALIZED);


@@ -1173,8 +1184,8 @@ public class ServiceStateTracker extends Handler {
                    mCdnr.updateEfFromUsim(null /* Usim */);
                    mCdnr.updateEfFromUsim(null /* Usim */);
                }
                }
                onUpdateIccAvailability();
                onUpdateIccAvailability();
                if (mUiccApplcation != null
                if (mUiccApplcation == null
                        && mUiccApplcation.getState() != AppState.APPSTATE_READY) {
                        || mUiccApplcation.getState() != AppState.APPSTATE_READY) {
                    mIsSimReady = false;
                    mIsSimReady = false;
                    updateSpnDisplay();
                    updateSpnDisplay();
                }
                }
@@ -2865,9 +2876,9 @@ public class ServiceStateTracker extends Handler {
        if (ArrayUtils.isEmpty(countriesWithNoService)) {
        if (ArrayUtils.isEmpty(countriesWithNoService)) {
            return false;
            return false;
        }
        }
        String currentCountry = mLocaleTracker.getCurrentCountry();
        mLastKnownNetworkCountry = mLocaleTracker.getLastKnownCountryIso();
        for (String country : countriesWithNoService) {
        for (String country : countriesWithNoService) {
            if (country.equalsIgnoreCase(currentCountry)) {
            if (country.equalsIgnoreCase(mLastKnownNetworkCountry)) {
                return true;
                return true;
            }
            }
        }
        }
+3 −3
Original line number Original line Diff line number Diff line
@@ -2524,7 +2524,7 @@ public class ServiceStateTrackerTest extends TelephonyTest {
    @Test
    @Test
    public void testShouldForceDisplayNoService_forceBasedOnLocale() {
    public void testShouldForceDisplayNoService_forceBasedOnLocale() {
        // set up unaffected locale (US) and clear the resource
        // set up unaffected locale (US) and clear the resource
        doReturn("us").when(mLocaleTracker).getCurrentCountry();
        doReturn("us").when(mLocaleTracker).getLastKnownCountryIso();
        mContextFixture.putStringArrayResource(
        mContextFixture.putStringArrayResource(
                com.android.internal.R.array.config_display_no_service_when_sim_unready,
                com.android.internal.R.array.config_display_no_service_when_sim_unready,
                new String[0]);
                new String[0]);
@@ -2534,11 +2534,11 @@ public class ServiceStateTrackerTest extends TelephonyTest {
        mContextFixture.putStringArrayResource(
        mContextFixture.putStringArrayResource(
                com.android.internal.R.array.config_display_no_service_when_sim_unready,
                com.android.internal.R.array.config_display_no_service_when_sim_unready,
                new String[]{"de"});
                new String[]{"de"});
        doReturn("us").when(mLocaleTracker).getCurrentCountry();
        doReturn("us").when(mLocaleTracker).getLastKnownCountryIso();
        assertFalse(sst.shouldForceDisplayNoService());
        assertFalse(sst.shouldForceDisplayNoService());


        // mock the locale to Germany
        // mock the locale to Germany
        doReturn("de").when(mLocaleTracker).getCurrentCountry();
        doReturn("de").when(mLocaleTracker).getLastKnownCountryIso();
        assertTrue(sst.shouldForceDisplayNoService());
        assertTrue(sst.shouldForceDisplayNoService());
    }
    }