客制化语言与时区问题
正常改默认语言路径:
L之前:
修改默认语言
operator_SFR_MEO/mediatek/config/up40_h405f_meo/ProjectConfig.mk
MTK_PRODUCT_LOCALES=en_US pt_PT fr_FR es_ES iw_IL
修改默认时区:
/media/Disk2/projects/kk/operator_SFR_MEO/mediatek/config/up40_h405f_meo/system.prop
persist.sys.timezone=Europe/London
L及以后:
72l/ALPS.L1.MP6.V1_SR6572_WET_L/sagereal/mk/UP19_H3504_LP/full_sr6572_wet_l.mk
set locales & aapt config.
PRODUCT_LOCALES :=fr_FR en_US ar_EG
修改默认时区:
72l/ALPS.L1.MP6.V1_SR6572_WET_L/sagereal/mk/UP19_H3504_LP/ProjectConfig.mk
config_timezone = Europe/Brussels
因为集成在clone_integration.sh脚本中定义:
if [ $config_timezone ]; then
config_timezone_change=echo $config_timezone | sed 's/\//\\\\\//g'
sed -i "/persist.sys.timezone/s/=.*/=
base_project/system.prop
echo "config_timezone=
base_project/system.prop
fi
客户的需求是当插入MEO卡的时候显示葡萄牙语,当插入odo卡的时候显示西班牙语,插入其他卡或者不插卡的时候显示英语.
/media/Disk2/projects/kk/operator_SFR_MEO/frameworks/opt/telephony/src/java/com/android/internal/telephony/MccTable.java
static class MccEntry implements Comparable
{
int mMcc;
String mIso;
int mSmallestDigitsMnc;
String mLanguage;
MccEntry(int mnc, String iso, int smallestDigitsMCC) {
this(mnc, iso, smallestDigitsMCC, null);
}
MccEntry(int mnc, String iso, int smallestDigitsMCC, String language) {
mMcc = mnc;
mIso = iso;
mSmallestDigitsMnc = smallestDigitsMCC;
mLanguage = language;
}
我直接在这个类里面修改了
static {
sTable = new ArrayList(240);
/*
* The table below is built from two resources:
*
* 1) ITU "Mobile Network Code (MNC) for the international
* identification plan for mobile terminals and mobile users"
* which is available as an annex to the ITU operational bulletin
* available here: http://www.itu.int/itu-t/bulletin/annex.html
*
* 2) The ISO 3166 country codes list, available here:
* http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/index.html
*
* This table has not been verified.
*
*/
sTable.add(new MccEntry(202,"gr",2)); //Greece
sTable.add(new MccEntry(204,"nl",2,"nl")); //Netherlands (Kingdom of the)
sTable.add(new MccEntry(206,"be",2)); //Belgium
//gaoyaning
sTable.add(new MccEntry(208,"fr",2,"en")); //France
修改之前
sTable.add(new MccEntry(370,"do",2)); //Dominican Republic
错误修改
//gaoyaning
sTable.add(new MccEntry(370,"es",2,"es")); //Dominican Republic
正确修改:
sTable.add(new MccEntry(370,"do",2,"es")); //Dominican Republic
修改的时候没有注意第二个参数代表的意思,直接将第二个参数改为es,以为第二个参数也是表示语言,所以直接修改,修改完之后验证语言ok,所以就直接提交了.
由于没有国外的网络,所以无法验证时区是否ok,软件发给客户之后,客户反馈时区显示有问题.从log中看出来时区变为GMT+2,最后发现是修改了iso这个参数导致时区发生变化.
普及一下:ISO 国际标准化组织(International Organization for Standardization,ISO)简称ISO,是一个全球性的非政府组织,是国际标准化领域中一个十分重要的组织。。ISO一来源于希腊语“ISOS”,即“EQUAL”——平等之意。ISO国际标准组织成立于1946年,中国是ISO的正式成员,代表中国参加ISO的国家机构是中国国家技术监督局(CSBTS)
其宗旨是:在世界范围内促进标准化工作的发展,以利于国际物资交流和互助,并扩大知识、科学、技术和经济方面的合作。其主要任务是:制定国际标准,协调世界范围内的标准化工作,与其他国际性组织合作研究有关标准化问题。
frameworks/opt/telephony/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
private String[][] mTimeZoneIdOfCapitalCity = {{"au", "Australia/Sydney"},
{"br", "America/Sao_Paulo"},
{"ca", "America/Toronto"},
{"cl", "America/Santiago"},
{"es", "Europe/Madrid"},
{"fm", "Pacific/Ponape"},
{"gl", "America/Godthab"},
{"id", "Asia/Jakarta"},
{"kz", "Asia/Almaty"},
{"mn", "Asia/Ulaanbaatar"},
{"mx", "America/Mexico_City"},
{"pf", "Pacific/Tahiti"},
{"pt", "Europe/Lisbon"},
{"ru", "Europe/Moscow"},
{"us", "America/New_York"}
};
private TimeZone getTimeZonesWithCapitalCity(String iso) {
TimeZone tz = null;
//[ALPS01666276]-Start: don't udpate with capital city when we has received nitz before
if ((mZoneOffset == 0) && (mZoneDst == false)) {
for (int i = 0; i < mTimeZoneIdOfCapitalCity.length; i++) {
if (iso.equals(mTimeZoneIdOfCapitalCity[i][0])) {
tz = TimeZone.getTimeZone(mTimeZoneIdOfCapitalCity[i][1]);
log("uses TimeZone of Capital City:" + mTimeZoneIdOfCapitalCity[i][1]);
break;
}
}
} else {
log("don't udpate with capital city, cause we have received nitz");
}
//[ALPS01666276]-End
return tz;
}
由于第二个参数改成了es,所以时区匹配到了Europe/Madrid
<!-- SPAIN, 1:00 -->
<timezone code="es">Europe/Madrid</timezone>
frameworks/base/core/res/res/xml/time_zones_by_country.xml
然而客户需要的时区是GMT-4即对应的时区应该是:
America/Santo_Domingo
如何避免:
修改时不要我以为,应该仔细分析一下代码,弄懂必要的参数代表什么.
修改到跟国外网络有关的问题时,可以用国内的卡验证一下,比如联通,移动.
以后iso还是不要乱动,容易出错.当然最重要的是多分析一下.