Search in sources :

Example 1 with EmergencyNumber

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

Example 2 with EmergencyNumber

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

Example 3 with EmergencyNumber

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

Example 4 with EmergencyNumber

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);
}
Also used : EmergencyNumber(android.telephony.emergency.EmergencyNumber) HalVersion(com.android.internal.telephony.HalVersion) TelephonyTest(com.android.internal.telephony.TelephonyTest) Test(org.junit.Test)

Example 5 with EmergencyNumber

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

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