Search in sources :

Example 6 with PhoneCapability

use of android.telephony.PhoneCapability in project android_packages_apps_Settings by omnirom.

the class NetworkScanHelperTest method createNetworkScanForPreferredAccessNetworks_deviceNoNrSa_noNgran.

@Test
public void createNetworkScanForPreferredAccessNetworks_deviceNoNrSa_noNgran() {
    int[] deviceNrCapabilities = new int[] { PhoneCapability.DEVICE_NR_CAPABILITY_NSA };
    PhoneCapability phoneCapability = createPhoneCapability(deviceNrCapabilities);
    doReturn(TelephonyManager.NETWORK_CLASS_BITMASK_2G | TelephonyManager.NETWORK_CLASS_BITMASK_3G | TelephonyManager.NETWORK_CLASS_BITMASK_4G | TelephonyManager.NETWORK_CLASS_BITMASK_5G).when(mTelephonyManager).getPreferredNetworkTypeBitmask();
    doReturn(phoneCapability).when(mTelephonyManager).getPhoneCapability();
    List<RadioAccessSpecifier> radioAccessSpecifiers = new ArrayList<>();
    radioAccessSpecifiers.add(new RadioAccessSpecifier(AccessNetworkConstants.AccessNetworkType.GERAN, null, null));
    radioAccessSpecifiers.add(new RadioAccessSpecifier(AccessNetworkConstants.AccessNetworkType.UTRAN, null, null));
    radioAccessSpecifiers.add(new RadioAccessSpecifier(AccessNetworkConstants.AccessNetworkType.EUTRAN, null, null));
    NetworkScanRequest expectedNetworkScanRequest = createNetworkScanRequest(radioAccessSpecifiers);
    assertEquals(expectedNetworkScanRequest, mNetworkScanHelper.createNetworkScanForPreferredAccessNetworks());
}
Also used : PhoneCapability(android.telephony.PhoneCapability) NetworkScanRequest(android.telephony.NetworkScanRequest) ArrayList(java.util.ArrayList) RadioAccessSpecifier(android.telephony.RadioAccessSpecifier) Test(org.junit.Test)

Example 7 with PhoneCapability

use of android.telephony.PhoneCapability in project android_packages_apps_Settings by omnirom.

the class NetworkScanHelperTest method createPhoneCapability.

private PhoneCapability createPhoneCapability(int[] deviceNrCapabilities) {
    int maxActiveVoiceCalls = 1;
    int maxActiveData = 2;
    ModemInfo modemInfo = new ModemInfo(1, 2, true, false);
    List<ModemInfo> logicalModemList = new ArrayList<>();
    logicalModemList.add(modemInfo);
    return new PhoneCapability(maxActiveVoiceCalls, maxActiveData, logicalModemList, false, deviceNrCapabilities);
}
Also used : PhoneCapability(android.telephony.PhoneCapability) ArrayList(java.util.ArrayList) ModemInfo(android.telephony.ModemInfo)

Example 8 with PhoneCapability

use of android.telephony.PhoneCapability in project android_frameworks_opt_telephony by LineageOS.

the class PhoneSwitcherTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp(getClass().getSimpleName());
    PhoneCapability phoneCapability = new PhoneCapability(1, 1, 0, null, false);
    doReturn(phoneCapability).when(mPhoneConfigurationManager).getCurrentPhoneCapability();
    doReturn(Call.State.ACTIVE).when(mActiveCall).getState();
    doReturn(Call.State.IDLE).when(mInactiveCall).getState();
    doReturn(Call.State.HOLDING).when(mHoldingCall).getState();
    replaceInstance(Phone.class, "mCi", mPhone, mCommandsInterface0);
    replaceInstance(Phone.class, "mCi", mPhone2, mCommandsInterface1);
}
Also used : PhoneCapability(android.telephony.PhoneCapability) Before(org.junit.Before)

Example 9 with PhoneCapability

use of android.telephony.PhoneCapability in project android_frameworks_opt_telephony by LineageOS.

the class PhoneCapabilityTest method basicTests.

@Test
@SmallTest
public void basicTests() throws Exception {
    int maxActiveVoiceCalls = 1;
    int maxActiveData = 2;
    int max5G = 3;
    ModemInfo modemInfo = new ModemInfo(1, 2, true, false);
    List<ModemInfo> logicalModemList = new ArrayList<>();
    logicalModemList.add(modemInfo);
    PhoneCapability capability = new PhoneCapability(maxActiveVoiceCalls, maxActiveData, max5G, logicalModemList, false);
    assertEquals(maxActiveVoiceCalls, capability.maxActiveVoiceCalls);
    assertEquals(maxActiveData, capability.maxActiveData);
    assertEquals(max5G, capability.max5G);
    assertEquals(1, capability.logicalModemList.size());
    assertEquals(modemInfo, capability.logicalModemList.get(0));
    PhoneCapability toCompare = new PhoneCapability(maxActiveVoiceCalls + 1, maxActiveData - 1, max5G, logicalModemList, false);
    assertEquals(capability, new PhoneCapability(maxActiveVoiceCalls, maxActiveData, max5G, logicalModemList, false));
    assertNotEquals(capability, toCompare);
}
Also used : PhoneCapability(android.telephony.PhoneCapability) ArrayList(java.util.ArrayList) ModemInfo(android.telephony.ModemInfo) SmallTest(android.test.suitebuilder.annotation.SmallTest) Test(org.junit.Test) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Aggregations

PhoneCapability (android.telephony.PhoneCapability)9 ArrayList (java.util.ArrayList)6 Test (org.junit.Test)5 ModemInfo (android.telephony.ModemInfo)4 SmallTest (android.test.suitebuilder.annotation.SmallTest)3 NetworkScanRequest (android.telephony.NetworkScanRequest)2 RadioAccessSpecifier (android.telephony.RadioAccessSpecifier)2 Parcel (android.os.Parcel)1 Before (org.junit.Before)1