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

Commit b5c1b9d7 authored by Pengquan Meng's avatar Pengquan Meng Committed by Gerrit Code Review
Browse files

Merge "Add HAL converter for DataRegStateResultV1.4"

parents 5a7980f3 cd231bdf
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
@@ -276,7 +276,7 @@ public class CellularNetworkService extends NetworkService {
                return new NetworkRegistrationState(domain, transportType, regState,
                        accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices,
                        cellIdentity, maxDataCalls, false /* isDcNrRestricted */,
                        false /* isNrAvailable */);
                        false /* isNrAvailable */, false /* isEnDcAvailable */);

            } else if (result instanceof android.hardware.radio.V1_2.DataRegStateResult) {
                android.hardware.radio.V1_2.DataRegStateResult dataRegState =
@@ -293,7 +293,25 @@ public class CellularNetworkService extends NetworkService {
                return new NetworkRegistrationState(domain, transportType, regState,
                        accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices,
                        cellIdentity, maxDataCalls, false /* isDcNrRestricted */,
                        false /* isNrAvailable */);
                        false /* isNrAvailable */, false /* isEnDcAvailable */);
            } else if (result instanceof android.hardware.radio.V1_4.DataRegStateResult) {
                android.hardware.radio.V1_4.DataRegStateResult dataRegState =
                        (android.hardware.radio.V1_4.DataRegStateResult) result;
                int regState = getRegStateFromHalRegState(dataRegState.base.regState);
                int accessNetworkTechnology =
                        getAccessNetworkTechnologyFromRat(dataRegState.base.rat);
                int reasonForDenial = dataRegState.base.reasonDataDenied;
                boolean emergencyOnly = isEmergencyOnly(dataRegState.base.regState);
                int maxDataCalls = dataRegState.base.maxDataCalls;
                int[] availableServices = getAvailableServices(regState, domain, emergencyOnly);
                CellIdentity cellIdentity =
                        convertHalCellIdentityToCellIdentity(dataRegState.base.cellIdentity);
                android.hardware.radio.V1_4.NrIndicators nrIndicators = dataRegState.nrIndicators;

                return new NetworkRegistrationState(domain, transportType, regState,
                        accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices,
                        cellIdentity, maxDataCalls, nrIndicators.isDcNrRestricted,
                        nrIndicators.isNrAvailable, nrIndicators.isEndcAvailable);
            }
            return null;
        }
+1 −1
Original line number Diff line number Diff line
@@ -157,7 +157,7 @@ public class CellularNetworkServiceTest extends TelephonyTest {
        expectedState = new NetworkRegistrationState(
                domain, AccessNetworkConstants.TransportType.WWAN, voiceRegState,
                ServiceState.rilRadioTechnologyToNetworkType(voiceRadioTech), reasonForDenial,
                false, availableServices, null, maxDataCalls, false, false);
                false, availableServices, null, maxDataCalls, false, false, false);

        try {
            verify(mCallback, times(1)).onGetNetworkRegistrationStateComplete(
+2 −2
Original line number Diff line number Diff line
@@ -291,7 +291,7 @@ public class ServiceStateTest extends TestCase {

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

        NetworkRegistrationState wlanRegState = new NetworkRegistrationState(
                NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TransportType.WLAN,
@@ -313,7 +313,7 @@ public class ServiceStateTest extends TestCase {

        wwanDataRegState = new NetworkRegistrationState(
                NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TransportType.WWAN,
                0, 0, 0, true, null, null, 0, false, false);
                0, 0, 0, true, null, null, 0, false, false, false);
        ss.addNetworkRegistrationState(wwanDataRegState);
        assertEquals(ss.getNetworkRegistrationStates(NetworkRegistrationState.DOMAIN_PS,
                AccessNetworkConstants.TransportType.WWAN), wwanDataRegState);
+3 −3
Original line number Diff line number Diff line
@@ -1673,7 +1673,7 @@ public class ServiceStateTrackerTest extends TelephonyTest {

    private void changeRegState(int state, CellIdentity cid, int voiceRat, int dataRat) {
        NetworkRegistrationState dataResult = new NetworkRegistrationState(
                0, 0, state, dataRat, 0, false, null, cid, 1, false, false);
                0, 0, state, dataRat, 0, false, null, cid, 1, false, false, false);
        sst.mPollingContext[0] = 2;
        // update data reg state to be in service
        sst.sendMessage(sst.obtainMessage(ServiceStateTracker.EVENT_POLL_STATE_GPRS,
@@ -1762,7 +1762,7 @@ public class ServiceStateTrackerTest extends TelephonyTest {
    private void sendRegStateUpdateForLteCellId(CellIdentityLte cellId) {
        NetworkRegistrationState dataResult = new NetworkRegistrationState(
                2, 1, 1, TelephonyManager.NETWORK_TYPE_LTE, 0, false, null, cellId, 1,
                false, false);
                false, false, false);
        NetworkRegistrationState voiceResult = new NetworkRegistrationState(
                1, 1, 1, TelephonyManager.NETWORK_TYPE_LTE, 0, false, null, cellId,
                false, 0, 0, 0);
@@ -1826,7 +1826,7 @@ public class ServiceStateTrackerTest extends TelephonyTest {
        testPhyChanBandwidthRatchetedOnPhyChanBandwidth();
        NetworkRegistrationState dataResult = new NetworkRegistrationState(
                2, 1, 0, TelephonyManager.NETWORK_TYPE_UNKNOWN, 0, false, null, null, 1, false,
                false);
                false, false);
        NetworkRegistrationState voiceResult = new NetworkRegistrationState(
                1, 1, 0, TelephonyManager.NETWORK_TYPE_UNKNOWN, 0, false, null, null,
                false, 0, 0, 0);