Loading src/java/com/android/internal/telephony/CellularNetworkService.java +25 −6 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.internal.telephony; import android.annotation.NonNull; import android.annotation.Nullable; import android.hardware.radio.V1_0.RegState; import android.hardware.radio.V1_4.DataRegStateResult.VopsInfo.hidl_discriminator; import android.os.AsyncResult; Loading @@ -26,14 +28,17 @@ import android.os.Message; import android.telephony.AccessNetworkConstants; import android.telephony.AccessNetworkConstants.AccessNetworkType; import android.telephony.CellIdentity; import android.telephony.CellIdentityCdma; import android.telephony.LteVopsSupportInfo; import android.telephony.NetworkRegistrationInfo; import android.telephony.NetworkService; import android.telephony.NetworkServiceCallback; import com.android.telephony.Rlog; import android.telephony.ServiceState; import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.text.TextUtils; import com.android.telephony.Rlog; import java.util.ArrayList; import java.util.List; Loading Loading @@ -202,6 +207,17 @@ public class CellularNetworkService extends NetworkService { } } private @NonNull String getPlmnFromCellIdentity(@Nullable final CellIdentity ci) { if (ci == null || ci instanceof CellIdentityCdma) return ""; final String mcc = ci.getMccString(); final String mnc = ci.getMncString(); if (TextUtils.isEmpty(mcc) || TextUtils.isEmpty(mnc)) return ""; return mcc + mnc; } private NetworkRegistrationInfo createRegistrationStateFromVoiceRegState(Object result) { int transportType = AccessNetworkConstants.TRANSPORT_TYPE_WWAN; int domain = NetworkRegistrationInfo.DOMAIN_CS; Loading @@ -223,10 +239,11 @@ public class CellularNetworkService extends NetworkService { List<Integer> availableServices = getAvailableServices( regState, domain, emergencyOnly); CellIdentity cellIdentity = CellIdentity.create(voiceRegState.cellIdentity); final String rplmn = getPlmnFromCellIdentity(cellIdentity); return new NetworkRegistrationInfo(domain, transportType, regState, networkType, reasonForDenial, emergencyOnly, availableServices, cellIdentity, cssSupported, roamingIndicator, systemIsInPrl, cellIdentity, rplmn, cssSupported, roamingIndicator, systemIsInPrl, defaultRoamingIndicator); } else if (result instanceof android.hardware.radio.V1_2.VoiceRegStateResult) { android.hardware.radio.V1_2.VoiceRegStateResult voiceRegState = Loading @@ -245,10 +262,11 @@ public class CellularNetworkService extends NetworkService { List<Integer> availableServices = getAvailableServices( regState, domain, emergencyOnly); CellIdentity cellIdentity = CellIdentity.create(voiceRegState.cellIdentity); final String rplmn = getPlmnFromCellIdentity(cellIdentity); return new NetworkRegistrationInfo(domain, transportType, regState, networkType, reasonForDenial, emergencyOnly, availableServices, cellIdentity, cssSupported, roamingIndicator, systemIsInPrl, cellIdentity, rplmn, cssSupported, roamingIndicator, systemIsInPrl, defaultRoamingIndicator); } Loading Loading @@ -325,6 +343,7 @@ public class CellularNetworkService extends NetworkService { return null; } String rplmn = getPlmnFromCellIdentity(cellIdentity); List<Integer> availableServices = getAvailableServices( regState, domain, emergencyOnly); Loading @@ -334,9 +353,9 @@ public class CellularNetworkService extends NetworkService { } return new NetworkRegistrationInfo(domain, transportType, regState, networkType, reasonForDenial, emergencyOnly, availableServices, cellIdentity, maxDataCalls, isDcNrRestricted, isNrAvailable, isEndcAvailable, lteVopsSupportInfo, isUsingCarrierAggregation); reasonForDenial, emergencyOnly, availableServices, cellIdentity, rplmn, maxDataCalls, isDcNrRestricted, isNrAvailable, isEndcAvailable, lteVopsSupportInfo, isUsingCarrierAggregation); } private LteVopsSupportInfo convertHalLteVopsSupportInfo( Loading tests/telephonytests/src/com/android/internal/telephony/CellularNetworkServiceTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ public class CellularNetworkServiceTest extends TelephonyTest { NetworkRegistrationInfo expectedState = new NetworkRegistrationInfo( domain, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, voiceRegState, ServiceState.rilRadioTechnologyToNetworkType(voiceRadioTech), reasonForDenial, false, availableServices, null, cssSupported, false, availableServices, null, "", cssSupported, roamingIndicator, systemIsInPrl, defaultRoamingIndicator); try { Loading @@ -159,7 +159,7 @@ public class CellularNetworkServiceTest extends TelephonyTest { expectedState = new NetworkRegistrationInfo( domain, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, voiceRegState, ServiceState.rilRadioTechnologyToNetworkType(voiceRadioTech), reasonForDenial, false, availableServices, null, maxDataCalls, false, false, false, false, availableServices, null, "", maxDataCalls, false, false, false, lteVopsSupportInfo, false); try { Loading tests/telephonytests/src/com/android/internal/telephony/NetworkRegistrationInfoTest.java +16 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ public class NetworkRegistrationInfoTest { .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_LTE) .setAvailableServices(Arrays.asList(NetworkRegistrationInfo.SERVICE_TYPE_DATA)) .setCellIdentity(new CellIdentityLte()) .setRegisteredPlmn("12345") .build(); Parcel p = Parcel.obtain(); Loading @@ -52,4 +53,19 @@ public class NetworkRegistrationInfoTest { NetworkRegistrationInfo newNrs = NetworkRegistrationInfo.CREATOR.createFromParcel(p); assertEquals(nri, newNrs); } @Test @SmallTest public void testDefaultValues() { NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder().build(); assertEquals("", nri.getRegisteredPlmn()); } @Test @SmallTest public void testBuilder() { assertEquals("12345", new NetworkRegistrationInfo.Builder() .setRegisteredPlmn("12345").build().getRegisteredPlmn()); } } tests/telephonytests/src/com/android/internal/telephony/ServiceStateTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -304,7 +304,7 @@ public class ServiceStateTest extends TestCase { NetworkRegistrationInfo wwanVoiceRegState = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, 0, 0, 0, false, null, null, true, 0, 0, 0); null, null, "", true, 0, 0, 0); LteVopsSupportInfo lteVopsSupportInfo = new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE, Loading Loading @@ -335,7 +335,7 @@ public class ServiceStateTest extends TestCase { wwanDataRegState = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, 0, 0, 0, true, null, null, 0, false, false, false, lteVopsSupportInfo, false); 0, 0, 0, true, null, null, "", 0, false, false, false, lteVopsSupportInfo, false); ss.addNetworkRegistrationInfo(wwanDataRegState); assertEquals(ss.getNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN), wwanDataRegState); Loading tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java +29 −16 Original line number Diff line number Diff line Loading @@ -88,6 +88,7 @@ import android.telephony.cdma.CdmaCellLocation; import android.telephony.gsm.GsmCellLocation; import android.test.suitebuilder.annotation.MediumTest; import android.test.suitebuilder.annotation.SmallTest; import android.text.TextUtils; import android.util.Pair; import androidx.test.filters.FlakyTest; Loading Loading @@ -336,6 +337,17 @@ public class ServiceStateTrackerTest extends TelephonyTest { super.tearDown(); } private static String getPlmnFromCellIdentity(final CellIdentity ci) { if (ci == null || ci instanceof CellIdentityCdma) return ""; final String mcc = ci.getMccString(); final String mnc = ci.getMncString(); if (TextUtils.isEmpty(mcc) || TextUtils.isEmpty(mnc)) return ""; return mcc + mnc; } @Test @MediumTest public void testSetRadioPower() { Loading Loading @@ -849,6 +861,7 @@ public class ServiceStateTrackerTest extends TelephonyTest { .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN) .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_HOME) .setCellIdentity(cellIdentityGsm) .setRegisteredPlmn("00101") .build(); sst.sendMessage(sst.obtainMessage(ServiceStateTracker.EVENT_GET_LOC_DONE, Loading Loading @@ -1870,8 +1883,8 @@ public class ServiceStateTrackerTest extends TelephonyTest { LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE); NetworkRegistrationInfo dataResult = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, state, dataRat, 0, false, null, cid, 1, false, false, false, lteVopsSupportInfo, false); state, dataRat, 0, false, null, cid, getPlmnFromCellIdentity(cid), 1, false, false, false, lteVopsSupportInfo, false); sst.mPollingContext[0] = 2; // update data reg state to be in service sst.sendMessage(sst.obtainMessage( Loading @@ -1881,7 +1894,7 @@ public class ServiceStateTrackerTest extends TelephonyTest { NetworkRegistrationInfo voiceResult = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, state, voiceRat, 0, false, null, cid, false, 0, 0, 0); null, cid, getPlmnFromCellIdentity(cid), false, 0, 0, 0); sst.sendMessage(sst.obtainMessage( ServiceStateTracker.EVENT_POLL_STATE_CS_CELLULAR_REGISTRATION, new AsyncResult(sst.mPollingContext, voiceResult, null))); Loading @@ -1898,8 +1911,8 @@ public class ServiceStateTrackerTest extends TelephonyTest { // PS WWAN NetworkRegistrationInfo dataResult = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, state, dataRat, 0, false, null, cid, 1, false, false, false, lteVopsSupportInfo, false); state, dataRat, 0, false, null, cid, getPlmnFromCellIdentity(cid), 1, false, false, false, lteVopsSupportInfo, false); sst.sendMessage(sst.obtainMessage( ServiceStateTracker.EVENT_POLL_STATE_PS_CELLULAR_REGISTRATION, new AsyncResult(sst.mPollingContext, dataResult, null))); Loading @@ -1908,8 +1921,7 @@ public class ServiceStateTrackerTest extends TelephonyTest { // CS WWAN NetworkRegistrationInfo voiceResult = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, state, voiceRat, 0, false, null, cid, false, 0, 0, 0); state, voiceRat, 0, false, null, cid, getPlmnFromCellIdentity(cid), false, 0, 0, 0); sst.sendMessage(sst.obtainMessage( ServiceStateTracker.EVENT_POLL_STATE_CS_CELLULAR_REGISTRATION, new AsyncResult(sst.mPollingContext, voiceResult, null))); Loading @@ -1919,7 +1931,7 @@ public class ServiceStateTrackerTest extends TelephonyTest { NetworkRegistrationInfo dataIwlanResult = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WLAN, iwlanState, iwlanDataRat, 0, false, null, null, 1, false, false, false, lteVopsSupportInfo, false); null, null, "", 1, false, false, false, lteVopsSupportInfo, false); sst.sendMessage(sst.obtainMessage( ServiceStateTracker.EVENT_POLL_STATE_PS_IWLAN_REGISTRATION, new AsyncResult(sst.mPollingContext, dataIwlanResult, null))); Loading Loading @@ -2033,11 +2045,12 @@ public class ServiceStateTrackerTest extends TelephonyTest { NetworkRegistrationInfo dataResult = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, NetworkRegistrationInfo.REGISTRATION_STATE_HOME, TelephonyManager.NETWORK_TYPE_LTE, 0, false, null, cellId, 1, false, false, false, lteVopsSupportInfo, false); 0, false, null, cellId, getPlmnFromCellIdentity(cellId), 1, false, false, false, lteVopsSupportInfo, false); NetworkRegistrationInfo voiceResult = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, NetworkRegistrationInfo.REGISTRATION_STATE_HOME, TelephonyManager.NETWORK_TYPE_LTE, 0, false, null, cellId, false, 0, 0, 0); 0, false, null, cellId, getPlmnFromCellIdentity(cellId), false, 0, 0, 0); sst.mPollingContext[0] = 2; // update data reg state to be in service sst.sendMessage(sst.obtainMessage( Loading Loading @@ -2108,12 +2121,12 @@ public class ServiceStateTrackerTest extends TelephonyTest { NetworkRegistrationInfo dataResult = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING, TelephonyManager.NETWORK_TYPE_UNKNOWN, 0, false, null, null, 1, false, false, TelephonyManager.NETWORK_TYPE_UNKNOWN, 0, false, null, null, "", 1, false, false, false, lteVopsSupportInfo, false); NetworkRegistrationInfo voiceResult = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING, TelephonyManager.NETWORK_TYPE_UNKNOWN, 0, false, null, null, false, 0, 0, 0); TelephonyManager.NETWORK_TYPE_UNKNOWN, 0, false, null, null, "", false, 0, 0, 0); sst.mPollingContext[0] = 2; sst.sendMessage(sst.obtainMessage( ServiceStateTracker.EVENT_POLL_STATE_PS_CELLULAR_REGISTRATION, Loading Loading @@ -2303,7 +2316,7 @@ public class ServiceStateTrackerTest extends TelephonyTest { NetworkRegistrationInfo dataResult = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, NetworkRegistrationInfo.REGISTRATION_STATE_HOME, TelephonyManager.NETWORK_TYPE_LTE, 0, false, null, cellId, 1, false, false, false, lteVopsSupportInfo, false); 0, false, null, cellId, "00101", 1, false, false, false, lteVopsSupportInfo, false); sst.mPollingContext[0] = 2; sst.sendMessage(sst.obtainMessage( Loading @@ -2313,7 +2326,7 @@ public class ServiceStateTrackerTest extends TelephonyTest { NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, NetworkRegistrationInfo.REGISTRATION_STATE_HOME, TelephonyManager.NETWORK_TYPE_LTE, 0, false, null, cellId, false, 0, 0, 0); false, null, cellId, "00101", false, 0, 0, 0); sst.sendMessage(sst.obtainMessage( ServiceStateTracker.EVENT_POLL_STATE_CS_CELLULAR_REGISTRATION, new AsyncResult(sst.mPollingContext, voiceResult, null))); Loading @@ -2332,8 +2345,8 @@ public class ServiceStateTrackerTest extends TelephonyTest { dataResult = new NetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, NetworkRegistrationInfo.REGISTRATION_STATE_HOME, TelephonyManager.NETWORK_TYPE_LTE, 0, false, null, cellId, 1, false, false, false, lteVopsSupportInfo, false); TelephonyManager.NETWORK_TYPE_LTE, 0, false, null, cellId, "00101", 1, false, false, false, lteVopsSupportInfo, false); sst.mPollingContext[0] = 1; sst.sendMessage(sst.obtainMessage( ServiceStateTracker.EVENT_POLL_STATE_PS_CELLULAR_REGISTRATION, Loading Loading
src/java/com/android/internal/telephony/CellularNetworkService.java +25 −6 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.internal.telephony; import android.annotation.NonNull; import android.annotation.Nullable; import android.hardware.radio.V1_0.RegState; import android.hardware.radio.V1_4.DataRegStateResult.VopsInfo.hidl_discriminator; import android.os.AsyncResult; Loading @@ -26,14 +28,17 @@ import android.os.Message; import android.telephony.AccessNetworkConstants; import android.telephony.AccessNetworkConstants.AccessNetworkType; import android.telephony.CellIdentity; import android.telephony.CellIdentityCdma; import android.telephony.LteVopsSupportInfo; import android.telephony.NetworkRegistrationInfo; import android.telephony.NetworkService; import android.telephony.NetworkServiceCallback; import com.android.telephony.Rlog; import android.telephony.ServiceState; import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.text.TextUtils; import com.android.telephony.Rlog; import java.util.ArrayList; import java.util.List; Loading Loading @@ -202,6 +207,17 @@ public class CellularNetworkService extends NetworkService { } } private @NonNull String getPlmnFromCellIdentity(@Nullable final CellIdentity ci) { if (ci == null || ci instanceof CellIdentityCdma) return ""; final String mcc = ci.getMccString(); final String mnc = ci.getMncString(); if (TextUtils.isEmpty(mcc) || TextUtils.isEmpty(mnc)) return ""; return mcc + mnc; } private NetworkRegistrationInfo createRegistrationStateFromVoiceRegState(Object result) { int transportType = AccessNetworkConstants.TRANSPORT_TYPE_WWAN; int domain = NetworkRegistrationInfo.DOMAIN_CS; Loading @@ -223,10 +239,11 @@ public class CellularNetworkService extends NetworkService { List<Integer> availableServices = getAvailableServices( regState, domain, emergencyOnly); CellIdentity cellIdentity = CellIdentity.create(voiceRegState.cellIdentity); final String rplmn = getPlmnFromCellIdentity(cellIdentity); return new NetworkRegistrationInfo(domain, transportType, regState, networkType, reasonForDenial, emergencyOnly, availableServices, cellIdentity, cssSupported, roamingIndicator, systemIsInPrl, cellIdentity, rplmn, cssSupported, roamingIndicator, systemIsInPrl, defaultRoamingIndicator); } else if (result instanceof android.hardware.radio.V1_2.VoiceRegStateResult) { android.hardware.radio.V1_2.VoiceRegStateResult voiceRegState = Loading @@ -245,10 +262,11 @@ public class CellularNetworkService extends NetworkService { List<Integer> availableServices = getAvailableServices( regState, domain, emergencyOnly); CellIdentity cellIdentity = CellIdentity.create(voiceRegState.cellIdentity); final String rplmn = getPlmnFromCellIdentity(cellIdentity); return new NetworkRegistrationInfo(domain, transportType, regState, networkType, reasonForDenial, emergencyOnly, availableServices, cellIdentity, cssSupported, roamingIndicator, systemIsInPrl, cellIdentity, rplmn, cssSupported, roamingIndicator, systemIsInPrl, defaultRoamingIndicator); } Loading Loading @@ -325,6 +343,7 @@ public class CellularNetworkService extends NetworkService { return null; } String rplmn = getPlmnFromCellIdentity(cellIdentity); List<Integer> availableServices = getAvailableServices( regState, domain, emergencyOnly); Loading @@ -334,9 +353,9 @@ public class CellularNetworkService extends NetworkService { } return new NetworkRegistrationInfo(domain, transportType, regState, networkType, reasonForDenial, emergencyOnly, availableServices, cellIdentity, maxDataCalls, isDcNrRestricted, isNrAvailable, isEndcAvailable, lteVopsSupportInfo, isUsingCarrierAggregation); reasonForDenial, emergencyOnly, availableServices, cellIdentity, rplmn, maxDataCalls, isDcNrRestricted, isNrAvailable, isEndcAvailable, lteVopsSupportInfo, isUsingCarrierAggregation); } private LteVopsSupportInfo convertHalLteVopsSupportInfo( Loading
tests/telephonytests/src/com/android/internal/telephony/CellularNetworkServiceTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ public class CellularNetworkServiceTest extends TelephonyTest { NetworkRegistrationInfo expectedState = new NetworkRegistrationInfo( domain, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, voiceRegState, ServiceState.rilRadioTechnologyToNetworkType(voiceRadioTech), reasonForDenial, false, availableServices, null, cssSupported, false, availableServices, null, "", cssSupported, roamingIndicator, systemIsInPrl, defaultRoamingIndicator); try { Loading @@ -159,7 +159,7 @@ public class CellularNetworkServiceTest extends TelephonyTest { expectedState = new NetworkRegistrationInfo( domain, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, voiceRegState, ServiceState.rilRadioTechnologyToNetworkType(voiceRadioTech), reasonForDenial, false, availableServices, null, maxDataCalls, false, false, false, false, availableServices, null, "", maxDataCalls, false, false, false, lteVopsSupportInfo, false); try { Loading
tests/telephonytests/src/com/android/internal/telephony/NetworkRegistrationInfoTest.java +16 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ public class NetworkRegistrationInfoTest { .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_LTE) .setAvailableServices(Arrays.asList(NetworkRegistrationInfo.SERVICE_TYPE_DATA)) .setCellIdentity(new CellIdentityLte()) .setRegisteredPlmn("12345") .build(); Parcel p = Parcel.obtain(); Loading @@ -52,4 +53,19 @@ public class NetworkRegistrationInfoTest { NetworkRegistrationInfo newNrs = NetworkRegistrationInfo.CREATOR.createFromParcel(p); assertEquals(nri, newNrs); } @Test @SmallTest public void testDefaultValues() { NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder().build(); assertEquals("", nri.getRegisteredPlmn()); } @Test @SmallTest public void testBuilder() { assertEquals("12345", new NetworkRegistrationInfo.Builder() .setRegisteredPlmn("12345").build().getRegisteredPlmn()); } }
tests/telephonytests/src/com/android/internal/telephony/ServiceStateTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -304,7 +304,7 @@ public class ServiceStateTest extends TestCase { NetworkRegistrationInfo wwanVoiceRegState = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, 0, 0, 0, false, null, null, true, 0, 0, 0); null, null, "", true, 0, 0, 0); LteVopsSupportInfo lteVopsSupportInfo = new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE, Loading Loading @@ -335,7 +335,7 @@ public class ServiceStateTest extends TestCase { wwanDataRegState = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, 0, 0, 0, true, null, null, 0, false, false, false, lteVopsSupportInfo, false); 0, 0, 0, true, null, null, "", 0, false, false, false, lteVopsSupportInfo, false); ss.addNetworkRegistrationInfo(wwanDataRegState); assertEquals(ss.getNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN), wwanDataRegState); Loading
tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java +29 −16 Original line number Diff line number Diff line Loading @@ -88,6 +88,7 @@ import android.telephony.cdma.CdmaCellLocation; import android.telephony.gsm.GsmCellLocation; import android.test.suitebuilder.annotation.MediumTest; import android.test.suitebuilder.annotation.SmallTest; import android.text.TextUtils; import android.util.Pair; import androidx.test.filters.FlakyTest; Loading Loading @@ -336,6 +337,17 @@ public class ServiceStateTrackerTest extends TelephonyTest { super.tearDown(); } private static String getPlmnFromCellIdentity(final CellIdentity ci) { if (ci == null || ci instanceof CellIdentityCdma) return ""; final String mcc = ci.getMccString(); final String mnc = ci.getMncString(); if (TextUtils.isEmpty(mcc) || TextUtils.isEmpty(mnc)) return ""; return mcc + mnc; } @Test @MediumTest public void testSetRadioPower() { Loading Loading @@ -849,6 +861,7 @@ public class ServiceStateTrackerTest extends TelephonyTest { .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN) .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_HOME) .setCellIdentity(cellIdentityGsm) .setRegisteredPlmn("00101") .build(); sst.sendMessage(sst.obtainMessage(ServiceStateTracker.EVENT_GET_LOC_DONE, Loading Loading @@ -1870,8 +1883,8 @@ public class ServiceStateTrackerTest extends TelephonyTest { LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE); NetworkRegistrationInfo dataResult = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, state, dataRat, 0, false, null, cid, 1, false, false, false, lteVopsSupportInfo, false); state, dataRat, 0, false, null, cid, getPlmnFromCellIdentity(cid), 1, false, false, false, lteVopsSupportInfo, false); sst.mPollingContext[0] = 2; // update data reg state to be in service sst.sendMessage(sst.obtainMessage( Loading @@ -1881,7 +1894,7 @@ public class ServiceStateTrackerTest extends TelephonyTest { NetworkRegistrationInfo voiceResult = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, state, voiceRat, 0, false, null, cid, false, 0, 0, 0); null, cid, getPlmnFromCellIdentity(cid), false, 0, 0, 0); sst.sendMessage(sst.obtainMessage( ServiceStateTracker.EVENT_POLL_STATE_CS_CELLULAR_REGISTRATION, new AsyncResult(sst.mPollingContext, voiceResult, null))); Loading @@ -1898,8 +1911,8 @@ public class ServiceStateTrackerTest extends TelephonyTest { // PS WWAN NetworkRegistrationInfo dataResult = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, state, dataRat, 0, false, null, cid, 1, false, false, false, lteVopsSupportInfo, false); state, dataRat, 0, false, null, cid, getPlmnFromCellIdentity(cid), 1, false, false, false, lteVopsSupportInfo, false); sst.sendMessage(sst.obtainMessage( ServiceStateTracker.EVENT_POLL_STATE_PS_CELLULAR_REGISTRATION, new AsyncResult(sst.mPollingContext, dataResult, null))); Loading @@ -1908,8 +1921,7 @@ public class ServiceStateTrackerTest extends TelephonyTest { // CS WWAN NetworkRegistrationInfo voiceResult = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, state, voiceRat, 0, false, null, cid, false, 0, 0, 0); state, voiceRat, 0, false, null, cid, getPlmnFromCellIdentity(cid), false, 0, 0, 0); sst.sendMessage(sst.obtainMessage( ServiceStateTracker.EVENT_POLL_STATE_CS_CELLULAR_REGISTRATION, new AsyncResult(sst.mPollingContext, voiceResult, null))); Loading @@ -1919,7 +1931,7 @@ public class ServiceStateTrackerTest extends TelephonyTest { NetworkRegistrationInfo dataIwlanResult = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WLAN, iwlanState, iwlanDataRat, 0, false, null, null, 1, false, false, false, lteVopsSupportInfo, false); null, null, "", 1, false, false, false, lteVopsSupportInfo, false); sst.sendMessage(sst.obtainMessage( ServiceStateTracker.EVENT_POLL_STATE_PS_IWLAN_REGISTRATION, new AsyncResult(sst.mPollingContext, dataIwlanResult, null))); Loading Loading @@ -2033,11 +2045,12 @@ public class ServiceStateTrackerTest extends TelephonyTest { NetworkRegistrationInfo dataResult = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, NetworkRegistrationInfo.REGISTRATION_STATE_HOME, TelephonyManager.NETWORK_TYPE_LTE, 0, false, null, cellId, 1, false, false, false, lteVopsSupportInfo, false); 0, false, null, cellId, getPlmnFromCellIdentity(cellId), 1, false, false, false, lteVopsSupportInfo, false); NetworkRegistrationInfo voiceResult = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, NetworkRegistrationInfo.REGISTRATION_STATE_HOME, TelephonyManager.NETWORK_TYPE_LTE, 0, false, null, cellId, false, 0, 0, 0); 0, false, null, cellId, getPlmnFromCellIdentity(cellId), false, 0, 0, 0); sst.mPollingContext[0] = 2; // update data reg state to be in service sst.sendMessage(sst.obtainMessage( Loading Loading @@ -2108,12 +2121,12 @@ public class ServiceStateTrackerTest extends TelephonyTest { NetworkRegistrationInfo dataResult = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING, TelephonyManager.NETWORK_TYPE_UNKNOWN, 0, false, null, null, 1, false, false, TelephonyManager.NETWORK_TYPE_UNKNOWN, 0, false, null, null, "", 1, false, false, false, lteVopsSupportInfo, false); NetworkRegistrationInfo voiceResult = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING, TelephonyManager.NETWORK_TYPE_UNKNOWN, 0, false, null, null, false, 0, 0, 0); TelephonyManager.NETWORK_TYPE_UNKNOWN, 0, false, null, null, "", false, 0, 0, 0); sst.mPollingContext[0] = 2; sst.sendMessage(sst.obtainMessage( ServiceStateTracker.EVENT_POLL_STATE_PS_CELLULAR_REGISTRATION, Loading Loading @@ -2303,7 +2316,7 @@ public class ServiceStateTrackerTest extends TelephonyTest { NetworkRegistrationInfo dataResult = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, NetworkRegistrationInfo.REGISTRATION_STATE_HOME, TelephonyManager.NETWORK_TYPE_LTE, 0, false, null, cellId, 1, false, false, false, lteVopsSupportInfo, false); 0, false, null, cellId, "00101", 1, false, false, false, lteVopsSupportInfo, false); sst.mPollingContext[0] = 2; sst.sendMessage(sst.obtainMessage( Loading @@ -2313,7 +2326,7 @@ public class ServiceStateTrackerTest extends TelephonyTest { NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, NetworkRegistrationInfo.REGISTRATION_STATE_HOME, TelephonyManager.NETWORK_TYPE_LTE, 0, false, null, cellId, false, 0, 0, 0); false, null, cellId, "00101", false, 0, 0, 0); sst.sendMessage(sst.obtainMessage( ServiceStateTracker.EVENT_POLL_STATE_CS_CELLULAR_REGISTRATION, new AsyncResult(sst.mPollingContext, voiceResult, null))); Loading @@ -2332,8 +2345,8 @@ public class ServiceStateTrackerTest extends TelephonyTest { dataResult = new NetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, NetworkRegistrationInfo.REGISTRATION_STATE_HOME, TelephonyManager.NETWORK_TYPE_LTE, 0, false, null, cellId, 1, false, false, false, lteVopsSupportInfo, false); TelephonyManager.NETWORK_TYPE_LTE, 0, false, null, cellId, "00101", 1, false, false, false, lteVopsSupportInfo, false); sst.mPollingContext[0] = 1; sst.sendMessage(sst.obtainMessage( ServiceStateTracker.EVENT_POLL_STATE_PS_CELLULAR_REGISTRATION, Loading