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

Commit 35c9c523 authored by sangyun's avatar sangyun Committed by Sangyun Yun
Browse files

Not to update LocaleOperator if the IMS reg tech is iwlan.

Even if the registration state of PS WLAN is not in-service,
IMS over IWLAN can be registered status. In that case, Changed
localeOperator to null.

Bug: 333346537
Test: atest ServiceStateTrackerTest
Test: Tested under no service + iwlan + wifi ap turn off
Test: basic call, data
Change-Id: I70a98de1d3a36591bea6074b6a53ddddef688d88
parent f8e30e78
Loading
Loading
Loading
Loading
+23 −2
Original line number Diff line number Diff line
@@ -3728,10 +3728,18 @@ public class ServiceStateTracker extends Handler {
            // because operatorNumeric would be SIM's mcc/mnc when device is on IWLAN), but if the
            // device has camped on a cell either to attempt registration or for emergency services,
            // then for purposes of setting the locale, we don't care if registration fails or is
            // incomplete.
            // incomplete. Additionally, if there is no cellular service and ims is registered over
            // the IWLAN, the locale will not be updated.
            // CellIdentity can return a null MCC and MNC in CDMA
            String localeOperator = operatorNumeric;
            if (mSS.getDataNetworkType() == TelephonyManager.NETWORK_TYPE_IWLAN) {
            int dataNetworkType = mSS.getDataNetworkType();
            if (dataNetworkType == TelephonyManager.NETWORK_TYPE_IWLAN
                    || (dataNetworkType == TelephonyManager.NETWORK_TYPE_UNKNOWN
                            && getImsRegistrationTech()
                                    == ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN)) {
                // TODO(b/333346537#comment10): Complete solution would be ignore mcc/mnc reported
                //  by the unsolicited indication OPERATOR from RIL, but only relies on MCC/MNC from
                //  data registration or voice registration.
                localeOperator = null;
            }
            if (isInvalidOperatorNumeric(localeOperator)) {
@@ -5911,4 +5919,17 @@ public class ServiceStateTracker extends Handler {
    public @Nullable CellIdentity getLastKnownCellIdentity() {
        return mLastKnownCellIdentity;
    }

    /**
     * Get the tech where ims is currently registered.
     * @return Returns the tech of ims registered. if not registered or no phome for ims, returns
     *   {@link ImsRegistrationImplBase#REGISTRATION_TECH_NONE}.
     */
    private @ImsRegistrationImplBase.ImsRegistrationTech int getImsRegistrationTech() {
        ImsPhone imsPhone = (ImsPhone) mPhone.getImsPhone();
        if (imsPhone != null) {
            return imsPhone.getImsRegistrationTech();
        }
        return ImsRegistrationImplBase.REGISTRATION_TECH_NONE;
    }
}
+48 −2
Original line number Diff line number Diff line
@@ -2605,10 +2605,15 @@ public class ServiceStateTrackerTest extends TelephonyTest {
        waitForLastHandlerAction(mSSTTestHandler.getThreadHandler());

        // PS WLAN
        int wlanRat = TelephonyManager.NETWORK_TYPE_UNKNOWN;
        if (wlanState == NetworkRegistrationInfo.REGISTRATION_STATE_HOME
                || wlanState == NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING) {
            wlanRat = TelephonyManager.NETWORK_TYPE_IWLAN;
        }
        NetworkRegistrationInfo dataIwlanResult = new NetworkRegistrationInfo(
                NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WLAN,
                wlanState, TelephonyManager.NETWORK_TYPE_IWLAN, 0, false,
                null, null, "", 1, false, false, false, lteVopsSupportInfo);
                wlanState, wlanRat, 0, false, null, null,
                "", 1, false, false, false, lteVopsSupportInfo);
        sst.sendMessage(sst.obtainMessage(
                ServiceStateTracker.EVENT_POLL_STATE_PS_IWLAN_REGISTRATION,
                new AsyncResult(sst.mPollingContext, dataIwlanResult, null)));
@@ -2645,6 +2650,47 @@ public class ServiceStateTrackerTest extends TelephonyTest {
        verify(mLocaleTracker).updateOperatorNumeric(eq(""));
    }

    /**
     * Ensure that LocaleTracker is not updated with mcc when only IWLAN is not in-service and the
     * ims registration status is connected over iwlan,
     */
    @Test
    public void testLocaleTrackerUpdateWithImsRegistrationTechIwlan() {
        // Start state: Cell data only LTE + IWLAN
        final String[] OpNamesResult = new String[] { "carrier long", "carrier", "310310" };
        // Clear invocations for mLocaleTracker as precondition before test case execution & as part
        // test setup
        Mockito.clearInvocations(mLocaleTracker);

        // Both Cellular abd Iwlan is in-service.
        changeRegStateWithIwlanOperatorNumeric(
                NetworkRegistrationInfo.REGISTRATION_STATE_HOME,
                TelephonyManager.NETWORK_TYPE_LTE,
                NetworkRegistrationInfo.REGISTRATION_STATE_HOME, OpNamesResult, true);
        verify(mLocaleTracker).updateOperatorNumeric(eq(OpNamesResult[2]));

        // Test with Cellular as NOT_REG
        changeRegStateWithIwlanOperatorNumeric(
                NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING,
                TelephonyManager.NETWORK_TYPE_UNKNOWN,
                NetworkRegistrationInfo.REGISTRATION_STATE_HOME, OpNamesResult, true);
        /* cellId based mccmnc */
        verify(mLocaleTracker).updateOperatorNumeric(eq("00101"));

        // IMS over Iwlan is registered.
        doReturn(mImsPhone)
                .when(mPhone).getImsPhone();
        doReturn(ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN)
                .when(mImsPhone).getImsRegistrationTech();

        // Test with Iwlan as NOT_REG
        changeRegStateWithIwlanOperatorNumeric(
                NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING,
                TelephonyManager.NETWORK_TYPE_UNKNOWN,
                NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING,
                OpNamesResult, false);
        verify(mLocaleTracker).updateOperatorNumeric(eq(""));
    }
    @Test
    public void testGetServiceProviderNameWithBrandOverride() {
        String brandOverride = "spn from brand override";