概述
在 frameworks/base/telephony/java/android/telephony/PhoneNumberUtils.java 中 判断紧急拨号
} else {
if (sCustomizedEccList != null) {
for (EccEntry eccEntry : sCustomizedEccList) {
+
String eccNumber="";
String ecc = eccEntry.getEcc();
numberPlus = ecc + "+";
-
if (ecc.equals(number)
-
|| numberPlus.equals(number)) {
+ //所有紧急号码为3或4为数的号码都只能有SIM卡时才能拨打,无SIM卡时不允许拨打 + if((number.length() == 3) || (number.length() == 4)){ + eccNumber=number; + } + if ((ecc.equals(number) + || numberPlus.equals(number)) && !number.equals(eccNumber)) { Rlog.d(LOG_TAG, "[isEmergencyNumberExt] match" + " customized ecc list when no sim");
return true;
diff --git a/base/telephony/java/android/telephony/PhoneNumberUtils.java b/base/telephony/java/android/telephony/PhoneNumberUtils.java
index a55a272..384cf82 100755
--- a/base/telephony/java/android/telephony/PhoneNumberUtils.java
+++ b/base/telephony/java/android/telephony/PhoneNumberUtils.java
@@ -35,6 +35,7 @@ import android.location.CountryDetector;
import android.net.Uri;
import android.os.SystemProperties;
import android.provider.Contacts;
import android.provider.ContactsContract;
import android.text.Editable;
import android.text.Spannable;
@@ -3378,11 +3379,24 @@ public class PhoneNumberUtils
if (sCustomizedEccList != null) {
for (EccEntry eccEntry : sCustomizedEccList) {
String ecc = eccEntry.getEcc();
numberPlus = ecc + "+";
-
if (ecc.equals(number)
-
|| numberPlus.equals(number)) {
+
//多个紧急号码判定有SIM卡允许拨打,无SIM卡不能拨打
+
String[] eccArr = {"101", "106", "111", "119", "125", "126", "127", "132", "144", "146", "147", "156", "165"};
+
String eccNoSim = "";
+
for(int i = 0; i < eccArr.length; i++){
+
String eccNumber = eccArr[i];
+
if(number.equals(eccNumber)){
+
eccNoSim = eccNumber;
+
}
+
}
+
if ((ecc.equals(number)
+
|| numberPlus.equals(number)) && !number.equals(eccNoSim)) {
Rlog.d(LOG_TAG, "[isEmergencyNumberExt] match"
+
+ " customized ecc list when no sim");
return true;
}
}
然后在ecc_list.xml 中配好客户需要定制的紧急号码
Condition=“0”是该号码无卡的时候是紧急号码,有卡不是紧急号码
Condition=“1”是该号码有卡无卡都是紧急号码
Condition=“2”是该号码表示界面上显示成紧急号码,但实际上以普通方式拨出
如果要有卡是紧急号码,无卡不是紧急号码
for (EccEntry eccEntry : sCustomizedEccList) {
String ecc = eccEntry.getEcc();
numberPlus = ecc + "+";
-
if (ecc.equals(number)
-
|| numberPlus.equals(number)) {
+
String eccNumber = "紧急号码";
+
if ((ecc.equals(number)
+
|| numberPlus.equals(number)) && !number.equals(eccNumber)) {
Rlog.d(LOG_TAG, "[isEmergencyNumberExt] match"
+ " customized ecc list when no sim");
return true;
}
}
}
<?xml vervison="1.0" encoding="utf-8" ?>
<EccTable>
<!--
The attribute definition for tag EccEntry:
- Ecc: the emergnecy number
- Category: the service category
- Condition: there are following values:
- 0: ecc only when no sim
- 1: ecc always
- 2: MMI will show ecc but send to nw as normal call
-->
<EccEntry Ecc="112" Category="0" Condition="0" />
<EccEntry Ecc="911" Category="0" Condition="1" />
<EccEntry Ecc="122" Category="0" Condition="1" />
<EccEntry Ecc="000" Category="0" Condition="0" />
</EccTable>
最后
以上就是坚定电源为你收集整理的Androidmtk紧急号码的全部内容,希望文章能够帮你解决Androidmtk紧急号码所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复