手機系統應用STK 問題總結
L上launcher選單中一直顯示的是 StkMain 這個activity對應的string和label。並不是StkSelection。
要想修改成只有插入的卡支援SAT應用時launcher選單中才顯示SAT應用的圖示,則:
1.先將 alps\vendor\mediatek\proprietary\packages\apps\Stk1下對應(比如:單卡對應的xml檔案在 single子目錄下) 的AndroidManifest.xml中的StkMain和StkLauncherActivity的宣告都註釋掉。
2. 然後,在該 xml 檔案中增加StkLauncherActivityI/StkLauncherActivityII/StkLauncherActivityIII/StkLauncherActivityIV
PS:桌面上的圖示位置定製:
vendor/huaqin/3rdPart/al813_l01_mena/platform/data/cust/xml/hw_launcher_default_workspace.xml
2,應用名稱圖示和名稱的定製:
ComponentInfo
public CharSequence loadLabel(PackageManager pm) { int mSlotId = PhoneNumberUtils.getSlotId(); String stkName = getSimLable(mSlotId); boolean isTwoSim = PhoneNumberUtils.hasIccCard(0) && PhoneNumberUtils.hasIccCard(1); Log.e("stk_lipeng","stkName==>"+"|"+stkName+"|"); if( !isTwoSim && packageName.equalsIgnoreCase("com.android.stk") && (stkName != null&& stkName.length()>0) ) { return stkName; } ..................................... public static String getSimLable(int SlotId){ StringBuilder suffix = new StringBuilder(); suffix.append("gsm.stkapp.name"); int mSlotId = SlotId; //int mSlotId = PhoneNumberUtils.getSlotId(); if( mSlotId == 1 ){ suffix.append("2");//gsm.stkapp.name2 } String stk = SystemProperties.get(suffix.toString()); String pMccMnc = PhoneNumberUtils.getSimMccMnc(mSlotId); Log.d("stk_lipeng","pMccMnc==>"+"|"+pMccMnc+"|"); String pImsi = PhoneNumberUtils.getDefaultImsi(mSlotId); String language = Locale.getDefault().getLanguage(); if(SystemProperties.get("ro.hq.stk.name").equals("1")){ //add by lipeng for stk if("52501".equals(pMccMnc)||"52502".equals(pMccMnc)||"52507".equals(pMccMnc)){ stk = "Singtel Menu"; } else if("73406".equals(pMccMnc)){ stk = "tu chip"; } else if("37001".equals(pMccMnc)){ if("es".equals(language) ){ stk = "Servicios Orange"; }else{ stk = "Orange Services"; } } else if("33403".equals(pMccMnc)||"334030".equals(pMccMnc)||"70403".equals(pMccMnc) ||"704030".equals(pMccMnc)||"70604".equals(pMccMnc)||"706040".equals(pMccMnc) ||"71030".equals(pMccMnc)||"710300".equals(pMccMnc)||"714020".equals(pMccMnc) ||"71402".equals(pMccMnc)||"73002".equals(pMccMnc)||"72207".equals(pMccMnc) ||"732123".equals(pMccMnc)||"74000".equals(pMccMnc)||"74807".equals(pMccMnc) ||"71606".equals(pMccMnc)||"73404".equals(pMccMnc)||"21407".equals(pMccMnc) ||"21402".equals(pMccMnc)||"71204".equals(pMccMnc)){ stk = "Movistar"; } else if("70402".equals(pMccMnc)||"70603".equals(pMccMnc)||"70802".equals(pMccMnc) ||"70802".equals(pMccMnc)||"708020".equals(pMccMnc)){ stk = "Menu Tigo"; } else if("732111".equals(pMccMnc)||"73603".equals(pMccMnc)||"74404".equals(pMccMnc)){ stk = "Mundo Tigo"; } if("732103".equals(pMccMnc)){ stk = "Mundo Tigo"; } if(pImsi!=null && pImsi.startsWith("7321030027")||pImsi.startsWith("7321030028")||pImsi.startsWith("7321030029")){ stk = "UNE"; Log.d("stk_lipeng","pMccMnc==7321030027>"+"|"+pMccMnc+"|"); }else if(pImsi!=null && pImsi.startsWith("732103018")||pImsi.startsWith("732103019")||pImsi.startsWith("732103023713")||pImsi.startsWith("732103023714")||pImsi.startsWith("732103023715")||pImsi.startsWith("732103023716")||pImsi.startsWith("732103023717")||pImsi.startsWith("732103023718")||pImsi.startsWith("732103023719")||pImsi.startsWith("73210302372")||pImsi.startsWith("73210302373")||pImsi.startsWith("73210302374")||pImsi.startsWith("73210302375")||pImsi.startsWith("732103023760")||pImsi.startsWith("732103023761")){ stk = "Uff"; }else if(pImsi!=null && pImsi.startsWith("732103017")){ stk = "ETB"; }else if(pImsi!=null && pImsi.startsWith("732103024")){ stk = "UNE"; }else if(pImsi!=null && pImsi.startsWith("732103054")||pImsi.startsWith("732103055")){ stk = "Uff"; } if("70401".equals(pMccMnc)||"708001".equals(pMccMnc)||"70601".equals(pMccMnc) ||"71021".equals(pMccMnc)||"71073".equals(pMccMnc)||"71203".equals(pMccMnc) ||"71403".equals(pMccMnc)||"37002".equals(pMccMnc)||"74001".equals(pMccMnc) ||"740010".equals(pMccMnc)||"330110".equals(pMccMnc)){ stk = "Claro"; } else if("73401".equals(pMccMnc)||"73402".equals(pMccMnc)||"73403".equals(pMccMnc)){ stk = "SIM 412"; } else if("334020".equals(pMccMnc)){ stk = "TELCEL"; } else if("72234".equals(pMccMnc)||"722341".equals(pMccMnc)){ stk = "Mi Personal"; } else if("72405".equals(pMccMnc)){ stk = "Menu Claro"; } else if("74801".equals(pMccMnc)){ stk = "ZONA MOVIL"; } else if("73005".equals(pMccMnc)||"73008".equals(pMccMnc)){ stk = "VTR"; } else if("73003".equals(pMccMnc)){ stk = "ClaroChip"; } //334/050,222/01,222/010,222/011,222/012,222/013,222/014 //Read from SIM first,if no content, STK name should be "Mi SIM" if(stk == null && "334050".equals(pMccMnc)||"22201".equals(pMccMnc) ||"222010".equals(pMccMnc)||"222011".equals(pMccMnc)||"222012".equals(pMccMnc) ||"222013".equals(pMccMnc)||"222014".equals(pMccMnc)){ stk = "Mi SIM"; } //Read Name From SIM firstly,if nothing,show Claro. 716/10:Claro if(stk == null && "71610".equals(pMccMnc)){ stk = "Claro"; } } /* end by lipeng for stk name*/ /* add by caohaolin for claro stk name*/ if(SystemProperties.get("ro.hq.stk.name.claro").equals("1")) { if(!"71610".equals(pMccMnc)){ stk = "SIM Claro"; } } return stk; }
[FAQ05657][SAT]如何動態修改SIM卡應用名稱
L0 以及 L1 版本:
由於StkAppService啟動的packageName和activity都只有一個,所以無法區分,因此,無法用這種方法做客製化。
例如:針對聯通定製版,要實現STK應用名稱從卡里讀取並顯示(JB2以及JB2以後的版本)。
由於SAT 應用是動態安裝的。launcher 選單中的 SAT應用圖示是 Stk1.apk的圖示。
1、從systemproperty中獲取卡的運營商名稱。
可以參考方法2中的2.1 的demo code,修改 ApplicationPackageManager.java 檔案的 getText() 方法,從SystemProperties中獲取對應的卡的運營商名稱:
String tmptext=SystemProperties.get(TelephonyProperties.PROPERTY_OPERATOR_ALPHA);
String tmptext=SystemProperties.get(TelephonyProperties.PROPERTY_OPERATOR_ALPHA_2);
2、兩個SAT應用程式是共用一個packageName的,所以無法通過包名來區分,必須通過類名來區分。
例如插入卡槽2的sim或usim應用程式是通過啟動"stkLauncherActivityII"
將applyFromApplicationInfo()方法中的setText,通過TargetclassName來過濾,設定期望顯示的名字 為從步驟 1 獲取到的名字。
例如:TargetclassName = “stkLauncherActivityII”, 期望顯示的名字"我的名字"
if (TargetclassName 等於info.componentName.mClass)
{
setText("我的名字")
}
else
{
setText(info.title);
}
ComponentName.java (frameworks\base\core\java\android\content): public String getClassName() {
3,stk應用點選進去之後title名稱的定製:
stk1 下的 StkMenuActivity
private void displayMenu(ImageView iconView, TextView textView, ListActivity list) {
int simCount = TelephonyManager.from(mContext).getSimCount();
//add by lipeng
String pMccMnc = PhoneNumberUtils.getSimMccMnc(0);
String pMccMnc2 = PhoneNumberUtils.getSimMccMnc(1);
String stkName = SystemProperties.get("gsm.stkapp.name");
Log.d("lipeng_stk", "stk1="+stkName);
String stkName2 = SystemProperties.get("gsm.stkapp.name2");
Log.d("lipeng_stk", "stk2="+stkName2);
//end by lipeng
if (mStkMenu != null) {
// Display title & title icon
if (mStkMenu.titleIcon != null) {
iconView.setImageBitmap(mStkMenu.titleIcon);
iconView.setVisibility(View.VISIBLE);
} else {
iconView.setVisibility(View.GONE);
}
if (!mStkMenu.titleIconSelfExplanatory) {
textView.setVisibility(View.VISIBLE);
if (mStkMenu.title == null) {
int resId = R.string.app_name;
if (1 < simCount) {
if (mSlotId == PhoneConstants.SIM_ID_1) {
resId = R.string.appI_name;
} else if (mSlotId == PhoneConstants.SIM_ID_2) {
resId = R.string.appII_name;
} else if (mSlotId == PhoneConstants.SIM_ID_3) {
resId = R.string.appIII_name;
} else {
resId = R.string.appIV_name;
}
} else {
resId = R.string.app_name;
}
textView.setText(resId);
//add by lipeng for stk
if (mSlotId == PhoneConstants.SIM_ID_1){
if (SystemProperties.get("ro.hq.stk.name.claro").equals("1") && stkName != null && stkName != "" && stkName.length() > 0) {
textView.setText(stkName);
Log.d("lipeng_stkin", "stk1="+stkName);
}
if("52501".equals(pMccMnc)||"52502".equals(pMccMnc)||"52507".equals(pMccMnc)){
textView.setText("Singtel Menu");
}
}else if (mSlotId == PhoneConstants.SIM_ID_2){
if (SystemProperties.get("ro.hq.stk.name.claro").equals("1") && stkName2 != null && stkName2 != "" && stkName2.length() > 0) {
textView.setText(stkName2);
Log.d("lipeng_stkin", "stk2="+stkName2);
}
if("52501".equals(pMccMnc2)||"52502".equals(pMccMnc2)||"52507".equals(pMccMnc2)){
textView.setText("Singtel Menu");
}
}//end by lipeng
} else {
textView.setText(mStkMenu.title);
//add by lipeng for stk
if (mSlotId == PhoneConstants.SIM_ID_1){
if (SystemProperties.get("ro.hq.stk.name.claro").equals("1") && stkName != null && stkName != "" && stkName.length() > 0) {
textView.setText(stkName);
Log.d("lipeng_stkin", "stk11="+stkName);
}
if("52501".equals(pMccMnc)||"52502".equals(pMccMnc)||"52507".equals(pMccMnc)){
textView.setText("Singtel Menu");
}
}else if (mSlotId == PhoneConstants.SIM_ID_2){
if (SystemProperties.get("ro.hq.stk.name.claro").equals("1") && stkName2 != null && stkName2 != "" && stkName2.length() > 0) {
textView.setText(stkName2);
Log.d("lipeng_stkin", "stk22="+stkName2);
}
if("52501".equals(pMccMnc2)||"52502".equals(pMccMnc2)||"52507".equals(pMccMnc2)){
textView.setText("Singtel Menu");
}
}//end by lipeng
}
} else {
textView.setVisibility(View.INVISIBLE);
}