Search in sources :

Example 1 with LteVopsSupportInfo

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);
    }
}
Also used : NetworkRegistrationInfo(android.telephony.NetworkRegistrationInfo) LteVopsSupportInfo(android.telephony.LteVopsSupportInfo) ArrayList(java.util.ArrayList) RemoteException(android.os.RemoteException) MediumTest(android.test.suitebuilder.annotation.MediumTest) Test(org.junit.Test) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 2 with LteVopsSupportInfo

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()));
}
Also used : NetworkRegistrationInfo(android.telephony.NetworkRegistrationInfo) LteVopsSupportInfo(android.telephony.LteVopsSupportInfo) AsyncResult(android.os.AsyncResult) FlakyTest(androidx.test.filters.FlakyTest) MediumTest(android.test.suitebuilder.annotation.MediumTest) SmallTest(android.test.suitebuilder.annotation.SmallTest) Test(org.junit.Test)

Example 3 with LteVopsSupportInfo

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());
}
Also used : NetworkRegistrationInfo(android.telephony.NetworkRegistrationInfo) LteVopsSupportInfo(android.telephony.LteVopsSupportInfo) AsyncResult(android.os.AsyncResult)

Example 4 with LteVopsSupportInfo

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);
}
Also used : NetworkRegistrationInfo(android.telephony.NetworkRegistrationInfo) ServiceState(android.telephony.ServiceState) LteVopsSupportInfo(android.telephony.LteVopsSupportInfo) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 5 with LteVopsSupportInfo

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());
}
Also used : NetworkRegistrationInfo(android.telephony.NetworkRegistrationInfo) LteVopsSupportInfo(android.telephony.LteVopsSupportInfo) AsyncResult(android.os.AsyncResult)

Aggregations

LteVopsSupportInfo (android.telephony.LteVopsSupportInfo)7 NetworkRegistrationInfo (android.telephony.NetworkRegistrationInfo)7 AsyncResult (android.os.AsyncResult)5 MediumTest (android.test.suitebuilder.annotation.MediumTest)3 SmallTest (android.test.suitebuilder.annotation.SmallTest)3 Test (org.junit.Test)3 ServiceState (android.telephony.ServiceState)2 FlakyTest (androidx.test.filters.FlakyTest)2 RemoteException (android.os.RemoteException)1 CellIdentityLte (android.telephony.CellIdentityLte)1 ArrayList (java.util.ArrayList)1