Search in sources :

Example 6 with EmergencyNumber

use of android.telephony.emergency.EmergencyNumber in project android_frameworks_opt_telephony by LineageOS.

the class EmergencyNumberTest method testSameEmergencyNumberDifferentSourceTestOrNot.

public void testSameEmergencyNumberDifferentSourceTestOrNot() throws Exception {
    EmergencyNumber num1 = new EmergencyNumber("911", "jp", "30", EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED, new ArrayList<String>(), EmergencyNumber.EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING, EmergencyNumber.EMERGENCY_CALL_ROUTING_NORMAL);
    EmergencyNumber num2 = new EmergencyNumber("911", "jp", "30", EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED, new ArrayList<String>(), EmergencyNumber.EMERGENCY_NUMBER_SOURCE_TEST, EmergencyNumber.EMERGENCY_CALL_ROUTING_NORMAL);
    assertFalse(EmergencyNumber.areSameEmergencyNumbers(num1, num2));
}
Also used : EmergencyNumber(android.telephony.emergency.EmergencyNumber)

Example 7 with EmergencyNumber

use of android.telephony.emergency.EmergencyNumber in project android_frameworks_opt_telephony by LineageOS.

the class EmergencyNumberTest method testSameEmergencyNumberDifferenCountry.

public void testSameEmergencyNumberDifferenCountry() throws Exception {
    EmergencyNumber num1 = new EmergencyNumber("911", "us", "30", EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED, new ArrayList<String>(), EmergencyNumber.EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING, EmergencyNumber.EMERGENCY_CALL_ROUTING_NORMAL);
    EmergencyNumber num2 = new EmergencyNumber("911", "jp", "30", EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED, new ArrayList<String>(), EmergencyNumber.EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING, EmergencyNumber.EMERGENCY_CALL_ROUTING_NORMAL);
    assertFalse(EmergencyNumber.areSameEmergencyNumbers(num1, num2));
}
Also used : EmergencyNumber(android.telephony.emergency.EmergencyNumber)

Example 8 with EmergencyNumber

use of android.telephony.emergency.EmergencyNumber in project android_frameworks_opt_telephony by LineageOS.

the class EmergencyNumberTest method testSameEmergencyNumberCallRouting.

public void testSameEmergencyNumberCallRouting() throws Exception {
    EmergencyNumber num1 = new EmergencyNumber("911", "jp", "30", EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED, new ArrayList<String>(), EmergencyNumber.EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING, EmergencyNumber.EMERGENCY_CALL_ROUTING_EMERGENCY);
    EmergencyNumber num2 = new EmergencyNumber("911", "jp", "30", EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED, new ArrayList<String>(), EmergencyNumber.EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING, EmergencyNumber.EMERGENCY_CALL_ROUTING_NORMAL);
    assertFalse(EmergencyNumber.areSameEmergencyNumbers(num1, num2));
}
Also used : EmergencyNumber(android.telephony.emergency.EmergencyNumber)

Example 9 with EmergencyNumber

use of android.telephony.emergency.EmergencyNumber in project android_frameworks_opt_telephony by LineageOS.

the class EmergencyNumberTest method testEmergencyNumberSpecificService.

public void testEmergencyNumberSpecificService() throws Exception {
    EmergencyNumber number = new EmergencyNumber("911", "us", "30", EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_MARINE_GUARD, new ArrayList<String>(), EmergencyNumber.EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING | EmergencyNumber.EMERGENCY_NUMBER_SOURCE_MODEM_CONFIG, EmergencyNumber.EMERGENCY_CALL_ROUTING_NORMAL);
    assertEquals(number.getNumber(), "911");
    assertEquals(number.getCountryIso(), "us");
    assertEquals(number.getMnc(), "30");
    assertFalse(number.isInEmergencyServiceCategories(EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED));
    assertFalse(number.isInEmergencyServiceCategories(EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_POLICE));
    assertFalse(number.isInEmergencyServiceCategories(EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_AMBULANCE));
    assertFalse(number.isInEmergencyServiceCategories(EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_FIRE_BRIGADE));
    assertTrue(number.isInEmergencyServiceCategories(EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_MARINE_GUARD));
    assertFalse(number.isInEmergencyServiceCategories(EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_MOUNTAIN_RESCUE));
    assertFalse(number.isInEmergencyServiceCategories(EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_MIEC));
    assertFalse(number.isInEmergencyServiceCategories(EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_AIEC));
    assertEquals(8, number.getEmergencyServiceCategoryBitmask());
    List<Integer> categories = number.getEmergencyServiceCategories();
    assertEquals(1, categories.size());
    assertEquals(EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_MARINE_GUARD, (int) categories.get(0));
    assertTrue(number.isFromSources(EmergencyNumber.EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING));
    assertFalse(number.isFromSources(EmergencyNumber.EMERGENCY_NUMBER_SOURCE_SIM));
    assertTrue(number.isFromSources(EmergencyNumber.EMERGENCY_NUMBER_SOURCE_MODEM_CONFIG));
    assertFalse(number.isFromSources(EmergencyNumber.EMERGENCY_NUMBER_SOURCE_DEFAULT));
    assertEquals(EmergencyNumber.EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING | EmergencyNumber.EMERGENCY_NUMBER_SOURCE_MODEM_CONFIG, number.getEmergencyNumberSourceBitmask());
    List<Integer> sources = number.getEmergencyNumberSources();
    assertEquals(2, sources.size());
    Collections.sort(sources);
    List<Integer> sourcesToVerify = new ArrayList<Integer>();
    sourcesToVerify.add(EmergencyNumber.EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING);
    sourcesToVerify.add(EmergencyNumber.EMERGENCY_NUMBER_SOURCE_MODEM_CONFIG);
    Collections.sort(sourcesToVerify);
    assertTrue(sourcesToVerify.equals(sources));
    assertEquals(EmergencyNumber.EMERGENCY_CALL_ROUTING_NORMAL, number.getEmergencyCallRouting());
}
Also used : EmergencyNumber(android.telephony.emergency.EmergencyNumber) ArrayList(java.util.ArrayList)

Example 10 with EmergencyNumber

use of android.telephony.emergency.EmergencyNumber in project android_frameworks_opt_telephony by LineageOS.

the class EmergencyNumberTest method testEmergencyNumberDisplayPriority.

public void testEmergencyNumberDisplayPriority() throws Exception {
    EmergencyNumber numberHighestDisplayPriority = new EmergencyNumber("911", "us", "30", EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED, new ArrayList<String>(), EmergencyNumber.EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING, EmergencyNumber.EMERGENCY_CALL_ROUTING_NORMAL);
    EmergencyNumber numberHigherDisplayPriority = new EmergencyNumber("922", "us", "30", EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_POLICE | EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_AMBULANCE | EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_MIEC, new ArrayList<String>(), EmergencyNumber.EMERGENCY_NUMBER_SOURCE_SIM, EmergencyNumber.EMERGENCY_CALL_ROUTING_NORMAL);
    EmergencyNumber numberLowestDisplayPriority = new EmergencyNumber("110", "us", "30", EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_POLICE | EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_AMBULANCE | EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_MIEC, new ArrayList<String>(), EmergencyNumber.EMERGENCY_NUMBER_SOURCE_MODEM_CONFIG | EmergencyNumber.EMERGENCY_NUMBER_SOURCE_DEFAULT, EmergencyNumber.EMERGENCY_CALL_ROUTING_NORMAL);
    assertTrue(numberHighestDisplayPriority.compareTo(numberHigherDisplayPriority) < 0);
    assertTrue(numberHigherDisplayPriority.compareTo(numberLowestDisplayPriority) < 0);
}
Also used : EmergencyNumber(android.telephony.emergency.EmergencyNumber)

Aggregations

EmergencyNumber (android.telephony.emergency.EmergencyNumber)29 ArrayList (java.util.ArrayList)10 Test (org.junit.Test)6 HalVersion (com.android.internal.telephony.HalVersion)4 TelephonyTest (com.android.internal.telephony.TelephonyTest)4 SmallTest (android.test.suitebuilder.annotation.SmallTest)3 AsyncResult (android.os.AsyncResult)2 ProtobufEccData (com.android.phone.ecc.nano.ProtobufEccData)2 EccInfo (com.android.phone.ecc.nano.ProtobufEccData.EccInfo)2 BufferedInputStream (java.io.BufferedInputStream)2 IOException (java.io.IOException)2 Field (java.lang.reflect.Field)2 GZIPInputStream (java.util.zip.GZIPInputStream)2 PhoneStateListener (android.telephony.PhoneStateListener)1 ServiceState (android.telephony.ServiceState)1 EmergencyNumberTracker (com.android.internal.telephony.emergency.EmergencyNumberTracker)1 TelephonyLog (com.android.internal.telephony.nano.TelephonyProto.TelephonyLog)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 Before (org.junit.Before)1