Search in sources :

Example 1 with ModemInfo

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

the class RadioConfigResponse method convertHalPhoneCapability.

private PhoneCapability convertHalPhoneCapability(android.hardware.radio.config.V1_1.PhoneCapability phoneCapability) {
    // TODO b/121394331: clean up V1_1.PhoneCapability fields.
    int maxActiveVoiceCalls = 0;
    int maxActiveData = phoneCapability.maxActiveData;
    int max5G = 0;
    boolean validationBeforeSwitchSupported = phoneCapability.isInternetLingeringSupported;
    List<ModemInfo> logicalModemList = new ArrayList();
    for (android.hardware.radio.config.V1_1.ModemInfo modemInfo : phoneCapability.logicalModemList) {
        logicalModemList.add(new ModemInfo(modemInfo.modemId));
    }
    return new PhoneCapability(maxActiveVoiceCalls, maxActiveData, max5G, logicalModemList, validationBeforeSwitchSupported);
}
Also used : PhoneCapability(android.telephony.PhoneCapability) ArrayList(java.util.ArrayList) ModemInfo(android.telephony.ModemInfo)

Example 2 with ModemInfo

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

the class PhoneCapabilityTest method parcelReadWrite.

@Test
@SmallTest
public void parcelReadWrite() 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);
    Parcel parcel = Parcel.obtain();
    capability.writeToParcel(parcel, 0);
    parcel.setDataPosition(0);
    PhoneCapability toCompare = PhoneCapability.CREATOR.createFromParcel(parcel);
    assertEquals(maxActiveVoiceCalls, toCompare.maxActiveVoiceCalls);
    assertEquals(maxActiveData, toCompare.maxActiveData);
    assertEquals(max5G, toCompare.max5G);
    assertEquals(1, toCompare.logicalModemList.size());
    assertEquals(modemInfo, toCompare.logicalModemList.get(0));
    assertEquals(capability, toCompare);
}
Also used : PhoneCapability(android.telephony.PhoneCapability) Parcel(android.os.Parcel) ArrayList(java.util.ArrayList) ModemInfo(android.telephony.ModemInfo) SmallTest(android.test.suitebuilder.annotation.SmallTest) Test(org.junit.Test) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 3 with ModemInfo

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

the class ModemInfoTest method parcelReadWrite.

@Test
@SmallTest
public void parcelReadWrite() throws Exception {
    int modemId = 1;
    int rat = 2;
    boolean isVoiceSupported = true;
    boolean isDataSupported = false;
    ModemInfo modemInfo = new ModemInfo(modemId, rat, isVoiceSupported, isDataSupported);
    Parcel parcel = Parcel.obtain();
    modemInfo.writeToParcel(parcel, 0);
    parcel.setDataPosition(0);
    ModemInfo toCompare = ModemInfo.CREATOR.createFromParcel(parcel);
    assertEquals(modemId, toCompare.modemId);
    assertEquals(rat, toCompare.rat);
    assertEquals(isVoiceSupported, toCompare.isVoiceSupported);
    assertEquals(isDataSupported, toCompare.isDataSupported);
    assertEquals(modemInfo, toCompare);
}
Also used : Parcel(android.os.Parcel) ModemInfo(android.telephony.ModemInfo) SmallTest(android.test.suitebuilder.annotation.SmallTest) Test(org.junit.Test) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 4 with ModemInfo

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

the class ModemInfoTest method basicTests.

@Test
@SmallTest
public void basicTests() throws Exception {
    int modemId = 1;
    int rat = 2;
    boolean isVoiceSupported = true;
    boolean isDataSupported = false;
    ModemInfo modemInfo = new ModemInfo(modemId, rat, isVoiceSupported, isDataSupported);
    assertEquals(modemId, modemInfo.modemId);
    assertEquals(rat, modemInfo.rat);
    assertEquals(isVoiceSupported, modemInfo.isVoiceSupported);
    assertEquals(isDataSupported, modemInfo.isDataSupported);
    assertNotEquals(modemInfo, new ModemInfo(modemId + 1, rat, isVoiceSupported, isDataSupported));
    assertNotEquals(modemInfo, new ModemInfo(modemId, rat + 1, isVoiceSupported, isDataSupported));
    assertNotEquals(modemInfo, new ModemInfo(modemId, rat, !isVoiceSupported, isDataSupported));
    assertNotEquals(modemInfo, new ModemInfo(modemId, rat, isVoiceSupported, !isDataSupported));
}
Also used : ModemInfo(android.telephony.ModemInfo) SmallTest(android.test.suitebuilder.annotation.SmallTest) Test(org.junit.Test) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 5 with ModemInfo

use of android.telephony.ModemInfo 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)

Aggregations

ModemInfo (android.telephony.ModemInfo)6 PhoneCapability (android.telephony.PhoneCapability)4 SmallTest (android.test.suitebuilder.annotation.SmallTest)4 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 Parcel (android.os.Parcel)2