6572

编程入门 行业动态 更新时间:2024-10-25 02:22:28

6572

6572

6572_message_MWI 

 

1. 
前言

1.1 目的

    本文介绍了一个mwi的接收过程,主要关注的是消息从modem上报到APP的主要处理流程。实际在总结的时候,先讲RIL层是如何处理mwi的消息的,并如何处理并传递给framework的,再一步步分析,framework里事件是如何传送到app的,APP是怎么收到事件并显示的。

 

文档注重事件流程,描述了事件是在软件分层的框架里的流向,并重点分析一些重点类的实例是如何创建并能为相应模块使用的。

 

希望本文能够对入手本模块的同事有帮助作用,并起到一个抛砖引玉的作用。

 

 

2. 增加MWI接收的流程分析

2.1 对RIL数据解析的修改

在\frameworks\opt\telephony\src\java\com\android\internal\telephony\gsm\SmsMessage.java类里面,在方法parseUserData里对数据进行解析时,根据3GPP TS 23.038 V7.0.0等相关协议,根据dataCodingScheme对消息类型进行判断,下面蓝色的地方是存在问题而修改的代码,原代码不能正确识别到mwi,导致Mwi消息从这里开始便不能被正确传递到app。

 

 else if ((dataCodingScheme & 0xF0) == 0xC0

                || (dataCodingScheme & 0xF0) == 0xD0

                || (dataCodingScheme & 0xF0) == 0xE0) {

                       。。。

 

            userDataCompressed = false;

            boolean active = ((dataCodingScheme & 0x08) == 0x08);

 

            // bit 0x04 reserved

 

            

/*

if ((dataCodingScheme & 0x03) == 0x00) {

                isMwi = true;

                mwiSense = active;

                mwiDontStore = ((dataCodingScheme & 0xF0) == 0xC0);

            } else {

                isMwi = false;

 

                Log.w(LOG_TAG, "MWI for fax, email, or other "

                        + (dataCodingScheme & 0xff));

            }

*/

isMwi = true;

            mwiSense = active;

            mwiDontStore = ((dataCodingScheme & 0xF0) == 0xC0);

            

            if ((dataCodingScheme & 0x07) == 0x07) {

                mwiType = 0x07;

                Log.d(LOG_TAG, "[cc vedio type]");

            } else {

                mwiType = (int) (dataCodingScheme & 0x03);

            }

             mwiCount = 1;

。。。

        }

 

 

 if (hasUserDataHeader/* && ((dataCodingScheme & 0x03) == 0x00)*/) {

            if (this.userDataHeader.getMwiElements().size() != 0) {

                MessageWaitingIndication mwi = this.userDataHeader.getMwiElements().get(0);

                isMwi = true;

                mwiSense = mwi.getMwiCount() > 0 ? true : false;

                mwiDontStore = mwiDontStore && mwi.isMwiDontStore();

                mwiType = mwi.getMwiType();

                mwiCount = mwi.getMwiCount();

              }

        }

 

2.2 对消息接收流程的修改 

 

 

在GsmSMSDispatcher 的dispatchMessage会对收到的message做区分处理,mwi会在这里被分离出来,处理代码如下,蓝色的部分是新增加的处理,可以看出如果是mwi类型的消息,会调用setVoiceMessageWaitingExtension方法,之后便返回,不再走正常短信的流程。至于mwi是如何处理的,可看setVoiceMessageWaitingExtension的处理流程,它是根据相关协议完成数据的存储和显示的。

        boolean isMWISetMessage = sms.isMWISetMessage();

         

        if (sms.isMWISetMessage()) {

                mPhone.setVoiceMessageWaitingExtension(1, sms.getMwiCount(), sms.getMwiType());

            

            handled = sms.isMwiDontStore();

            if (Config.DEBUG) {

                Log.d(TAG, "Received voice mail indicator set SMS shouldStore=" + !handled);

            }

        } else if (sms.isMWIClearMessage()) {

            //mPhone.setVoiceMessageWaiting(1, 0);             

          Log.i(TAG, "Clear_MwiType: " + sms.getMwiType());

        mPhone.setVoiceMessageWaitingExtension(1, 0, sms.getMwiType());

            handled = sms.isMwiDontStore();

            if (Config.DEBUG) {

                Log.d(TAG, "Received voice mail indicator clear SMS shouldStore=" + !handled);

            }

 

更多推荐

6572

本文发布于:2024-02-12 23:15:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1689768.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!