use of android.telephony.LteVopsSupportInfo in project android_frameworks_opt_telephony by LineageOS.
the class CellularNetworkServiceTest method testGetNetworkRegistrationInfo.
@Test
@MediumTest
public void testGetNetworkRegistrationInfo() {
int voiceRegState = NetworkRegistrationInfo.REGISTRATION_STATE_HOME;
int dataRegState = NetworkRegistrationInfo.REGISTRATION_STATE_HOME;
int voiceRadioTech = ServiceState.RIL_RADIO_TECHNOLOGY_HSPA;
int dataRadioTech = ServiceState.RIL_RADIO_TECHNOLOGY_HSPA;
int domain = NetworkRegistrationInfo.DOMAIN_CS;
boolean cssSupported = true;
int roamingIndicator = 1;
int systemIsInPrl = 2;
int defaultRoamingIndicator = 3;
int reasonForDenial = 0;
int maxDataCalls = 4;
List<Integer> availableServices = new ArrayList<>(Arrays.asList(new Integer[] { NetworkRegistrationInfo.SERVICE_TYPE_VOICE, NetworkRegistrationInfo.SERVICE_TYPE_SMS, NetworkRegistrationInfo.SERVICE_TYPE_VIDEO }));
mSimulatedCommands.setVoiceRegState(voiceRegState);
mSimulatedCommands.setVoiceRadioTech(voiceRadioTech);
mSimulatedCommands.setDataRegState(dataRegState);
mSimulatedCommands.setDataRadioTech(dataRadioTech);
mSimulatedCommands.mCssSupported = cssSupported;
mSimulatedCommands.mRoamingIndicator = roamingIndicator;
mSimulatedCommands.mSystemIsInPrl = systemIsInPrl;
mSimulatedCommands.mDefaultRoamingIndicator = defaultRoamingIndicator;
mSimulatedCommands.mReasonForDenial = reasonForDenial;
mSimulatedCommands.mMaxDataCalls = maxDataCalls;
mSimulatedCommands.notifyNetworkStateChanged();
try {
mBinder.requestNetworkRegistrationInfo(0, domain, mCallback);
} catch (RemoteException e) {
assertTrue(false);
}
NetworkRegistrationInfo expectedState = new NetworkRegistrationInfo(domain, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, voiceRegState, ServiceState.rilRadioTechnologyToNetworkType(voiceRadioTech), reasonForDenial, false, availableServices, null, "", cssSupported, roamingIndicator, systemIsInPrl, defaultRoamingIndicator);
try {
verify(mCallback, timeout(1000).times(1)).onRequestNetworkRegistrationInfoComplete(eq(NetworkServiceCallback.RESULT_SUCCESS), eq(expectedState));
} catch (RemoteException e) {
assertTrue(false);
}
domain = NetworkRegistrationInfo.DOMAIN_PS;
availableServices = Arrays.asList(NetworkRegistrationInfo.SERVICE_TYPE_DATA);
try {
mBinder.requestNetworkRegistrationInfo(0, domain, mCallback);
} catch (RemoteException e) {
assertTrue(false);
}
LteVopsSupportInfo lteVopsSupportInfo = new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE, LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE);
expectedState = new NetworkRegistrationInfo(domain, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, voiceRegState, ServiceState.rilRadioTechnologyToNetworkType(voiceRadioTech), reasonForDenial, false, availableServices, null, "", maxDataCalls, false, false, false, lteVopsSupportInfo, false);
try {
verify(mCallback, timeout(1000).times(1)).onRequestNetworkRegistrationInfoComplete(eq(NetworkServiceCallback.RESULT_SUCCESS), eq(expectedState));
} catch (RemoteException e) {
assertTrue(false);
}
}
use of android.telephony.LteVopsSupportInfo in project android_frameworks_opt_telephony by LineageOS.
the class ServiceStateTrackerTest method testPhyChanBandwidthResetsOnOos.
@Test
public void testPhyChanBandwidthResetsOnOos() throws Exception {
testPhyChanBandwidthRatchetedOnPhyChanBandwidth();
LteVopsSupportInfo lteVopsSupportInfo = new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE, LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE);
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, 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);
sst.mPollingContext[0] = 2;
sst.sendMessage(sst.obtainMessage(ServiceStateTracker.EVENT_POLL_STATE_PS_CELLULAR_REGISTRATION, new AsyncResult(sst.mPollingContext, dataResult, null)));
waitForLastHandlerAction(mSSTTestHandler.getThreadHandler());
sst.sendMessage(sst.obtainMessage(ServiceStateTracker.EVENT_POLL_STATE_CS_CELLULAR_REGISTRATION, new AsyncResult(sst.mPollingContext, voiceResult, null)));
waitForLastHandlerAction(mSSTTestHandler.getThreadHandler());
assertTrue(Arrays.equals(new int[0], sst.mSS.getCellBandwidths()));
}
use of android.telephony.LteVopsSupportInfo in project android_frameworks_opt_telephony by LineageOS.
the class ServiceStateTrackerTest method sendRegStateUpdateForLteCellId.
private void sendRegStateUpdateForLteCellId(CellIdentityLte cellId) {
LteVopsSupportInfo lteVopsSupportInfo = new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE, LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE);
NetworkRegistrationInfo dataResult = new NetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, NetworkRegistrationInfo.REGISTRATION_STATE_HOME, TelephonyManager.NETWORK_TYPE_LTE, 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, getPlmnFromCellIdentity(cellId), false, 0, 0, 0);
sst.mPollingContext[0] = 2;
// update data reg state to be in service
sst.sendMessage(sst.obtainMessage(ServiceStateTracker.EVENT_POLL_STATE_PS_CELLULAR_REGISTRATION, new AsyncResult(sst.mPollingContext, dataResult, null)));
waitForLastHandlerAction(mSSTTestHandler.getThreadHandler());
sst.sendMessage(sst.obtainMessage(ServiceStateTracker.EVENT_POLL_STATE_CS_CELLULAR_REGISTRATION, new AsyncResult(sst.mPollingContext, voiceResult, null)));
waitForLastHandlerAction(mSSTTestHandler.getThreadHandler());
}
use of android.telephony.LteVopsSupportInfo in project android_frameworks_opt_telephony by LineageOS.
the class ServiceStateTest method testNetworkRegistrationInfo.
@SmallTest
public void testNetworkRegistrationInfo() {
NetworkRegistrationInfo wwanVoiceRegState = new NetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, 0, 0, 0, false, null, null, "", true, 0, 0, 0);
LteVopsSupportInfo lteVopsSupportInfo = new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE, LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE);
NetworkRegistrationInfo wwanDataRegState = new NetworkRegistrationInfo.Builder().setDomain(NetworkRegistrationInfo.DOMAIN_PS).setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN).build();
NetworkRegistrationInfo wlanRegState = new NetworkRegistrationInfo.Builder().setDomain(NetworkRegistrationInfo.DOMAIN_PS).setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WLAN).build();
ServiceState ss = new ServiceState();
ss.addNetworkRegistrationInfo(wwanVoiceRegState);
ss.addNetworkRegistrationInfo(wwanDataRegState);
ss.addNetworkRegistrationInfo(wlanRegState);
assertEquals(ss.getNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN), wwanVoiceRegState);
assertEquals(ss.getNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN), wwanDataRegState);
assertEquals(ss.getNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WLAN), wlanRegState);
wwanDataRegState = new NetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, 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);
}
use of android.telephony.LteVopsSupportInfo in project android_frameworks_opt_telephony by LineageOS.
the class ServiceStateTrackerTest method changeRegStateWithIwlan.
private void changeRegStateWithIwlan(int state, CellIdentity cid, int voiceRat, int dataRat, int iwlanState, int iwlanDataRat) {
LteVopsSupportInfo lteVopsSupportInfo = new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE, LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE);
sst.mPollingContext[0] = 3;
// PS WWAN
NetworkRegistrationInfo dataResult = new NetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, 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)));
waitForLastHandlerAction(mSSTTestHandler.getThreadHandler());
// CS WWAN
NetworkRegistrationInfo voiceResult = new NetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, 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)));
waitForLastHandlerAction(mSSTTestHandler.getThreadHandler());
// PS WLAN
NetworkRegistrationInfo dataIwlanResult = new NetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WLAN, iwlanState, iwlanDataRat, 0, 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)));
waitForLastHandlerAction(mSSTTestHandler.getThreadHandler());
}
Aggregations