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));
}
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));
}
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));
}
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());
}
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);
}
Aggregations