Search in sources :

Example 11 with EmergencyNumber

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));
}
Also used : EmergencyNumber(android.telephony.emergency.EmergencyNumber)

Example 12 with EmergencyNumber

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));
}
Also used : EmergencyNumber(android.telephony.emergency.EmergencyNumber) ArrayList(java.util.ArrayList) AsyncResult(android.os.AsyncResult)

Example 13 with EmergencyNumber

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();
}
Also used : EmergencyNumber(android.telephony.emergency.EmergencyNumber) ServiceState(android.telephony.ServiceState) PhoneStateListener(android.telephony.PhoneStateListener) Before(org.junit.Before)

Example 14 with EmergencyNumber

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));
}
Also used : Field(java.lang.reflect.Field) EmergencyNumber(android.telephony.emergency.EmergencyNumber) SmallTest(android.test.suitebuilder.annotation.SmallTest) Test(org.junit.Test) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 15 with 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;
}
Also used : EmergencyNumber(android.telephony.emergency.EmergencyNumber) HalVersion(com.android.internal.telephony.HalVersion)

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