use of com.android.internal.telephony.emergency.EmergencyNumberTracker 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 com.android.internal.telephony.emergency.EmergencyNumberTracker in project android_frameworks_opt_telephony by LineageOS.
the class TelephonyMetrics method convertConnectionToRilCall.
private void convertConnectionToRilCall(GsmCdmaConnection conn, RilCall call, String countryIso) {
if (conn.isIncoming()) {
call.type = Type.MT;
} else {
call.type = Type.MO;
}
switch(conn.getState()) {
case IDLE:
call.state = CallState.CALL_IDLE;
break;
case ACTIVE:
call.state = CallState.CALL_ACTIVE;
break;
case HOLDING:
call.state = CallState.CALL_HOLDING;
break;
case DIALING:
call.state = CallState.CALL_DIALING;
break;
case ALERTING:
call.state = CallState.CALL_ALERTING;
break;
case INCOMING:
call.state = CallState.CALL_INCOMING;
break;
case WAITING:
call.state = CallState.CALL_WAITING;
break;
case DISCONNECTED:
call.state = CallState.CALL_DISCONNECTED;
break;
case DISCONNECTING:
call.state = CallState.CALL_DISCONNECTING;
break;
default:
call.state = CallState.CALL_UNKNOWN;
break;
}
call.callEndReason = conn.getDisconnectCause();
call.isMultiparty = conn.isMultiparty();
call.preciseDisconnectCause = conn.getPreciseDisconnectCause();
// Emergency call metrics when call ends
if (conn.getDisconnectCause() != DisconnectCause.NOT_DISCONNECTED && conn.isEmergencyCall() && conn.getEmergencyNumberInfo() != null) {
/**
* Only collect this emergency number information per sample percentage
*/
if (ThreadLocalRandom.current().nextDouble(0, 100) < getSamplePercentageForEmergencyCall(countryIso)) {
call.isEmergencyCall = conn.isEmergencyCall();
call.emergencyNumberInfo = convertEmergencyNumberToEmergencyNumberInfo(conn.getEmergencyNumberInfo());
EmergencyNumberTracker emergencyNumberTracker = conn.getEmergencyNumberTracker();
call.emergencyNumberDatabaseVersion = emergencyNumberTracker != null ? emergencyNumberTracker.getEmergencyNumberDbVersion() : TelephonyManager.INVALID_EMERGENCY_NUMBER_DB_VERSION;
}
}
}
Aggregations