Android(安卓)去掉运营商STK对话框提示
16lz
2021-12-04
STK
SIM Card Tool Kit
相关代码位置:
vendor\mediatek\proprietary\packages\apps\Stk1\src\com\android\stk\StkAppService.java
case DISPLAY_TEXT: CatLog.d(LOG_TAG, "[handleCmd][DISPLAY_TEXT] +"); if (isBusyOnCall() == true) { CatLog.d(LOG_TAG, "[Handle Command][DISPLAY_TEXT][Can not handle currently]"); CatResponseMessage resMsg = new CatResponseMessage(mStkContext[slotId].mCurrentCmd); resMsg.setResultCode(ResultCode.TERMINAL_CRNTLY_UNABLE_TO_PROCESS); additionalInfo = new byte[1]; additionalInfo[0] = (byte) 0x02; resMsg.setAdditionalInfo(additionalInfo); mStkService[slotId].onCmdResponse(resMsg); return; } TextMessage msg = cmdMsg.geTextMessage(); mStkContext[slotId].responseNeeded = msg.responseNeeded; if (mStkContext[slotId].responseNeeded == false) { //Immediate response CatLog.d(LOG_TAG, "[Handle Command][DISPLAY_TEXT][Should immediatly response]"); CatResponseMessage resMsg = new CatResponseMessage(mStkContext[slotId].mCurrentCmd); resMsg.setResultCode(ResultCode.OK); mStkService[slotId].onCmdResponse(resMsg); } else { } // TODO: get the carrier name from the SIM msg.title = ""; String optr = SystemProperties.get("ro.operator.optr"); if (optr != null && "OP02".equals(optr)) { int resId = R.string.app_name; if (slotId == PhoneConstants.SIM_ID_1) { if (SystemProperties.get("ro.mtk_gemini_support").equals("1") == true) { /* GEMINI or GEMINI+ project */ resId = R.string.appI_name; } else { /* Single card project */ resId = R.string.app_name; } } else if (slotId == PhoneConstants.SIM_ID_2){ resId = R.string.appII_name; } msg.title = getResources().getString(resId); } byte[] target = {0x0d, 0x0a}; String strTarget = new String(target); String strLine = System.getProperty("line.separator"); String strText = msg.text.replaceAll(strTarget, strLine); msg.text = strText; launchTextDialog(slotId); break;
之所以显示这个对话框,是因为SIM卡上报DISPLAY TEXT命令,然后STK应用的StkAppService服务显示这个通知:
private void launchTextDialog(int slotId) { CatLog.d(LOG_TAG, "launchTextDialog, slotId: " + slotId + ", mDelayToCheckTime: " + mStkContext[slotId].mDelayToCheckTime); if (canShowTextDialog(mStkContext[slotId].mCurrentCmd.geTextMessage(), slotId) == false) { if (0 >= DELAY_TO_CHECK_IDLE_TIME || DELAY_TO_CHECK_NUM <= mStkContext[slotId].mDelayToCheckTime) { mStkContext[slotId].mDelayToCheckTime = 0; CatLog.d(LOG_TAG, "launchTextDialog responseNeeded: " + mStkContext[slotId].responseNeeded); if (mStkContext[slotId].responseNeeded) { sendOkMessage(slotId); } // reset mStkContext[].responseNeeded if (!mStkContext[slotId].responseNeeded) { mStkContext[slotId].responseNeeded = true; } handleDelayedCmd(slotId); } else { mStkContext[slotId].mDelayToCheckTime++; delayToCheckIdle(slotId); } return; } mStkContext[slotId].mDelayToCheckTime = 0; Intent newIntent = new Intent(); String targetActivity = STK_DIALOG_ACTIVITY_NAME; int action = getFlagActivityNoUserAction(InitiatedByUserAction.unknown, slotId); String uriString = STK_DIALOG_URI + System.currentTimeMillis(); //Set unique URI to create a new instance of activity for different slotId. Uri uriData = Uri.parse(uriString); if (newIntent != null) { newIntent.setClassName(PACKAGE_NAME, targetActivity); newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | getFlagActivityNoUserAction(InitiatedByUserAction.unknown, slotId)); newIntent.setData(uriData); newIntent.putExtra("TEXT", mStkContext[slotId].mCurrentCmd.geTextMessage()); newIntent.putExtra(SLOT_ID, slotId); newIntent.putExtra(STK_SOURCE_KEY, mStkAppSourceKey); startActivity(newIntent); } }
找到了显示的地方,去掉也就不是难题了。
更多相关文章
- 设置TextView超过一定长度后显示省略号
- Android(安卓)WebView相关属性
- Android(安卓)开发中的一些小技巧
- android.intent.action.MAIN与android.intent.category
- android gif view
- android屏幕旋转在framework中的修改。
- Android搜索视媒体库视频 列表显示选择
- Android入门:ImageView介绍
- android中的Bitmap用法小结