use of android.telephony.emergency.EmergencyNumber in project android_frameworks_opt_telephony by LineageOS.
the class EmergencyNumberTest method testMergeSameNumbersInEmergencyNumberListWithDifferentSources.
public void testMergeSameNumbersInEmergencyNumberListWithDifferentSources() throws Exception {
List<EmergencyNumber> inputNumberList = new ArrayList<>();
EmergencyNumber num1 = new EmergencyNumber("110", "jp", "30", EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED, new ArrayList<String>(), EmergencyNumber.EMERGENCY_NUMBER_SOURCE_DATABASE, EmergencyNumber.EMERGENCY_CALL_ROUTING_NORMAL);
EmergencyNumber num2 = new EmergencyNumber("110", "jp", "30", EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED, new ArrayList<String>(), EmergencyNumber.EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING, EmergencyNumber.EMERGENCY_CALL_ROUTING_NORMAL);
EmergencyNumber num3 = new EmergencyNumber("911", "us", "30", EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED, new ArrayList<String>(), EmergencyNumber.EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING, EmergencyNumber.EMERGENCY_CALL_ROUTING_NORMAL);
inputNumberList.add(num1);
inputNumberList.add(num2);
inputNumberList.add(num3);
EmergencyNumber num4 = new EmergencyNumber("110", "jp", "30", EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED, new ArrayList<String>(), EmergencyNumber.EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING | EmergencyNumber.EMERGENCY_NUMBER_SOURCE_DATABASE, EmergencyNumber.EMERGENCY_CALL_ROUTING_NORMAL);
List<EmergencyNumber> outputNumberList = new ArrayList<>();
outputNumberList.add(num3);
outputNumberList.add(num4);
Collections.sort(outputNumberList);
EmergencyNumber.mergeSameNumbersInEmergencyNumberList(inputNumberList);
assertEquals(outputNumberList, inputNumberList);
}
use of android.telephony.emergency.EmergencyNumber in project android_frameworks_opt_telephony by LineageOS.
the class EmergencyNumberTrackerTest method testUsingEmergencyNumberDatabaseWheneverHal_1_4.
/**
* In 1.4 or above HAL, we should use database number.
*/
@Test
public void testUsingEmergencyNumberDatabaseWheneverHal_1_4() {
doReturn(new HalVersion(1, 4)).when(mPhone).getHalVersion();
sendEmergencyNumberPrefix(mEmergencyNumberTrackerMock);
mEmergencyNumberTrackerMock.updateEmergencyCountryIsoAllPhones("us");
processAllMessages();
boolean hasDatabaseNumber = false;
for (EmergencyNumber number : mEmergencyNumberTrackerMock.getEmergencyNumberList()) {
if (number.isFromSources(EmergencyNumber.EMERGENCY_NUMBER_SOURCE_DATABASE)) {
hasDatabaseNumber = true;
break;
}
}
assertTrue(hasDatabaseNumber);
}
use of android.telephony.emergency.EmergencyNumber in project android_frameworks_opt_telephony by LineageOS.
the class EmergencyNumberTrackerTest method testEmergencyNumberListPrefix.
@Test
public void testEmergencyNumberListPrefix() throws Exception {
sendEmergencyNumberListFromRadio();
sendEmergencyNumberPrefix(mEmergencyNumberTrackerMock);
List<EmergencyNumber> resultToVerify = mEmergencyNumberListTestSample;
resultToVerify.add(new EmergencyNumber("123119", "jp", "30", EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_FIRE_BRIGADE, new ArrayList<String>(), EmergencyNumber.EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING, EmergencyNumber.EMERGENCY_CALL_ROUTING_UNKNOWN));
resultToVerify.add(new EmergencyNumber("456119", "jp", "30", EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_FIRE_BRIGADE, new ArrayList<String>(), EmergencyNumber.EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING, EmergencyNumber.EMERGENCY_CALL_ROUTING_UNKNOWN));
Collections.sort(resultToVerify);
List<EmergencyNumber> resultFromRadio = mEmergencyNumberTrackerMock.getRadioEmergencyNumberList();
Collections.sort(resultFromRadio);
assertEquals(resultToVerify, resultFromRadio);
}
use of android.telephony.emergency.EmergencyNumber in project android_frameworks_opt_telephony by LineageOS.
the class EmergencyNumberTrackerTest method initializeEmergencyNumberListTestSamples.
private void initializeEmergencyNumberListTestSamples() {
EmergencyNumber emergencyNumberForTest = new EmergencyNumber("119", "jp", "30", EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_FIRE_BRIGADE, new ArrayList<String>(), EmergencyNumber.EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING, EmergencyNumber.EMERGENCY_CALL_ROUTING_UNKNOWN);
mUsEmergencyNumber = new EmergencyNumber("911", "us", "", EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_POLICE | EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_AMBULANCE | EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_FIRE_BRIGADE, new ArrayList<String>(), EmergencyNumber.EMERGENCY_NUMBER_SOURCE_DATABASE, EmergencyNumber.EMERGENCY_CALL_ROUTING_UNKNOWN);
mEmergencyNumberListTestSample.add(emergencyNumberForTest);
}
Aggregations