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

Commit 9f07c5f7 authored by Hunsuk Choi's avatar Hunsuk Choi Committed by Android (Google) Code Review
Browse files

Merge "Get LTE attach information from AccessTechnologySpecificInfo"

parents 73500e89 330de801
Loading
Loading
Loading
Loading
+29 −5
Original line number Original line Diff line number Diff line
@@ -18,9 +18,9 @@ package com.android.internal.telephony;


import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.Nullable;
import android.hardware.radio.V1_0.RegState;
import android.hardware.radio.V1_4.DataRegStateResult.VopsInfo.hidl_discriminator;
import android.hardware.radio.V1_4.DataRegStateResult.VopsInfo.hidl_discriminator;
import android.hardware.radio.V1_6.RegStateResult.AccessTechnologySpecificInfo;
import android.hardware.radio.V1_6.RegStateResult.AccessTechnologySpecificInfo;
import android.hardware.radio.network.RegState;
import android.os.AsyncResult;
import android.os.AsyncResult;
import android.os.Handler;
import android.os.Handler;
import android.os.Looper;
import android.os.Looper;
@@ -35,6 +35,7 @@ import android.telephony.CellIdentityLte;
import android.telephony.CellIdentityNr;
import android.telephony.CellIdentityNr;
import android.telephony.CellIdentityTdscdma;
import android.telephony.CellIdentityTdscdma;
import android.telephony.CellIdentityWcdma;
import android.telephony.CellIdentityWcdma;
import android.telephony.DataSpecificRegistrationInfo;
import android.telephony.LteVopsSupportInfo;
import android.telephony.LteVopsSupportInfo;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.NetworkService;
import android.telephony.NetworkService;
@@ -190,6 +191,8 @@ public class CellularNetworkService extends NetworkService {
                    return NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN;
                    return NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN;
                case RegState.REG_ROAMING:
                case RegState.REG_ROAMING:
                    return NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING;
                    return NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING;
                case RegState.REG_EM:
                    return NetworkRegistrationInfo.REGISTRATION_STATE_EMERGENCY;
                default:
                default:
                    return NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING;
                    return NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING;
            }
            }
@@ -201,6 +204,7 @@ public class CellularNetworkService extends NetworkService {
                case RegState.NOT_REG_MT_SEARCHING_OP_EM:
                case RegState.NOT_REG_MT_SEARCHING_OP_EM:
                case RegState.REG_DENIED_EM:
                case RegState.REG_DENIED_EM:
                case RegState.UNKNOWN_EM:
                case RegState.UNKNOWN_EM:
                case RegState.REG_EM:
                    return true;
                    return true;
                case RegState.NOT_REG_MT_NOT_SEARCHING_OP:
                case RegState.NOT_REG_MT_NOT_SEARCHING_OP:
                case RegState.REG_HOME:
                case RegState.REG_HOME:
@@ -514,6 +518,8 @@ public class CellularNetworkService extends NetworkService {
            boolean isNrAvailable = false;
            boolean isNrAvailable = false;
            boolean isDcNrRestricted = false;
            boolean isDcNrRestricted = false;
            VopsSupportInfo vopsInfo = null;
            VopsSupportInfo vopsInfo = null;
            int lteAttachResultType = 0;
            int lteAttachExtraInfo = 0;


            android.hardware.radio.network.AccessTechnologySpecificInfo info =
            android.hardware.radio.network.AccessTechnologySpecificInfo info =
                    regResult.accessTechnologySpecificInfo;
                    regResult.accessTechnologySpecificInfo;
@@ -532,6 +538,8 @@ public class CellularNetworkService extends NetworkService {
                    vopsInfo = convertHalLteVopsSupportInfo(
                    vopsInfo = convertHalLteVopsSupportInfo(
                            info.getEutranInfo().lteVopsInfo.isVopsSupported,
                            info.getEutranInfo().lteVopsInfo.isVopsSupported,
                            info.getEutranInfo().lteVopsInfo.isEmcBearerSupported);
                            info.getEutranInfo().lteVopsInfo.isEmcBearerSupported);
                    lteAttachResultType = info.getEutranInfo().lteAttachResultType;
                    lteAttachExtraInfo = info.getEutranInfo().extraInfo;
                    break;
                    break;
                case android.hardware.radio.network.AccessTechnologySpecificInfo.ngranNrVopsInfo:
                case android.hardware.radio.network.AccessTechnologySpecificInfo.ngranNrVopsInfo:
                    vopsInfo = new NrVopsSupportInfo(info.getNgranNrVopsInfo().vopsSupported,
                    vopsInfo = new NrVopsSupportInfo(info.getNgranNrVopsInfo().vopsSupported,
@@ -557,10 +565,26 @@ public class CellularNetworkService extends NetworkService {
                    loge("Unknown domain passed to CellularNetworkService= " + domain);
                    loge("Unknown domain passed to CellularNetworkService= " + domain);
                    // fall through
                    // fall through
                case NetworkRegistrationInfo.DOMAIN_PS:
                case NetworkRegistrationInfo.DOMAIN_PS:
                    return new NetworkRegistrationInfo(domain, transportType, regState, networkType,
                    return new NetworkRegistrationInfo.Builder()
                            reasonForDenial, isEmergencyOnly, availableServices, cellIdentity,
                        .setDomain(domain)
                            rplmn, MAX_DATA_CALLS, isDcNrRestricted, isNrAvailable, isEndcAvailable,
                        .setTransportType(transportType)
                            vopsInfo);
                        .setRegistrationState(regState)
                        .setAccessNetworkTechnology(networkType)
                        .setRejectCause(reasonForDenial)
                        .setEmergencyOnly(isEmergencyOnly)
                        .setAvailableServices(availableServices)
                        .setCellIdentity(cellIdentity)
                        .setRegisteredPlmn(rplmn)
                        .setDataSpecificInfo(
                                new DataSpecificRegistrationInfo.Builder(MAX_DATA_CALLS)
                                     .setDcNrRestricted(isDcNrRestricted)
                                     .setNrAvailable(isNrAvailable)
                                     .setEnDcAvailable(isEndcAvailable)
                                     .setVopsSupportInfo(vopsInfo)
                                     .setLteAttachResultType(lteAttachResultType)
                                     .setLteAttachExtraInfo(lteAttachExtraInfo)
                                     .build())
                        .build();
            }
            }
        }
        }


+80 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.internal.telephony;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNull;

import android.os.Parcel;
import android.telephony.DataSpecificRegistrationInfo;
import android.telephony.LteVopsSupportInfo;

import androidx.test.filters.SmallTest;

import org.junit.Test;

/** Unit tests for {@link DataSpecificRegistrationInfo}. */
public class DataSpecificRegistrationInfoTest {
    @Test
    @SmallTest
    public void testBuilder() {
        DataSpecificRegistrationInfo dsri =
                new DataSpecificRegistrationInfo.Builder(3)
                .setNrAvailable(true)
                .setEnDcAvailable(true)
                .build();

        assertEquals(3, dsri.maxDataCalls);
        assertEquals(false, dsri.isDcNrRestricted);
        assertEquals(true, dsri.isNrAvailable);
        assertEquals(true, dsri.isEnDcAvailable);
        assertNull(dsri.getVopsSupportInfo());

        LteVopsSupportInfo vopsInfo = new LteVopsSupportInfo(
                LteVopsSupportInfo.LTE_STATUS_SUPPORTED, LteVopsSupportInfo.LTE_STATUS_SUPPORTED);
        dsri = new DataSpecificRegistrationInfo.Builder(5)
                .setDcNrRestricted(true)
                .setVopsSupportInfo(vopsInfo)
                .build();

        assertEquals(5, dsri.maxDataCalls);
        assertEquals(true, dsri.isDcNrRestricted);
        assertEquals(false, dsri.isNrAvailable);
        assertEquals(false, dsri.isEnDcAvailable);
        assertEquals(vopsInfo, dsri.getVopsSupportInfo());
    }

    @Test
    @SmallTest
    public void testParcel() {
        DataSpecificRegistrationInfo dsri =
                new DataSpecificRegistrationInfo.Builder(3)
                .setNrAvailable(true)
                .setEnDcAvailable(true)
                .setLteAttachResultType(DataSpecificRegistrationInfo.LTE_ATTACH_TYPE_COMBINED)
                .setLteAttachExtraInfo(DataSpecificRegistrationInfo.LTE_ATTACH_EXTRA_INFO_SMS_ONLY)
                .build();

        Parcel p = Parcel.obtain();
        dsri.writeToParcel(p, 0);
        p.setDataPosition(0);

        DataSpecificRegistrationInfo newDsri =
                DataSpecificRegistrationInfo.CREATOR.createFromParcel(p);
        assertEquals(dsri, newDsri);
    }
}
+52 −0
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.internal.telephony;


import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertEquals;


import android.compat.testing.PlatformCompatChangeRule;
import android.os.Parcel;
import android.os.Parcel;
import android.telephony.AccessNetworkConstants;
import android.telephony.AccessNetworkConstants;
import android.telephony.CellIdentityLte;
import android.telephony.CellIdentityLte;
@@ -27,13 +28,21 @@ import android.telephony.TelephonyManager;


import androidx.test.filters.SmallTest;
import androidx.test.filters.SmallTest;


import libcore.junit.util.compat.CoreCompatChangeRule.DisableCompatChanges;
import libcore.junit.util.compat.CoreCompatChangeRule.EnableCompatChanges;

import org.junit.Rule;
import org.junit.Test;
import org.junit.Test;
import org.junit.rules.TestRule;


import java.util.Arrays;
import java.util.Arrays;


/** Unit tests for {@link NetworkRegistrationInfo}. */
/** Unit tests for {@link NetworkRegistrationInfo}. */
public class NetworkRegistrationInfoTest {
public class NetworkRegistrationInfoTest {


    @Rule
    public TestRule compatChangeRule = new PlatformCompatChangeRule();

    @Test
    @Test
    @SmallTest
    @SmallTest
    public void testParcel() {
    public void testParcel() {
@@ -87,4 +96,47 @@ public class NetworkRegistrationInfoTest {
        assertEquals(NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING,
        assertEquals(NetworkRegistrationInfo.REGISTRATION_STATE_ROAMING,
                nri.getInitialRegistrationState());
                nri.getInitialRegistrationState());
    }
    }

    @Test
    @DisableCompatChanges({NetworkRegistrationInfo.RETURN_REGISTRATION_STATE_EMERGENCY})
    public void testReturnRegistrationStateEmergencyDisabled() {
        // LTE
        NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
                .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_EMERGENCY)
                .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_LTE)
                .build();

        assertEquals(NetworkRegistrationInfo.REGISTRATION_STATE_DENIED, nri.getRegistrationState());

        // NR
        nri = new NetworkRegistrationInfo.Builder()
                .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_EMERGENCY)
                .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_NR)
                .build();

        assertEquals(NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING,
                nri.getRegistrationState());
    }

    @Test
    @EnableCompatChanges({NetworkRegistrationInfo.RETURN_REGISTRATION_STATE_EMERGENCY})
    public void testReturnRegistrationStateEmergencyEnabled() {
        // LTE
        NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
                .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_EMERGENCY)
                .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_LTE)
                .build();

        assertEquals(NetworkRegistrationInfo.REGISTRATION_STATE_EMERGENCY,
                nri.getRegistrationState());

        // NR
        nri = new NetworkRegistrationInfo.Builder()
                .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_EMERGENCY)
                .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_NR)
                .build();

        assertEquals(NetworkRegistrationInfo.REGISTRATION_STATE_EMERGENCY,
                nri.getRegistrationState());
    }
}
}
+84 −36
Original line number Original line Diff line number Diff line
@@ -511,9 +511,13 @@ public class DataNetworkControllerTest extends TelephonyTest {


    private void serviceStateChanged(@NetworkType int networkType,
    private void serviceStateChanged(@NetworkType int networkType,
            @RegistrationState int regState) {
            @RegistrationState int regState) {
        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo(8, false, true, true,
        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo.Builder(8)
                new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_SUPPORTED,
                .setNrAvailable(true)
                        LteVopsSupportInfo.LTE_STATUS_SUPPORTED));
                .setEnDcAvailable(true)
                .setVopsSupportInfo(new LteVopsSupportInfo(
                        LteVopsSupportInfo.LTE_STATUS_SUPPORTED,
                        LteVopsSupportInfo.LTE_STATUS_SUPPORTED))
                .build();


        serviceStateChanged(networkType, regState, regState,
        serviceStateChanged(networkType, regState, regState,
                NetworkRegistrationInfo.REGISTRATION_STATE_HOME, dsri);
                NetworkRegistrationInfo.REGISTRATION_STATE_HOME, dsri);
@@ -543,9 +547,13 @@ public class DataNetworkControllerTest extends TelephonyTest {
            @RegistrationState int dataRegState, @RegistrationState int voiceRegState,
            @RegistrationState int dataRegState, @RegistrationState int voiceRegState,
            @RegistrationState int iwlanRegState, DataSpecificRegistrationInfo dsri) {
            @RegistrationState int iwlanRegState, DataSpecificRegistrationInfo dsri) {
        if (dsri == null) {
        if (dsri == null) {
            dsri = new DataSpecificRegistrationInfo(8, false, true, true,
            dsri = new DataSpecificRegistrationInfo.Builder(8)
                    new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_SUPPORTED,
                    .setNrAvailable(true)
                            LteVopsSupportInfo.LTE_STATUS_SUPPORTED));
                    .setEnDcAvailable(true)
                    .setVopsSupportInfo(new LteVopsSupportInfo(
                            LteVopsSupportInfo.LTE_STATUS_SUPPORTED,
                            LteVopsSupportInfo.LTE_STATUS_SUPPORTED))
                    .build();
        }
        }


        ServiceState ss = new ServiceState();
        ServiceState ss = new ServiceState();
@@ -3039,9 +3047,13 @@ public class DataNetworkControllerTest extends TelephonyTest {


    @Test
    @Test
    public void testNonVoPSNoIMSSetup() throws Exception {
    public void testNonVoPSNoIMSSetup() throws Exception {
        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo(8, false, true, true,
        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo.Builder(8)
                new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED,
                .setNrAvailable(true)
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED));
                .setEnDcAvailable(true)
                .setVopsSupportInfo(new LteVopsSupportInfo(
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED,
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED))
                .build();
        serviceStateChanged(TelephonyManager.NETWORK_TYPE_LTE,
        serviceStateChanged(TelephonyManager.NETWORK_TYPE_LTE,
                NetworkRegistrationInfo.REGISTRATION_STATE_HOME, dsri);
                NetworkRegistrationInfo.REGISTRATION_STATE_HOME, dsri);


@@ -3061,9 +3073,13 @@ public class DataNetworkControllerTest extends TelephonyTest {
        carrierConfigChanged();
        carrierConfigChanged();


        // VOPS not supported
        // VOPS not supported
        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo(8, false, true, true,
        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo.Builder(8)
                new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED,
                .setNrAvailable(true)
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED));
                .setEnDcAvailable(true)
                .setVopsSupportInfo(new LteVopsSupportInfo(
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED,
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED))
                .build();
        serviceStateChanged(TelephonyManager.NETWORK_TYPE_LTE,
        serviceStateChanged(TelephonyManager.NETWORK_TYPE_LTE,
                NetworkRegistrationInfo.REGISTRATION_STATE_HOME, dsri);
                NetworkRegistrationInfo.REGISTRATION_STATE_HOME, dsri);


@@ -3074,9 +3090,13 @@ public class DataNetworkControllerTest extends TelephonyTest {
        verifyNoConnectedNetworkHasCapability(NetworkCapabilities.NET_CAPABILITY_IMS);
        verifyNoConnectedNetworkHasCapability(NetworkCapabilities.NET_CAPABILITY_IMS);


        // VoPS supported
        // VoPS supported
        dsri = new DataSpecificRegistrationInfo(8, false, true, true,
        dsri = new DataSpecificRegistrationInfo.Builder(8)
                new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_SUPPORTED,
                .setNrAvailable(true)
                        LteVopsSupportInfo.LTE_STATUS_SUPPORTED));
                .setEnDcAvailable(true)
                .setVopsSupportInfo(new LteVopsSupportInfo(
                        LteVopsSupportInfo.LTE_STATUS_SUPPORTED,
                        LteVopsSupportInfo.LTE_STATUS_SUPPORTED))
                .build();
        serviceStateChanged(TelephonyManager.NETWORK_TYPE_LTE,
        serviceStateChanged(TelephonyManager.NETWORK_TYPE_LTE,
                NetworkRegistrationInfo.REGISTRATION_STATE_HOME, dsri);
                NetworkRegistrationInfo.REGISTRATION_STATE_HOME, dsri);


@@ -3516,9 +3536,13 @@ public class DataNetworkControllerTest extends TelephonyTest {
    public void testHandoverDataNetworkNonVops() throws Exception {
    public void testHandoverDataNetworkNonVops() throws Exception {
        ServiceState ss = new ServiceState();
        ServiceState ss = new ServiceState();


        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo(8, false, true, true,
        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo.Builder(8)
                new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED,
                .setNrAvailable(true)
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED));
                .setEnDcAvailable(true)
                .setVopsSupportInfo(new LteVopsSupportInfo(
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED,
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED))
                .build();


        ss.addNetworkRegistrationInfo(new NetworkRegistrationInfo.Builder()
        ss.addNetworkRegistrationInfo(new NetworkRegistrationInfo.Builder()
                .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
@@ -3579,9 +3603,13 @@ public class DataNetworkControllerTest extends TelephonyTest {


        ServiceState ss = new ServiceState();
        ServiceState ss = new ServiceState();


        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo(8, false, true, true,
        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo.Builder(8)
                new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED,
                .setNrAvailable(true)
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED));
                .setEnDcAvailable(true)
                .setVopsSupportInfo(new LteVopsSupportInfo(
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED,
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED))
                .build();


        ss.addNetworkRegistrationInfo(new NetworkRegistrationInfo.Builder()
        ss.addNetworkRegistrationInfo(new NetworkRegistrationInfo.Builder()
                .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
@@ -3639,9 +3667,13 @@ public class DataNetworkControllerTest extends TelephonyTest {
    public void testNonMmtelImsHandoverDataNetworkNonVops() throws Exception {
    public void testNonMmtelImsHandoverDataNetworkNonVops() throws Exception {
        ServiceState ss = new ServiceState();
        ServiceState ss = new ServiceState();


        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo(8, false, true, true,
        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo.Builder(8)
                new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED,
                .setNrAvailable(true)
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED));
                .setEnDcAvailable(true)
                .setVopsSupportInfo(new LteVopsSupportInfo(
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED,
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED))
                .build();


        ss.addNetworkRegistrationInfo(new NetworkRegistrationInfo.Builder()
        ss.addNetworkRegistrationInfo(new NetworkRegistrationInfo.Builder()
                .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
@@ -3707,9 +3739,13 @@ public class DataNetworkControllerTest extends TelephonyTest {
        ServiceState ss = new ServiceState();
        ServiceState ss = new ServiceState();


        // VoPS network
        // VoPS network
        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo(8, false, true, true,
        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo.Builder(8)
                new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_SUPPORTED,
                .setNrAvailable(true)
                        LteVopsSupportInfo.LTE_STATUS_SUPPORTED));
                .setEnDcAvailable(true)
                .setVopsSupportInfo(new LteVopsSupportInfo(
                        LteVopsSupportInfo.LTE_STATUS_SUPPORTED,
                        LteVopsSupportInfo.LTE_STATUS_SUPPORTED))
                .build();


        ss.addNetworkRegistrationInfo(new NetworkRegistrationInfo.Builder()
        ss.addNetworkRegistrationInfo(new NetworkRegistrationInfo.Builder()
                .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
@@ -3754,9 +3790,13 @@ public class DataNetworkControllerTest extends TelephonyTest {


        ss = new ServiceState();
        ss = new ServiceState();
        // Non VoPS network
        // Non VoPS network
        dsri = new DataSpecificRegistrationInfo(8, false, true, true,
        dsri = new DataSpecificRegistrationInfo.Builder(8)
                new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED,
                .setNrAvailable(true)
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED));
                .setEnDcAvailable(true)
                .setVopsSupportInfo(new LteVopsSupportInfo(
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED,
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED))
                .build();


        ss.addNetworkRegistrationInfo(new NetworkRegistrationInfo.Builder()
        ss.addNetworkRegistrationInfo(new NetworkRegistrationInfo.Builder()
                .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
                .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
@@ -3808,9 +3848,13 @@ public class DataNetworkControllerTest extends TelephonyTest {
        carrierConfigChanged();
        carrierConfigChanged();


        // VoPS supported
        // VoPS supported
        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo(8, false, true, true,
        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo.Builder(8)
                new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_SUPPORTED,
                .setNrAvailable(true)
                        LteVopsSupportInfo.LTE_STATUS_SUPPORTED));
                .setEnDcAvailable(true)
                .setVopsSupportInfo(new LteVopsSupportInfo(
                        LteVopsSupportInfo.LTE_STATUS_SUPPORTED,
                        LteVopsSupportInfo.LTE_STATUS_SUPPORTED))
                .build();
        serviceStateChanged(TelephonyManager.NETWORK_TYPE_LTE,
        serviceStateChanged(TelephonyManager.NETWORK_TYPE_LTE,
                NetworkRegistrationInfo.REGISTRATION_STATE_HOME, dsri);
                NetworkRegistrationInfo.REGISTRATION_STATE_HOME, dsri);


@@ -3822,9 +3866,13 @@ public class DataNetworkControllerTest extends TelephonyTest {


        doReturn(PhoneConstants.State.OFFHOOK).when(mCT).getState();
        doReturn(PhoneConstants.State.OFFHOOK).when(mCT).getState();


        dsri = new DataSpecificRegistrationInfo(8, false, true, true,
        dsri = new DataSpecificRegistrationInfo.Builder(8)
                new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED,
                .setNrAvailable(true)
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED));
                .setEnDcAvailable(true)
                .setVopsSupportInfo(new LteVopsSupportInfo(
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED,
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED))
                .build();
        serviceStateChanged(TelephonyManager.NETWORK_TYPE_LTE,
        serviceStateChanged(TelephonyManager.NETWORK_TYPE_LTE,
                NetworkRegistrationInfo.REGISTRATION_STATE_HOME, dsri);
                NetworkRegistrationInfo.REGISTRATION_STATE_HOME, dsri);


+28 −12
Original line number Original line Diff line number Diff line
@@ -471,9 +471,13 @@ public class DataNetworkTest extends TelephonyTest {


    @Test
    @Test
    public void testCreateDataNetworkWhenOos() throws Exception {
    public void testCreateDataNetworkWhenOos() throws Exception {
        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo(8, false, true, true,
        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo.Builder(8)
                new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_SUPPORTED,
                .setNrAvailable(true)
                        LteVopsSupportInfo.LTE_STATUS_SUPPORTED));
                .setEnDcAvailable(true)
                .setVopsSupportInfo(new LteVopsSupportInfo(
                        LteVopsSupportInfo.LTE_STATUS_SUPPORTED,
                        LteVopsSupportInfo.LTE_STATUS_SUPPORTED))
                .build();
        // Out of service
        // Out of service
        serviceStateChanged(TelephonyManager.NETWORK_TYPE_LTE,
        serviceStateChanged(TelephonyManager.NETWORK_TYPE_LTE,
                NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING, dsri);
                NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING, dsri);
@@ -513,9 +517,13 @@ public class DataNetworkTest extends TelephonyTest {
    public void testRecreateAgentWhenOos() throws Exception {
    public void testRecreateAgentWhenOos() throws Exception {
        testCreateDataNetwork();
        testCreateDataNetwork();


        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo(8, false, true, true,
        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo.Builder(8)
                new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_SUPPORTED,
                .setNrAvailable(true)
                        LteVopsSupportInfo.LTE_STATUS_SUPPORTED));
                .setEnDcAvailable(true)
                .setVopsSupportInfo(new LteVopsSupportInfo(
                        LteVopsSupportInfo.LTE_STATUS_SUPPORTED,
                        LteVopsSupportInfo.LTE_STATUS_SUPPORTED))
                .build();
        // Out of service
        // Out of service
        serviceStateChanged(TelephonyManager.NETWORK_TYPE_LTE,
        serviceStateChanged(TelephonyManager.NETWORK_TYPE_LTE,
                NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING, dsri);
                NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING, dsri);
@@ -1363,9 +1371,13 @@ public class DataNetworkTest extends TelephonyTest {


    @Test
    @Test
    public void testMovingToNonVops() throws Exception {
    public void testMovingToNonVops() throws Exception {
        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo(8, false, true, true,
        DataSpecificRegistrationInfo dsri = new DataSpecificRegistrationInfo.Builder(8)
                new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_SUPPORTED,
                .setNrAvailable(true)
                        LteVopsSupportInfo.LTE_STATUS_SUPPORTED));
                .setEnDcAvailable(true)
                .setVopsSupportInfo(new LteVopsSupportInfo(
                        LteVopsSupportInfo.LTE_STATUS_SUPPORTED,
                        LteVopsSupportInfo.LTE_STATUS_SUPPORTED))
                .build();
        serviceStateChanged(TelephonyManager.NETWORK_TYPE_LTE,
        serviceStateChanged(TelephonyManager.NETWORK_TYPE_LTE,
                NetworkRegistrationInfo.REGISTRATION_STATE_HOME, dsri);
                NetworkRegistrationInfo.REGISTRATION_STATE_HOME, dsri);
        testCreateImsDataNetwork();
        testCreateImsDataNetwork();
@@ -1373,9 +1385,13 @@ public class DataNetworkTest extends TelephonyTest {
        assertThat(mDataNetworkUT.getNetworkCapabilities().hasCapability(
        assertThat(mDataNetworkUT.getNetworkCapabilities().hasCapability(
                NetworkCapabilities.NET_CAPABILITY_MMTEL)).isTrue();
                NetworkCapabilities.NET_CAPABILITY_MMTEL)).isTrue();


        dsri = new DataSpecificRegistrationInfo(8, false, true, true,
        dsri = new DataSpecificRegistrationInfo.Builder(8)
                new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED,
                .setNrAvailable(true)
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED));
                .setEnDcAvailable(true)
                .setVopsSupportInfo(new LteVopsSupportInfo(
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED,
                        LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED))
                .build();
        logd("Trigger non VoPS");
        logd("Trigger non VoPS");
        serviceStateChanged(TelephonyManager.NETWORK_TYPE_LTE,
        serviceStateChanged(TelephonyManager.NETWORK_TYPE_LTE,
                NetworkRegistrationInfo.REGISTRATION_STATE_HOME, dsri);
                NetworkRegistrationInfo.REGISTRATION_STATE_HOME, dsri);