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

Commit 496157cd 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" into rvc-qpr-dev am: 75531aea

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

Change-Id: I9b61313e365a5ba0359534d2453deef47f9dae57
parents b7691ca0 75531aea
Loading
Loading
Loading
Loading
+2 −14
Original line number Diff line number Diff line
@@ -2755,10 +2755,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;
@@ -2790,17 +2786,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();
    }