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

Commit 0c62d855 authored by Ling Ma's avatar Ling Ma Committed by Automerger Merge Worker
Browse files

Merge "Make registrationState consistent with RoamType in case of override"...

Merge "Make registrationState consistent with RoamType in case of override" am: 6890fa9e am: 550e6475

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



Change-Id: Ib34ced2e5de927ca7c49edb07d40eb0d1d651a76
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 410a4b81 550e6475
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -898,7 +898,7 @@ public class ServiceStateTracker extends Handler {
        if (nrs != null) {
            int rat = ServiceState.networkTypeToRilRadioTechnology(
                    nrs.getAccessNetworkTechnology());
            int drs = regCodeToServiceState(nrs.getRegistrationState());
            int drs = regCodeToServiceState(nrs.getInitialRegistrationState());
            return new Pair<>(drs, rat);
        }
        return null;
@@ -2195,14 +2195,14 @@ public class ServiceStateTracker extends Handler {
        if (wlanPsRegState != null
                && wlanPsRegState.getAccessNetworkTechnology()
                == TelephonyManager.NETWORK_TYPE_IWLAN
                && wlanPsRegState.getRegistrationState()
                && wlanPsRegState.getInitialRegistrationState()
                == NetworkRegistrationInfo.REGISTRATION_STATE_HOME
                && isIwlanPreferred) {
            serviceState.setDataRegState(ServiceState.STATE_IN_SERVICE);
        } else if (wwanPsRegState != null) {
            // If the device is not camped on IWLAN, then we use cellular PS registration state
            // to compute reg state and rat.
            int regState = wwanPsRegState.getRegistrationState();
            int regState = wwanPsRegState.getInitialRegistrationState();
            serviceState.setDataRegState(regCodeToServiceState(regState));
        }
        if (DBG) {
@@ -2218,7 +2218,7 @@ public class ServiceStateTracker extends Handler {
                VoiceSpecificRegistrationInfo voiceSpecificStates =
                        networkRegState.getVoiceSpecificInfo();

                int registrationState = networkRegState.getRegistrationState();
                int registrationState = networkRegState.getInitialRegistrationState();
                int cssIndicator = voiceSpecificStates.cssSupported ? 1 : 0;
                int newVoiceRat = ServiceState.networkTypeToRilRadioTechnology(
                        networkRegState.getAccessNetworkTechnology());
@@ -2300,7 +2300,7 @@ public class ServiceStateTracker extends Handler {
                mNewSS.addNetworkRegistrationInfo(networkRegState);
                DataSpecificRegistrationInfo dataSpecificStates =
                        networkRegState.getDataSpecificInfo();
                int registrationState = networkRegState.getRegistrationState();
                int registrationState = networkRegState.getInitialRegistrationState();
                int serviceState = regCodeToServiceState(registrationState);
                int newDataRat = ServiceState.networkTypeToRilRadioTechnology(
                        networkRegState.getAccessNetworkTechnology());
@@ -3539,9 +3539,9 @@ public class ServiceStateTracker extends Handler {
                anyDataRatChanged = true;
            }

            int oldRegState = oldNrs != null ? oldNrs.getRegistrationState()
            int oldRegState = oldNrs != null ? oldNrs.getInitialRegistrationState()
                    : NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN;
            int newRegState = newNrs != null ? newNrs.getRegistrationState()
            int newRegState = newNrs != null ? newNrs.getInitialRegistrationState()
                    : NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN;
            hasDataRegStateChanged.put(transport, oldRegState != newRegState);
            if (oldRegState != newRegState) {
@@ -4253,7 +4253,7 @@ public class ServiceStateTracker extends Handler {
    }

    /**
     * Do not set roaming state in case of oprators considered non-roaming.
     * Do not set roaming state in case of operators considered non-roaming.
     *
     * Can use mcc or mcc+mnc as item of
     * {@link CarrierConfigManager#KEY_NON_ROAMING_OPERATOR_STRING_ARRAY}.
@@ -5672,7 +5672,7 @@ public class ServiceStateTracker extends Handler {
                NetworkRegistrationInfo wlanNri = new NetworkRegistrationInfo.Builder()
                        .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WLAN)
                        .setDomain(NetworkRegistrationInfo.DOMAIN_PS)
                        .setRegistrationState(wwanNri.getRegistrationState())
                        .setRegistrationState(wwanNri.getInitialRegistrationState())
                        .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_IWLAN)
                        .setRejectCause(wwanNri.getRejectCause())
                        .setEmergencyOnly(wwanNri.isEmergencyEnabled())
+19 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.os.Parcel;
import android.telephony.AccessNetworkConstants;
import android.telephony.CellIdentityLte;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager;

import androidx.test.filters.SmallTest;
@@ -68,4 +69,22 @@ public class NetworkRegistrationInfoTest {
        assertEquals("12345", new NetworkRegistrationInfo.Builder()
                .setRegisteredPlmn("12345").build().getRegisteredPlmn());
    }

    @Test
    @SmallTest
    public void testSetRoamingType() {
        NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
                .setDomain(NetworkRegistrationInfo.DOMAIN_CS)
                .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING)
                .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_LTE)
                .setAvailableServices(Arrays.asList(NetworkRegistrationInfo.SERVICE_TYPE_DATA))
                .setCellIdentity(new CellIdentityLte())
                .setRegisteredPlmn("12345")
                .build();
        nri.setRoamingType(ServiceState.ROAMING_TYPE_NOT_ROAMING);
        assertEquals(NetworkRegistrationInfo.REGISTRATION_STATE_HOME, nri.getRegistrationState());
        assertEquals(NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING,
                nri.getInitialRegistrationState());
    }
}