電話の接続と未接続、下層報告の状態



にある

繰り返し電話をかけて、電話テストの小さいプログラム、緊急電話と普通の電話は枝分かれして判断します


では、ストレステストの電話がかかってきたときに、つながらなかったら、どうやってこの状態を判断すればいいのか、何回成功したのかをどのように統計すればいいのかという問題があります.
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();
        }
    }