拨号时获取双卡状态及飞行模式判断(设置)
来源:互联网 发布:java中拼接字符串方法 编辑:程序博客网 时间:2024/06/06 03:05
源码在:CallController.java中,以下是截取紧急拨号获取SIM1或SIM2以及另一张卡是否正在拨打电话的判断代码。
/* below are added by mediatek .inc */ private CallStatusCode checkIfOkToInitiateOutgoingCall(int state, int slot) { log("checkIfOkToInitiateOutgoingCall, state = " + state + " slot = " + slot); if(slot == -1) return checkIfOkToInitiateOutgoingCall(state); GeminiPhone phone = (GeminiPhone) PhoneApp.getInstance().phone; if(slot == Phone.GEMINI_SIM_1) { if(phone.getStateGemini(Phone.GEMINI_SIM_2) != Phone.State.IDLE) return CallStatusCode.CALL_FAILED; } else { if(phone.getStateGemini(Phone.GEMINI_SIM_1) != Phone.State.IDLE) return CallStatusCode.CALL_FAILED; } final int realState = phone.getServiceStateGemini(slot).getState(); log("realState = " + realState); return checkIfOkToInitiateOutgoingCall(realState); } int pickBestSlotForEmergencyCall() { log("pickBestSlotForEmergencyCall"); int slot = Phone.GEMINI_SIM_1; GeminiPhone phone = (GeminiPhone) PhoneApp.getInstance().phone; boolean radioOn0 = phone.isRadioOnGemini(Phone.GEMINI_SIM_1); boolean radioOn1 = phone.isRadioOnGemini(Phone.GEMINI_SIM_2); log("radioOn0 = " + radioOn0 + " radioOn1 = " + radioOn1); if(radioOn0 && radioOn1) { // if both radio are power on // use the one in service if(phone.getStateGemini(Phone.GEMINI_SIM_2) != Phone.State.IDLE) slot = Phone.GEMINI_SIM_2; else if(phone.getStateGemini(Phone.GEMINI_SIM_1) != Phone.State.IDLE) slot = Phone.GEMINI_SIM_1; else { final int state0 = phone.getServiceStateGemini(Phone.GEMINI_SIM_1).getState(); final int state1 = phone.getServiceStateGemini(Phone.GEMINI_SIM_2).getState(); log("service state0 = " + state0 + " state1 = " + state1); if(state0 == ServiceState.STATE_OUT_OF_SERVICE && state1 == ServiceState.STATE_IN_SERVICE) slot = Phone.GEMINI_SIM_2; if(state1 == ServiceState.STATE_OUT_OF_SERVICE && state0 == ServiceState.STATE_IN_SERVICE) slot = Phone.GEMINI_SIM_1; } } else if(radioOn0) { slot = Phone.GEMINI_SIM_1; } else if(radioOn1){ slot = Phone.GEMINI_SIM_2; } return slot; }
以下为飞行模式判断及退出飞行模式:EmergencyCallHelper.java
/** * Attempt to power on the radio (i.e. take the device out * of airplane mode.) * * Additionally, start listening for service state changes; * we'll eventually get an onServiceStateChanged() callback * when the radio successfully comes up. */ private void powerOnRadio() { if (DBG) log("- powerOnRadio()..."); // We're about to turn on the radio, so arrange to be notified // when the sequence is complete. registerForServiceStateChanged(); // If airplane mode is on, we turn it off the same way that the // Settings activity turns it off. int dualSimMode = 0; boolean bOffAirplaneMode = false; if (FeatureOption.MTK_GEMINI_SUPPORT) dualSimMode = Settings.System.getInt(mApp.getContentResolver(), Settings.System.DUAL_SIM_MODE_SETTING, Settings.System.DUAL_SIM_MODE_SETTING_DEFAULT); if (DBG) Log.d(TAG, "dualSimMode = " + dualSimMode); if (Settings.System.getInt(mApp.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) > 0) { if (DBG) log("==> Turning off airplane mode..."); // Change the system setting Settings.System.putInt(mApp.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0); // Post the intent Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); intent.putExtra("state", false); mApp.sendBroadcast(intent); bOffAirplaneMode = true; } else if (!FeatureOption.MTK_GEMINI_SUPPORT) { // Otherwise, for some strange reason the radio is off // (even though the Settings database doesn't think we're // in airplane mode.) In this case just turn the radio // back on. if (DBG) log("==> (Apparently) not in airplane mode; manually powering radio on..."); mPhone.setRadioPower(true); } if (FeatureOption.MTK_GEMINI_SUPPORT && (!bOffAirplaneMode || (bOffAirplaneMode && needSetDualSimMode(dualSimMode)))) { int mode = getProperDualSimMode(); Settings.System.putInt(mApp.getContentResolver(), Settings.System.DUAL_SIM_MODE_SETTING, mode); final Intent intent = new Intent(Intent.ACTION_DUAL_SIM_MODE_CHANGED); intent.putExtra(Intent.EXTRA_DUAL_SIM_MODE, mode); mApp.sendBroadcast(intent); } }
- 拨号时获取双卡状态及飞行模式判断(设置)
- Android 飞行模式的设置(打开/关闭飞行模式,获取飞行状态状态)
- Android 飞行模式的设置(打开/关闭飞行模式,获取飞行状态状态)
- Android 判断飞行模式的状态
- Android 设置飞行模式,判断是否是飞行模式
- Android 设置飞行模式,判断是否是飞行模式
- Android 设置飞行模式
- 获取iphone的IMSI和设置飞行模式
- 工模-控制飞行模式状态
- Android判断SD卡状态及获取各种文件目录
- 判断是否可以打电话(有无SIM卡、是否飞行模式、信号是否良好)
- mission planner飞行模式设置
- Android判断是否飞行模式已经监听飞行模式
- Android判断手机是否飞行模式
- 飞行状态
- 获取(设置)键盘状态
- 代码设置飞行模式 ios iphone
- android 广播获取网络状态及判断234G
- 条件变量
- Java Map遍历速度最优解
- Redis容量及使用规划(redis,memcached,mysq对比)
- linux 将tar文件解压到指定的目录下
- 【ios6适配】旧工程适配iOS6和iPhone5的一些故事
- 拨号时获取双卡状态及飞行模式判断(设置)
- arm上的ssh,6410上移植dropbear
- 风柔月清,吾爱在浅秋
- ArcSDE初学者需要弄清楚的几个问题
- Apache配置支持目录浏览
- [iOS] ViewController的生命周期及其加载View的步骤
- 有哪些中药成分能够帮助肌肤降火?
- hibernate抓取策略fetch / batch-size
- PHP处理Oracle的CLOB