use of android.telephony.emergency.EmergencyNumber in project android_frameworks_opt_telephony by LineageOS.
the class EmergencyNumberTest method testSameEmergencyNumberDifferentCategories.
public void testSameEmergencyNumberDifferentCategories() 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_POLICE, 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 RadioIndication method currentEmergencyNumberList.
/**
* Indicates current emergency number list.
*/
public void currentEmergencyNumberList(int indicationType, ArrayList<android.hardware.radio.V1_4.EmergencyNumber> emergencyNumberList) {
List<EmergencyNumber> response = new ArrayList<>(emergencyNumberList.size());
for (android.hardware.radio.V1_4.EmergencyNumber emergencyNumberHal : emergencyNumberList) {
EmergencyNumber emergencyNumber = new EmergencyNumber(emergencyNumberHal.number, MccTable.countryCodeForMcc(emergencyNumberHal.mcc), emergencyNumberHal.mnc, emergencyNumberHal.categories, emergencyNumberHal.urns, emergencyNumberHal.sources, EmergencyNumber.EMERGENCY_CALL_ROUTING_UNKNOWN);
response.add(emergencyNumber);
}
if (RIL.RILJ_LOGD)
mRil.unsljLogRet(RIL_UNSOL_EMERGENCY_NUMBER_LIST, response);
// Cache emergency number list from last indication.
mRil.cacheEmergencyNumberListIndication(response);
// Notify emergency number list from radio to registrants
mRil.mEmergencyNumberListRegistrants.notifyRegistrants(new AsyncResult(null, response, null));
}
use of android.telephony.emergency.EmergencyNumber in project android_frameworks_opt_telephony by LineageOS.
the class PhoneStateListenerTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp(getClass().getSimpleName());
mPhoneStateListenerUT = new PhoneStateListener() {
@Override
public void onServiceStateChanged(ServiceState serviceState) {
logd("Service State Changed");
mServiceState.setVoiceRegState(serviceState.getState());
mServiceState.setDataRegState(serviceState.getDataRegistrationState());
}
@Override
public void onUserMobileDataStateChanged(boolean state) {
logd("User Mobile Data State Changed");
mUserMobileDataState = true;
}
public void onOutgoingEmergencyCall(EmergencyNumber emergencyNumber) {
logd("OutgoingCallEmergencyNumber Changed");
mCalledEmergencyNumber = emergencyNumber;
}
public void onOutgoingEmergencySms(EmergencyNumber emergencyNumber) {
logd("OutgoingSmsEmergencyNumber Changed");
mTextedEmergencyNumber = emergencyNumber;
}
};
processAllMessages();
}
use of android.telephony.emergency.EmergencyNumber in project android_frameworks_opt_telephony by LineageOS.
the class PhoneStateListenerTest method testTriggerOutgoingCallEmergencyNumberChanged.
@Test
@SmallTest
public void testTriggerOutgoingCallEmergencyNumberChanged() throws Exception {
Field field = PhoneStateListener.class.getDeclaredField("callback");
field.setAccessible(true);
assertNull(mCalledEmergencyNumber);
EmergencyNumber emergencyNumber = new EmergencyNumber("911", "us", "30", EmergencyNumber.EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED, new ArrayList<String>(), EmergencyNumber.EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING, EmergencyNumber.EMERGENCY_CALL_ROUTING_NORMAL);
((IPhoneStateListener) field.get(mPhoneStateListenerUT)).onOutgoingEmergencyCall(emergencyNumber);
processAllMessages();
assertTrue(mCalledEmergencyNumber.equals(emergencyNumber));
}
use of android.telephony.emergency.EmergencyNumber in project android_frameworks_opt_telephony by LineageOS.
the class EmergencyNumberTracker method getEmergencyNumberListFromEccListDatabaseAndTest.
private List<EmergencyNumber> getEmergencyNumberListFromEccListDatabaseAndTest() {
List<EmergencyNumber> mergedEmergencyNumberList = getEmergencyNumberListFromEccList();
if (mPhone.getHalVersion().greaterOrEqual(new HalVersion(1, 4))) {
loge("getEmergencyNumberListFromEccListDatabaseAndTest: radio indication is" + " unavailable in 1.4 HAL.");
mergedEmergencyNumberList.addAll(mEmergencyNumberListFromDatabase);
mergedEmergencyNumberList.addAll(getEmergencyNumberListWithPrefix(mEmergencyNumberListFromDatabase));
}
mergedEmergencyNumberList.addAll(getEmergencyNumberListTestMode());
EmergencyNumber.mergeSameNumbersInEmergencyNumberList(mergedEmergencyNumberList);
return mergedEmergencyNumberList;
}
Aggregations