InCallScreen.java/updateScreen()分析

来源:互联网 发布:大秦帝国之纵横知乎 编辑:程序博客网 时间:2024/03/29 14:38

函数功能是在通话状态改变时候,更新屏幕的

一、首先判定当前是否可以出现通话菜单

1,如果电话是空闲状态,不可以出现菜单

2,如果有来电

    2.1  如果当前正在通话而且没有等待的电话,可以弹出通话菜单

    2.2  否则,不能弹出菜单

二、如果是会议模式,更新会议面板

三、根据当前通话状态,更新CallCard,就是屏幕中间显示头像那一块。

四、是否显示DTMF面板(通话过程中的那个拨号面板,如查话费时候,供你按人工提示输入数字的那个面板)

1,如果当前是响铃状态,不关闭拨号面板,但是清空里面可能是上一个通话的数字

2,如果当前是竖屏模式,并且在通话状态下,可以显示拨号面板

五,更新等待接听界面,如果有来电则转到等待接听界面(就是来电的时候那个界面)

六,更新menuButtonHint      在string.xml里面有定义 <string name="menuButtonHint" msgid="4853215496220101699">"按 MENU 可以选择通话选项。"</string>

 

 

部分代码如下

 if (mInCallMenu != null) {                                                     
            // TODO: do this only if the menu is visible!                              
            if (VDBG) log("- updateScreen: updating menu items...");                   
            boolean okToShowMenu = mInCallMenu.updateItems(mPhone);                    
            if (!okToShowMenu) {                                                       
                // Uh oh: we were only trying to update the state of the               
                // menu items, but the logic in InCallMenu.updateItems()               
                // just decided the menu shouldn't be visible at all!                  
                // (That's probably means that the call ended                          
                // asynchronously while the menu was up.)                              
                //                                                                     
                // So take the menu down ASAP.                                         
                if (VDBG) log("- updateScreen: Tried to update menu; now need to dismiss!");
                // dismissMenu() has no effect if the menu is already closed.          
                dismissMenu(true);  // dismissImmediate = true
            }  
        }  
       
        if (mInCallScreenMode == InCallScreenMode.MANAGE_CONFERENCE) {                 
            if (VDBG) log("- updateScreen: manage conference mode (NOT updating in-call UI)...");
            updateManageConferencePanelIfNecessary();
            return;                                                                    
        } else if (mInCallScreenMode == InCallScreenMode.CALL_ENDED) {                 
            if (VDBG) log("- updateScreen: call ended state (NOT updating in-call UI)..."); 
            return;
        }  

        if (VDBG) log("- updateScreen: updating the in-call UI...");                   
        mCallCard.updateState(mPhone);                                                 
        updateDialpadVisibility();                                                     
        updateOnscreenAnswerUi();
        updateMenuButtonHint();

原创粉丝点击