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 (SystemPropert
ies.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());
最后
小编这些年深知大多数初中级Android工程师,想要提升自己,往往是自己摸索成长,自己不成体系的自学效果低效漫长且无助。
因此我收集整理了一份《2024年Android移动开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友。
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、电子书籍、讲解视频,并且后续会持续更新
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人
都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
如果你需要这些资料, ⬅ 专栏获取
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、电子书籍、讲解视频,并且后续会持续更新
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人
都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
如果你需要这些资料, ⬅ 专栏获取