关闭

电话接通与未接通,下层上报的状态

标签: 电话animationuserupbehavior测试
1272人阅读 评论(1) 收藏 举报
分类:

  

 在

反复拨打电话,电话测试小程序,紧急电话与普通电话分枝判断

中遇到这样一个问题 ,在压力测试电话拨打时,如果没有接通,该如何判断此状态呢,该如何统计拨打成功多少次?

从log日志中发现有:

 01-01 08:26:43.507: DEBUG/InCallScreen(1409):   - mLastDisconnectCause = NORMAL
 01-01 08:27:01.515: DEBUG/InCallScreen(1409):   - mLastDisconnectCause = LOCAL

01-02 17:21:36.304: DEBUG/InCallScreen(1383):   - mLastDisconnectCause = ERROR_UNSPECIFIED

 

其中:    // DisconnectCause values in the most common scenarios:
                // - INCOMING_MISSED: incoming ringing call times out, or the  other end hangs up while still ringing
                // - INCOMING_REJECTED: user rejects the call while ringing
                // - LOCAL: user hung up while a call was active (after answering an incoming call, or after making an  outgoing call)
                // - NORMAL: the other end hung up (after answering an incoming   call, or after making an outgoing call)

如果:mLastDisconnectCause = ERROR_UNSPECIFIED 表示连接不成功--失败。

在代码:InCallScreen.java里得到体现,见如下代码:

  

    private void delayedCleanupAfterDisconnect() {
        if (VDBG) log("delayedCleanupAfterDisconnect()...  Phone state = " + mCM.getState());

        // Clean up any connections in the DISCONNECTED state.
        //
        // [Background: Even after a connection gets disconnected, its
        // Connection object still stays around, in the special
        // DISCONNECTED state.  This is necessary because we we need the
        // caller-id information from that Connection to properly draw the
        // "Call ended" state of the CallCard.
        //   But at this point we truly don't need that connection any
        // more, so tell the Phone that it's now OK to to clean up any
        // connections still in that state.]
        mCM.clearDisconnected();

        if (!phoneIsInUse()) {
            // Phone is idle!  We should exit this screen now.
            if (DBG) log("- delayedCleanupAfterDisconnect: phone is idle...");

            // And (finally!) exit from the in-call screen
            // (but not if we're already in the process of pausing...)
            if (mIsForegroundActivity) {
                if (DBG) log("- delayedCleanupAfterDisconnect: finishing InCallScreen...");

                // In some cases we finish the call by taking the user to the
                // Call Log.  Otherwise, we simply call endInCallScreenSession,
                // which will take us back to wherever we came from.
                //
                // UI note: In eclair and earlier, we went to the Call Log
                // after outgoing calls initiated on the device, but never for
                // incoming calls.  Now we do it for incoming calls too, as
                // long as the call was answered by the user.  (We always go
                // back where you came from after a rejected or missed incoming
                // call.)
                //
                // And in any case, *never* go to the call log if we're in
                // emergency mode (i.e. if the screen is locked and a lock
                // pattern or PIN/password is set.)

                if (VDBG) log("- Post-call behavior:");
                if (VDBG) log("  - mLastDisconnectCause = " + mLastDisconnectCause);
                if (VDBG) log("  - isPhoneStateRestricted() = " + isPhoneStateRestricted());
                
                mNumberAll ++;
                Log.e("mNumber", "mNumberAll==="+mNumberAll);
                
                if(mLastDisconnectCause.toString().equals("ERROR_UNSPECIFIED")){
                	mNumberFail ++;
                	Log.e("mNumber", "Failure number==="+mNumberFail);
                }
                
                Log.e("mNumber", "mNumberFail/mNumberAll==="+mNumberAll +"/"+ mNumberAll);
                

                // DisconnectCause values in the most common scenarios:
                // - INCOMING_MISSED: incoming ringing call times out, or the
                //                    other end hangs up while still ringing
                // - INCOMING_REJECTED: user rejects the call while ringing
                // - LOCAL: user hung up while a call was active (after
                //          answering an incoming call, or after making an
                //          outgoing call)
                // - NORMAL: the other end hung up (after answering an incoming
                //           call, or after making an outgoing call)

				//Mod by kylin 2011.10.21 begin	    //Open by kylin 2012.03.22
                if ((mLastDisconnectCause != Connection.DisconnectCause.INCOMING_MISSED)
                        && (mLastDisconnectCause != Connection.DisconnectCause.INCOMING_REJECTED)
                        && !isPhoneStateRestricted()) {
                    if (VDBG) log("- Show Call Log after disconnect...");
                    final Intent intent = PhoneApp.createCallLogIntent();
                    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
                    startActivity(intent);
                    // Even in this case we still call endInCallScreenSession (below),
                    // to make sure we don't stay in the activity history.
                }
			    endInCallScreenSession();
                finish();
                //Mod by kylin 2011.10.21 begin	
            }
        } else {
            // The phone is still in use.  Stay here in this activity, but
            // we don't need to keep the screen on.
            if (DBG) log("- delayedCleanupAfterDisconnect: staying on the InCallScreen...");
            if (DBG) PhoneUtils.dumpCallState();
        }
    }


 

 

1
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:409657次
    • 积分:4614
    • 等级:
    • 排名:第6582名
    • 原创:58篇
    • 转载:33篇
    • 译文:3篇
    • 评论:58条
    最新评论