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

Commit c1c6ce8a authored by Sarah Chin's avatar Sarah Chin Committed by Automerger Merge Worker
Browse files

Merge "Don't show PLMN when connected to WiFi on APM with WFC off" am: 549368ca am: 3636e051

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

Change-Id: Iaf26f8123b7cdbf69699dafe7bde9cf78807c87b
parents 5c281d1c 3636e051
Loading
Loading
Loading
Loading
+2 −14
Original line number Diff line number Diff line
@@ -2744,10 +2744,6 @@ public class ServiceStateTracker extends Handler {
            //    EXTRA_SHOW_PLMN = true
            //    EXTRA_PLMN = null

            // 5) Airplane mode but connected to WiFi with WFC disabled
            //    EXTRA_SHOW_PLMN = true
            //    EXTRA_PLMN = plmn

            IccRecords iccRecords = mIccRecords;
            int rule = getCarrierNameDisplayBitmask(mSS);
            boolean noService = false;
@@ -2779,17 +2775,9 @@ public class ServiceStateTracker extends Handler {
                                == CARRIER_NAME_DISPLAY_BITMASK_SHOW_PLMN);
                if (DBG) log("updateSpnDisplay: rawPlmn = " + plmn);
            } else {
                // Power off state, such as airplane mode, show plmn as "No service"
                // unless connected to WiFi with WFC disabled, then show plmn
                // Power off state, such as airplane mode, show plmn as null
                showPlmn = true;
                if (mPhone.getImsPhone() != null && !mPhone.getImsPhone().isWifiCallingEnabled()
                        && mSS.getDataNetworkType() == TelephonyManager.NETWORK_TYPE_IWLAN) {
                    plmn = mSS.getOperatorAlpha();
                } else {
                    plmn = Resources.getSystem()
                            .getText(com.android.internal.R.string.lockscreen_carrier_default)
                            .toString();
                }
                plmn = null;
                if (DBG) log("updateSpnDisplay: radio is off w/ showPlmn="
                        + showPlmn + " plmn=" + plmn);
            }
+14 −5
Original line number Diff line number Diff line
@@ -377,12 +377,15 @@ public class CarrierDisplayNameResolver {
     */
    private CarrierDisplayNameData getOutOfServiceDisplayName(CarrierDisplayNameData data) {
        // Out of service/Power off/Emergency Only override
        // 1) In flight mode(service state is ServiceState.STATE_POWER_OFF), or the service
        //    state is ServiceState.STATE_OUT_OF_SERVICE but emergency call is not allowed.
        // 1) In flight mode (service state is ServiceState.STATE_POWER_OFF).
        //    showPlmn = true
        //    Only show null as PLMN
        //
        // 2) Service state is ServiceState.STATE_OUT_OF_SERVICE but emergency call is not allowed.
        //    showPlmn = true
        //    Only show "No Service" as PLMN
        //
        // 2) Out of service but emergency call is allowed.
        // 3) Out of service but emergency call is allowed.
        //    showPlmn = true
        //    Only show "Emergency call only" as PLMN
        String plmn = null;
@@ -391,8 +394,10 @@ public class CarrierDisplayNameResolver {
        boolean forceDisplayNoService =
                mPhone.getServiceStateTracker().shouldForceDisplayNoService() && !isSimReady;
        ServiceState ss = getServiceState();
        if (ss.getState() == ServiceState.STATE_POWER_OFF
                || forceDisplayNoService || !Phone.isEmergencyCallOnly()) {
        if (ss.getState() == ServiceState.STATE_POWER_OFF && !forceDisplayNoService
                && !Phone.isEmergencyCallOnly()) {
            plmn = null;
        } else if (forceDisplayNoService || !Phone.isEmergencyCallOnly()) {
            plmn = mContext.getResources().getString(
                    com.android.internal.R.string.lockscreen_carrier_default);
        } else {
@@ -417,6 +422,10 @@ public class CarrierDisplayNameResolver {
                if (DBG) {
                    Rlog.d(TAG, "CarrierName override by wifi-calling " + data);
                }
            } else if (getServiceState().getState() == ServiceState.STATE_POWER_OFF) {
                // data in service due to IWLAN but APM on and WFC not available
                data = getOutOfServiceDisplayName(data);
                if (DBG) Rlog.d(TAG, "Out of service carrierName (APM) " + data);
            }
        } else {
            data = getOutOfServiceDisplayName(data);
+3 −4
Original line number Diff line number Diff line
@@ -2419,7 +2419,7 @@ public class ServiceStateTrackerTest extends TelephonyTest {
    }

    @Test
    public void testUpdateSpnDisplay_flightMode_displayOOS() {
    public void testUpdateSpnDisplay_flightMode_displayNull() {
        // GSM phone
        doReturn(true).when(mPhone).isPhoneTypeGsm();

@@ -2432,10 +2432,9 @@ public class ServiceStateTrackerTest extends TelephonyTest {
        // update the spn
        sst.updateSpnDisplay();

        // Plmn should be shown, and the string is "No service"
        // Plmn should be shown, and the string is null
        Bundle b = getExtrasFromLastSpnUpdateIntent();
        assertThat(b.getString(TelephonyManager.EXTRA_PLMN))
                .isEqualTo(CARRIER_NAME_DISPLAY_NO_SERVICE);
        assertThat(b.getString(TelephonyManager.EXTRA_PLMN)).isEqualTo(null);
        assertThat(b.getBoolean(TelephonyManager.EXTRA_SHOW_PLMN)).isTrue();
    }