测试了两种情况
1. 无sim卡 拨打112无通话记录 拨打110无通话记录
2. 有sim卡 拨打112无通话记录 拨打110有通话记录
在packages/services/Telecomm/src/com/android/server/telecom/CallLogmanager.java中有下面这段代码,表明了不记录紧急号码的拨号记录。
然后结合上面实际观察到的情况得到一个有意思的现象:就是在有sim卡的时候110不算紧急号码,在无sim卡的时候110算紧急号码。
重新测试有无sim卡的情况,注意观察拨号界面拨出号码时显示联系人名称的位置,确实没有sim卡的时候110才算紧急号码,有sim卡的时候不算。
但是需要说明的一点是,这只是个案,代码中也说了(This behavior is set on a per-product basis, based on carrier requirements.)
我自己的手机上(android 5.0.2)有无sim卡110都算紧急拨号,都不会记录通话记录。
本文不提供问题的解决方案,只是说明现象的原因,如果你想自己进行定制,多关注下下面的代码。
顺便PhoneNumberUtils的位置:frameworks/base/telephony/java/android/telephony/PhoneNumberUtils.java
private void logCall(
CallerInfo callerInfo,
String number,
int presentation,
int callType,
int features,
PhoneAccountHandle accountHandle,
long start,
long duration,
Long dataUsage) {
boolean isEmergencyNumber = PhoneNumberUtils.isLocalEmergencyNumber(mContext, number);
// On some devices, to avoid accidental redialing of emergency numbers, we *never* log
// emergency calls to the Call Log. (This behavior is set on a per-product basis, based
// on carrier requirements.)
final boolean okToLogEmergencyNumber =
mContext.getResources().getBoolean(R.bool.allow_emergency_numbers_in_call_log);
// Don't log emergency numbers if the device doesn't allow it.
final boolean isOkToLogThisCall = !isEmergencyNumber || okToLogEmergencyNumber;
sendAddCallBroadcast(callType, duration);
if (isOkToLogThisCall) {
Log.d(TAG, "Logging Calllog entry: " + callerInfo + ", "
+ Log.pii(number) + "," + presentation + ", " + callType
+ ", " + start + ", " + duration);
AddCallArgs args = new AddCallArgs(mContext, callerInfo, number, presentation,
callType, features, accountHandle, start, duration, dataUsage);
logCallAsync(args);
} else {
Log.d(TAG, "Not adding emergency call to call log.");
}
}
如果想要查看emergencynumber有哪些 在拨出110的时候抓取radio log,下面是我抓到的
没有sim卡的时候的radio log
I/RILQ ( 274): (0/274):RIL[0][main] qmi_ril_phone_number_is_emergency: property ril.ecclist = "911,*911,#911,112,000,08,110,999,118,119"
有sim卡的时候 radio log
I/RILQ ( 275): (0/275):RIL[0][main] qmi_ril_phone_number_is_emergency: property ril.ecclist = "911,*911,#911,112"