AT指令,暂未发现发送AT请求的frameworks接口,通过打印信息总结AT指令:

AT+EIMSVOICE: Enable/Disable IMS Voice Capability
+EIMSVOICE=<config>
<config>: integer 
0 disable IMS Voice capability
1 enable IMS Voice capability
note:This command should set from AP side while boot-up;
At runtime, AP side could set the command anytime, and IMS module will apply the setting for next round of IMS registration;

而后有如下打印信息,发送RIL_REQUEST_SET_IMS_ENABLE请求:

此发送接口在ImsService.java 类中的onRequestImsSwitch():

        public void onRequestImsSwitch(int simIdx, boolean isImsOn) {

            int phoneId = getMainCapabilityPhoneId();

            if (DBG) {
Rlog.d(LOG_TAG,"onRequestImsSwitch simIdx=" + simIdx +
" isImsOn=" + isImsOn + " mainCapability id=" + phoneId);
} if (mActivePhoneId != phoneId) {
mActivePhoneId = phoneId;
} if (isImsOn) {
if (mImsState != PhoneConstants.IMS_STATE_ENABLE) { //如果是关闭状态
mImsRILAdapter.turnOnIms(mHandler.obtainMessage(EVENT_SET_IMS_ENABLED_DONE));
mImsState = PhoneConstants.IMS_STATE_ENABLING;
} else {
Rlog.d(LOG_TAG, "Ims already enable and ignore to send AT command.");
}
}

ImsRILAdapter类封装消息请求,通过send()发送RIL接收端;

ImsIntentReceiver广播接收器,根据log打印信息:

在PhoneBase类中定义了mImsIntentReceiver广播接收器:

    private BroadcastReceiver mImsIntentReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Rlog.d(LOG_TAG, "mImsIntentReceiver: action " + intent.getAction());
if (intent.hasExtra(ImsManager.EXTRA_PHONE_ID)) {
int extraPhoneId = intent.getIntExtra(ImsManager.EXTRA_PHONE_ID,
SubscriptionManager.INVALID_PHONE_INDEX);
Rlog.d(LOG_TAG, "mImsIntentReceiver: extraPhoneId = " + extraPhoneId);
if (extraPhoneId == SubscriptionManager.INVALID_PHONE_INDEX ||
extraPhoneId != getPhoneId()) {
return;
}
} synchronized (PhoneProxy.lockForRadioTechnologyChange) {
//接收广播ACTION_IMS_SERVICE_UP
if (intent.getAction().equals(ImsManager.ACTION_IMS_SERVICE_UP)) {
......
mImsServiceReady = true;
updateImsPhone();
ImsManager.updateImsServiceConfig(mContext, mPhoneId, false);
//接收广播ACTION_IMS_SERVICE_DOWN
} else if (intent.getAction().equals(ImsManager.ACTION_IMS_SERVICE_DOWN)) {
mImsServiceReady = false;
updateImsPhone();
}
}
}
};

updateImsPhone()方法如下:

    protected void updateImsPhone() {
Rlog.d(LOG_TAG, "updateImsPhone"
+ " mImsServiceReady=" + mImsServiceReady); if (mImsServiceReady && (mImsPhone == null)) {
                     //创建mImsPhone notifyDataRegStateRilRadioTechnologyChanged
mImsPhone = PhoneFactory.makeImsPhone(mNotifier, this);
CallManager.getInstance().registerPhone(mImsPhone); //CallManager里添加Phone对象
mImsPhone.registerForSilentRedial(
this, EVENT_INITIATE_SILENT_REDIAL, null); //注册消息,该消息的处理由该类处理
} else if (!mImsServiceReady && (mImsPhone != null)) {
CallManager.getInstance().unregisterPhone(mImsPhone);
mImsPhone.unregisterForSilentRedial(this); mImsPhone.dispose();
// Potential GC issue if someone keeps a reference to ImsPhone.
// However: this change will make sure that such a reference does
// not access functions through NULL pointer.
//mImsPhone.removeReferences();
mImsPhone = null;
} EVENT_INITIATE_SILENT_REDIAL 消息的处理:
case EVENT_INITIATE_SILENT_REDIAL:
Rlog.d(LOG_TAG, "Event EVENT_INITIATE_SILENT_REDIAL Received");
ar = (AsyncResult) msg.obj;
if ((ar.exception == null) && (ar.result != null)) {
String dialString = (String) ar.result;
if (TextUtils.isEmpty(dialString)) return;
try {
dialInternal(dialString, null, VideoProfile.STATE_AUDIO_ONLY, null);
} catch (CallStateException e) {
Rlog.e(LOG_TAG, "silent redial failed: " + e);
}
}
break;

ServiceState服务状态,有如下打印信息:

vendor/mediatek/proprietary/frameworks/opt/tedongle/src/java/android/tedongle/ServiceState.java

    private void setNullState(int state) {
if (DBG) Rlog.d(LOG_TAG, "[ServiceState] setNullState=" + state);
mVoiceRegState = state;
mDataRegState = state;
mVoiceRoamingType = ROAMING_TYPE_NOT_ROAMING;
mDataRoamingType = ROAMING_TYPE_NOT_ROAMING;
.......
}

setNullState()该方法传入的参数是3,可判定被该方法调用:

    public void setStateOff() {
setNullState(STATE_POWER_OFF);
}

ServiceState 的定义:

/**
* Normal operation condition, the phone is registered
* with an operator either in home network or in roaming.
*/
public static final int STATE_IN_SERVICE = 0;

/**
* Phone is not registered with any operator, the phone
* can be currently searching a new operator to register to, or not
* searching to registration at all, or registration is denied, or radio
* signal is not available.
*/
public static final int STATE_OUT_OF_SERVICE = 1;

/**
* The phone is registered and locked. Only emergency numbers are allowed. {@more}
*/
public static final int STATE_EMERGENCY_ONLY = 2;

/**
* Radio of telephony is explicitly powered off.
*/
public static final int STATE_POWER_OFF = 3;

注册消息:

    private void registerIndicationReceiver() {
if (DBG) log("registerIndicationReceiver");
IntentFilter intentfilter = new IntentFilter();
intentfilter.addAction(ImsManager.ACTION_IMS_INCOMING_CALL_INDICATION);//注册来电通知
mPhone.getContext().registerReceiver(mIndicationReceiver, intentfilter); }

notifyDataRegStateRilRadioTechnologyChanged:

在GsmServiceStateTracker类的pollStateDone()方法中,调用notifyDataRegStateRilRadioTechnologyChanged():

        if (hasDataRegStateChanged || hasRilDataRadioTechnologyChanged) {
notifyDataRegStateRilRadioTechnologyChanged();
                      //WLAN 判断
if (ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN
== mSS.getRilDataRadioTechnology()) {
mPhone.notifyDataConnection(Phone.REASON_IWLAN_AVAILABLE);
} else {
mPhone.notifyDataConnection(null);
}
} protected void notifyDataRegStateRilRadioTechnologyChanged() {
int rat = mSS.getRilDataRadioTechnology();
int drs = mSS.getDataRegState();
if (DBG) log("notifyDataRegStateRilRadioTechnologyChanged: drs=" + drs + " rat=" + rat);
  //设置TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE属性
mPhoneBase.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE,
ServiceState.rilRadioTechnologyToString(rat));
mDataRegStateOrRatChangedRegistrants.notifyResult(new Pair<Integer, Integer>(drs, rat));
}

mDataRegStateOrRatChangedRegistrants通知者注册函数:

    public void registerForDataRegStateOrRatChanged(Handler h, int what, Object obj) {
Registrant r = new Registrant(h, what, obj);
mDataRegStateOrRatChangedRegistrants.add(r); //添加监听者
notifyDataRegStateRilRadioTechnologyChanged();
}

该注册函数在ImsPhone的构造函数中被调用:

    ImsPhone(Context context, PhoneNotifier notifier, Phone defaultPhone) {

        mDefaultPhone = (PhoneBase) defaultPhone;
/// M: ALPS02759855. ImsPhoneCallTracker may change service state earlier. @{
// mCT = new ImsPhoneCallTracker(this);
// mSS.setStateOff();
mSS.setStateOff(); //此处即在"ServiceState服务状态"中提到的
mCT = new ImsPhoneCallTracker(this);
/// @} mPhoneId = mDefaultPhone.getPhoneId(); // This is needed to handle phone process crashes
// Same property is used for both CDMA & IMS phone.
mIsPhoneInEcmState = SystemProperties.getBoolean(
TelephonyProperties.PROPERTY_INECM_MODE, false); PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, LOG_TAG);
mWakeLock.setReferenceCounted(false); if (mDefaultPhone.getServiceStateTracker() != null) {
mDefaultPhone.getServiceStateTracker()
.registerForDataRegStateOrRatChanged(this,
EVENT_DEFAULT_PHONE_DATA_STATE_CHANGED, null); //注册数据状态变化通知消息
}
updateDataServiceState();
}

EVENT_DATA_CONNECTION_DRS_OR_RAT_CHANGED消息的处理

在DataConnection.java中处理:

                case EVENT_DATA_CONNECTION_DRS_OR_RAT_CHANGED:
ar = (AsyncResult) msg.obj;
Pair<Integer, Integer> drsRatPair = (Pair<Integer, Integer>) ar.result;
mDataRegState = drsRatPair.first;
if (mRilRat != drsRatPair.second) {
updateTcpBufferSizes(drsRatPair.second);
}
mRilRat = drsRatPair.second;
if (DBG) {
log("DcDefaultState: EVENT_DATA_CONNECTION_DRS_OR_RAT_CHANGED"
+ " drs=" + mDataRegState
+ " mRilRat=" + mRilRat);
} ServiceState ss = mPhone.getServiceState(); //实例化ServiceState
// M: [C2K][IRAT] Get network type from IRAT controller
// TODO: check if the message is handled before
// IratController update its current RAT.
if (CdmaFeatureOptionUtils.isCdmaLteDcSupport()) {
//can get networkType from svltePhoneProxy to get right network type
ServiceState svlteSs = SvlteUtils.getSvltePhoneProxy(mPhone.getPhoneId())
.getSvlteServiceState();
if (svlteSs != null) {
ss = svlteSs;
}
}
int networkType = ss.getDataNetworkType(); mNetworkInfo.setSubtype(networkType,
TelephonyManager.getNetworkTypeName(networkType));
if (mNetworkAgent != null) {
updateNetworkInfoSuspendState();
mNetworkAgent.sendNetworkCapabilities(makeNetworkCapabilities());
mNetworkAgent.sendNetworkInfo(mNetworkInfo);
mNetworkAgent.sendLinkProperties(mLinkProperties);
}
break;

设置网络参数

    public void setDataRegState(int state) {
mDataRegState = state;
if (DBG) Rlog.d(LOG_TAG, "[ServiceState] setDataRegState=" + mDataRegState);
} public void setRilDataRadioTechnology(int rt) {
this.mRilDataRadioTechnology = rt;
if (DBG) Rlog.d(LOG_TAG, "[ServiceState] setDataRadioTechnology=" + mRilDataRadioTechnology);
}

开关VoLTE流程分析(二)的更多相关文章

  1. Android8.1 开关VOLTE流程分析

    前言 最近有需求需要实现插卡默认打开Volte功能,顺带研究了下Volte的流程,在此做个记录 开始 从Settings设置界面入手,网络和互联网-->移动网络-->VoLTE高清通话(电 ...

  2. 开关VoLTE流程分析(一)

    开关按钮位置: 设置--> 更多--> 移动网络--> 增强型4G LTE模式 控件初始化addEnhanced4GLteSwitchPreference,该设置开关使用了Switc ...

  3. Android 7.1 WindowManagerService 屏幕旋转流程分析 (二)

    一.概述 从上篇[Android 7.1 屏幕旋转流程分析]知道实际的旋转由WindowManagerService来完成,这里接着上面具体详细展开. 调了三个函数完成了三件事,即首先调用update ...

  4. Gradle之Android Gradle Plugin 主要流程分析(二)

    [Android 修炼手册]Gradle 篇 -- Android Gradle Plugin 主要流程分析 预备知识 理解 gradle 的基本开发 了解 gradle task 和 plugin ...

  5. Android 4.4 音量调节流程分析(二)

    之前在Android 4.4 音量调节流程分析(一)里已经有简单的分析音量控制的流程,今天想接着继续分析下音量大小计算的方法.对于任一播放文件而言其本身都有着固定大小的音量Volume_Max,而在A ...

  6. MSM8909中LK阶段LCM屏适配与显示流程分析(二)

    1.前言 在前面的文章MSM8909中LK阶段LCM屏适配与显示流程分析(一),链接如下: https://www.cnblogs.com/Cqlismy/p/12019317.html 介绍了如何使 ...

  7. Uboot启动流程分析(二)

    1.前言 在前面的文章Uboot启动流程分析(一)中,链接如下: https://www.cnblogs.com/Cqlismy/p/12000889.html 已经简单地分析了low_level_i ...

  8. Nginx-HTTP之静态网页访问流程分析二

    11. HTTP 阶段执行 下面会依次执行以下阶段: NGX_HTTP_SERVER_REWRITE_PHASE: 在将请求的 URI 与 location 表达式匹配前,修改请求的 URI (所谓重 ...

  9. Uboot启动流程分析(三)

    1.前言 在前面的文章Uboot启动流程分析(二)中,链接如下: https://www.cnblogs.com/Cqlismy/p/12002764.html 已经对_main函数的整个大体调用流程 ...

随机推荐

  1. 201871010106-丁宣元 《面向对象程序设计(java)》第十六周学习总结

    201871010106-丁宣元 <面向对象程序设计(java)>第十六周学习总结 正文开头: 项目 内容 这个作业属于哪个课程 https://home.cnblogs.com/u/nw ...

  2. android SDK安装Failed to fetch URL http://dl-ssl.google.com/android/repository/addons_list-1.xml出错 解决方案

    更换代理服务器:http://mirrors.neusoft.edu.cn 端口:80 reload 解决 若以上不成功在hosts文件中添加以下内容 #Google主页203.208.46.146 ...

  3. centos虚拟机 与主机同步时间

    同步系统时间: yum install ntp ntpdate cn.pool.ntp.org ntpdate 0.centos.pool.ntp.org rm /etc/localtime ln - ...

  4. 安装禅道提示:ERROR: 您访问的域名 192.168.110.128 没有对应的公司

    您访问的域名 192.168.110.128 没有对应的公司. in /usr/local/nginx/html/zentaopms/module/common/model.php on line 8 ...

  5. Ubuntu16.04安装deb包

    在Ubuntu下安装deb包需要使用dpkg命令.Dpkg 的普通用法: 1.sudo dpkg -i <package.deb> 安装一个 Debian 软件包,如你手动下载的文件. 2 ...

  6. Computer Network Chapter3 solution

    1.校验和:各数值相加,将溢出位加到最低位,之后将结果取反.若校验和全为0,则说明接收数据正确. 2.停等协议及计算信道利用率:利用率=(L/C)/(L/C+2*传输时延) 3.回退N帧协议(协议5) ...

  7. 基于github发布 个人网站/博客

    我们可以使用GitHub去发布自己的网站了(静态网站), 只要经过简单几步即可.这样小伙伴可以给朋友或面试官展示自己个人项目啦. 第一步:创建一个新仓库 第二步:在仓库选择“Settings”页,找到 ...

  8. CSP前的板子

    板子A(扩展欧几里得) 题目描述 求关于x的同余方程 ax≡1(modb) 的最小正整数解. 输入格式 一行,包含两个正整数 a,b,用一个空格隔开. 输出格式 一个正整数 x​,即最小正整数解.输入 ...

  9. CF1188C Array Beauty(DP)

    日常降智. 不过还是第一次和 2700 的题正解这么近呢-- 由于排序后不影响答案,而且直觉告诉我们排序后会更好做,不妨排个序. 直觉告诉我们,变成求最小差 \(\ge v\) 的方案数会比最小差 \ ...

  10. JAVA SE11环境变量配置(Windows)

    附上:03. 安装环境:Windows · IntelliJ IDEA Tutorial 附上:使用调试功能进行 Java debug 附上:Linux(Deepin)下配置java8 - L1412 ...