use of android.telephony.emergency.EmergencyNumber in project android_frameworks_opt_telephony by LineageOS.
the class Connection method setEmergencyCallInfo.
/**
* Set the emergency number information if it is an emergency call.
*
* @hide
*/
public void setEmergencyCallInfo(CallTracker ct) {
if (ct != null) {
Phone phone = ct.getPhone();
if (phone != null) {
EmergencyNumberTracker tracker = phone.getEmergencyNumberTracker();
if (tracker != null) {
EmergencyNumber num = tracker.getEmergencyNumber(mAddress);
if (num != null) {
mIsEmergencyCall = true;
mEmergencyNumberInfo = num;
} else {
Rlog.e(TAG, "setEmergencyCallInfo: emergency number is null");
}
} else {
Rlog.e(TAG, "setEmergencyCallInfo: emergency number tracker is null");
}
} else {
Rlog.e(TAG, "setEmergencyCallInfo: phone is null");
}
} else {
Rlog.e(TAG, "setEmergencyCallInfo: call tracker is null");
}
}
use of android.telephony.emergency.EmergencyNumber in project android_frameworks_opt_telephony by LineageOS.
the class BaseCommands method registerForEmergencyNumberList.
@Override
public void registerForEmergencyNumberList(Handler h, int what, Object obj) {
mEmergencyNumberListRegistrants.addUnique(h, what, obj);
// Notify the last emergency number list from radio to new registrants because they may
// miss the latest indication (e.g. constructed in a delay after HAL is registrated).
List<EmergencyNumber> lastEmergencyNumberListIndication = getLastEmergencyNumberListIndication();
if (lastEmergencyNumberListIndication != null) {
mEmergencyNumberListRegistrants.notifyRegistrants(new AsyncResult(null, lastEmergencyNumberListIndication, null));
}
}
use of android.telephony.emergency.EmergencyNumber in project android_frameworks_opt_telephony by LineageOS.
the class EmergencyNumberTest method testSameEmergencyNumberDifferentUrns.
public void testSameEmergencyNumberDifferentUrns() throws Exception {
List<String> urn1 = new ArrayList<>();
urn1.add("sos");
List<String> urn2 = new ArrayList<>();
urn2.add("animal-control");
EmergencyNumber num1 = new EmergencyNumber("911", "jp", "30", EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED, urn1, EmergencyNumber.EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING, EmergencyNumber.EMERGENCY_CALL_ROUTING_NORMAL);
EmergencyNumber num2 = new EmergencyNumber("911", "jp", "30", EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED, urn2, 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 EmergencyNumberTrackerTest method testUsingEmergencyNumberDatabaseWheneverHal_1_3.
/**
* In 1.3 or less HAL. we should not use database number.
*/
@Test
public void testUsingEmergencyNumberDatabaseWheneverHal_1_3() {
doReturn(new HalVersion(1, 3)).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;
}
}
assertFalse(hasDatabaseNumber);
}
use of android.telephony.emergency.EmergencyNumber in project android_frameworks_opt_telephony by LineageOS.
the class EmergencyNumberTest method testSameEmergencyNumberDifferentName.
public void testSameEmergencyNumberDifferentName() 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("912", "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));
}
Aggregations