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

Commit 90d4e1fe authored by Jack Yu's avatar Jack Yu
Browse files

Reordered the params for network registration

Test: Build
Bug: 73659459
Change-Id: I27a93094bed4c12817ce90b8f12520bc5340d28f
parent 3fd56935
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -228,7 +228,7 @@ public class CellularNetworkService extends NetworkService {
                CellIdentity cellIdentity =
                        convertHalCellIdentityToCellIdentity(voiceRegState.cellIdentity);

                return new NetworkRegistrationState(transportType, domain, regState,
                return new NetworkRegistrationState(domain, transportType, regState,
                        accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices,
                        cellIdentity, cssSupported, roamingIndicator, systemIsInPrl,
                        defaultRoamingIndicator);
@@ -248,7 +248,7 @@ public class CellularNetworkService extends NetworkService {
                CellIdentity cellIdentity =
                        convertHalCellIdentityToCellIdentity(voiceRegState.cellIdentity);

                return new NetworkRegistrationState(transportType, domain, regState,
                return new NetworkRegistrationState(domain, transportType, regState,
                        accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices,
                        cellIdentity, cssSupported, roamingIndicator, systemIsInPrl,
                        defaultRoamingIndicator);
@@ -258,8 +258,8 @@ public class CellularNetworkService extends NetworkService {
        }

        private NetworkRegistrationState createRegistrationStateFromDataRegState(Object result) {
            int transportType = TransportType.WWAN;
            int domain = NetworkRegistrationState.DOMAIN_PS;
            int transportType = TransportType.WWAN;

            if (result instanceof android.hardware.radio.V1_0.DataRegStateResult) {
                android.hardware.radio.V1_0.DataRegStateResult dataRegState =
@@ -273,7 +273,7 @@ public class CellularNetworkService extends NetworkService {
                CellIdentity cellIdentity =
                        convertHalCellIdentityToCellIdentity(dataRegState.cellIdentity);

                return new NetworkRegistrationState(transportType, domain, regState,
                return new NetworkRegistrationState(domain, transportType, regState,
                        accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices,
                        cellIdentity, maxDataCalls);
            } else if (result instanceof android.hardware.radio.V1_2.DataRegStateResult) {
@@ -288,7 +288,7 @@ public class CellularNetworkService extends NetworkService {
                CellIdentity cellIdentity =
                        convertHalCellIdentityToCellIdentity(dataRegState.cellIdentity);

                return new NetworkRegistrationState(transportType, domain, regState,
                return new NetworkRegistrationState(domain, transportType, regState,
                        accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices,
                        cellIdentity, maxDataCalls);
            }
+2 −2
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ public class CellularNetworkServiceTest extends TelephonyTest {
        waitForMs(1000);

        NetworkRegistrationState expectedState = new NetworkRegistrationState(
                AccessNetworkConstants.TransportType.WWAN, domain, voiceRegState,
                domain, AccessNetworkConstants.TransportType.WWAN, voiceRegState,
                ServiceState.rilRadioTechnologyToNetworkType(voiceRadioTech), reasonForDenial,
                false, availableServices, null, cssSupported,
                roamingIndicator, systemIsInPrl, defaultRoamingIndicator);
@@ -155,7 +155,7 @@ public class CellularNetworkServiceTest extends TelephonyTest {
        waitForMs(1000);

        expectedState = new NetworkRegistrationState(
                AccessNetworkConstants.TransportType.WWAN, domain, voiceRegState,
                domain, AccessNetworkConstants.TransportType.WWAN, voiceRegState,
                ServiceState.rilRadioTechnologyToNetworkType(voiceRadioTech), reasonForDenial,
                false, availableServices, null, maxDataCalls);

+54 −0
Original line number Diff line number Diff line
/*
 * Copyright 2018 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 android.os.Parcel;
import android.support.test.filters.SmallTest;
import android.telephony.AccessNetworkConstants.TransportType;
import android.telephony.CellIdentityLte;
import android.telephony.NetworkRegistrationState;
import android.telephony.TelephonyManager;

import org.junit.Test;

/** Unit tests for {@link NetworkRegistrationState}. */

public class NetworkRegistrationStateTest {

    @Test
    @SmallTest
    public void testParcel() {
        NetworkRegistrationState nrs = new NetworkRegistrationState(
                NetworkRegistrationState.DOMAIN_CS,
                TransportType.WWAN,
                NetworkRegistrationState.REG_STATE_HOME,
                TelephonyManager.NETWORK_TYPE_LTE,
                0,
                false,
                new int[]{NetworkRegistrationState.SERVICE_TYPE_DATA},
                new CellIdentityLte());

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

        NetworkRegistrationState newNrs = NetworkRegistrationState.CREATOR.createFromParcel(p);
        assertEquals(nrs, newNrs);
    }
}
+12 −12
Original line number Diff line number Diff line
@@ -282,18 +282,18 @@ public class ServiceStateTest extends TestCase {
    @SmallTest
    public void testNetworkRegistrationState() {
        NetworkRegistrationState wwanVoiceRegState = new NetworkRegistrationState(
                AccessNetworkConstants.TransportType.WWAN, NetworkRegistrationState.DOMAIN_CS,
                NetworkRegistrationState.DOMAIN_CS, AccessNetworkConstants.TransportType.WWAN,
                0, 0, 0, false,
                null, null, true, 0, 0, 0);


        NetworkRegistrationState wwanDataRegState = new NetworkRegistrationState(
                AccessNetworkConstants.TransportType.WWAN, NetworkRegistrationState.DOMAIN_PS,
                NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TransportType.WWAN,
                0, 0, 0, false,
                null, null, 0);

        NetworkRegistrationState wlanRegState = new NetworkRegistrationState(
                AccessNetworkConstants.TransportType.WLAN, NetworkRegistrationState.DOMAIN_PS,
                NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TransportType.WLAN,
                0, 0, 0, false,
                null, null);

@@ -303,20 +303,20 @@ public class ServiceStateTest extends TestCase {
        ss.addNetworkRegistrationState(wwanDataRegState);
        ss.addNetworkRegistrationState(wlanRegState);

        assertEquals(ss.getNetworkRegistrationStates(AccessNetworkConstants.TransportType.WWAN,
                NetworkRegistrationState.DOMAIN_CS), wwanVoiceRegState);
        assertEquals(ss.getNetworkRegistrationStates(AccessNetworkConstants.TransportType.WWAN,
                NetworkRegistrationState.DOMAIN_PS), wwanDataRegState);
        assertEquals(ss.getNetworkRegistrationStates(AccessNetworkConstants.TransportType.WLAN,
                NetworkRegistrationState.DOMAIN_PS), wlanRegState);
        assertEquals(ss.getNetworkRegistrationStates(NetworkRegistrationState.DOMAIN_CS,
                AccessNetworkConstants.TransportType.WWAN), wwanVoiceRegState);
        assertEquals(ss.getNetworkRegistrationStates(NetworkRegistrationState.DOMAIN_PS,
                AccessNetworkConstants.TransportType.WWAN), wwanDataRegState);
        assertEquals(ss.getNetworkRegistrationStates(NetworkRegistrationState.DOMAIN_PS,
                AccessNetworkConstants.TransportType.WLAN), wlanRegState);

        wwanDataRegState = new NetworkRegistrationState(
                AccessNetworkConstants.TransportType.WWAN, NetworkRegistrationState.DOMAIN_PS,
                NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TransportType.WWAN,
                0, 0, 0, true,
                null, null, 0);
        ss.addNetworkRegistrationState(wwanDataRegState);
        assertEquals(ss.getNetworkRegistrationStates(AccessNetworkConstants.TransportType.WWAN,
                NetworkRegistrationState.DOMAIN_PS), wwanDataRegState);
        assertEquals(ss.getNetworkRegistrationStates(NetworkRegistrationState.DOMAIN_PS,
                AccessNetworkConstants.TransportType.WWAN), wwanDataRegState);
    }

    @SmallTest
+2 −2
Original line number Diff line number Diff line
@@ -1648,7 +1648,7 @@ public class ServiceStateTrackerTest extends TelephonyTest {

    private void sendRegStateUpdateForLteCellId(CellIdentityLte cellId) {
        NetworkRegistrationState dataResult = new NetworkRegistrationState(
                1, 2, 1, TelephonyManager.NETWORK_TYPE_LTE, 0, false, null, cellId, 1);
                2, 1, 1, TelephonyManager.NETWORK_TYPE_LTE, 0, false, null, cellId, 1);
        NetworkRegistrationState voiceResult = new NetworkRegistrationState(
                1, 1, 1, TelephonyManager.NETWORK_TYPE_LTE, 0, false, null, cellId,
                false, 0, 0, 0);
@@ -1711,7 +1711,7 @@ public class ServiceStateTrackerTest extends TelephonyTest {
    public void testPhyChanBandwidthResetsOnOos() throws Exception {
        testPhyChanBandwidthRatchetedOnPhyChanBandwidth();
        NetworkRegistrationState dataResult = new NetworkRegistrationState(
                1, 2, 0, TelephonyManager.NETWORK_TYPE_UNKNOWN, 0, false, null, null, 1);
                2, 1, 0, TelephonyManager.NETWORK_TYPE_UNKNOWN, 0, false, null, null, 1);
        NetworkRegistrationState voiceResult = new NetworkRegistrationState(
                1, 1, 0, TelephonyManager.NETWORK_TYPE_UNKNOWN, 0, false, null, null,
                false, 0, 0, 0);