1、OutgoingCallBroadcaster:此类获取拨打途径传递而来的Action&Number,同时启动InCallScreen界面显示类.

//callNow 判断是否可以拨打,调用CallController.placeCall 
if (callNow) {
          
       if (DBG) Log.v(TAG, "onCreate(): callNow case! Calling placeCall(): " + intent);
    
       PhoneApp.getInstance().callController.placeCall(intent);

}

2、CallController。java ---- placeCall():

public void placeCall(Intent intent) {
     
     //省略部分代码
     CallStatusCode status = placeCallInternal(intent);
}

//调用PhoneUtil.placeCall
private CallStatusCode placeCallInternal(Intent intent) {
       
       //省略部分代码
       int callStatus = PhoneUtils.placeCall(mApp,
                  phone,
                  number,
                  contactUri,
                  (isEmergencyNumber || isEmergencyIntent),
                  inCallUiState.providerGatewayUri);
}

3、PhoneUtil.java ---- dial():

public static int placeCall(Context context, Phone phone,String number, Uri contactRef, 
          boolean isEmergencyCall,Uri gatewayUri) {

          //代码过多,省略。。
           connection = app.mCM.dial(phone, numberToDial);           
}

 

//以下属于frameworks层

4、GsmPhone.java ---- dial():

public Connection dial (String dialString, UUSInfo uusInfo) throws CallStateException {
        // Need to make sure dialString gets parsed properly
        String newDialString = PhoneNumberUtils.stripSeparators(dialString);

        // handle in-call MMI first if applicable
        if (handleInCallMmiCommands(newDialString)) {
            return null;
        }

        // Only look at the Network portion for mmi
        String networkPortion = PhoneNumberUtils.extractNetworkPortionAlt(newDialString);
        GsmMmiCode mmi = GsmMmiCode.newFromDialString(networkPortion, this);
        if (LOCAL_DEBUG) Log.d(LOG_TAG,
                               "dialing w/ mmi '" + mmi + "'...");

        if (mmi == null) {
            return mCT.dial(newDialString, uusInfo);
        } else if (mmi.isTemporaryModeCLIR()) {
            return mCT.dial(mmi.dialingNumber, mmi.getCLIRMode(), uusInfo);
        } else {
            mPendingMMIs.add(mmi);
            mMmiRegistrants.notifyRegistrants(new AsyncResult(null, mmi, null));
            mmi.processCode();

            // FIXME should this return null or something else?
            return null;
        }
    }

5、GsmCallTracker.java ---- dial():

Connection dial (String dialString, int clirMode, UUSInfo uusInfo) throws CallStateException {
        // note that this triggers call state changed notif
        clearDisconnected();

        if (!canDial()) {
            throw new CallStateException("cannot dial in current state");
        }

        // The new call must be assigned to the foreground call.
        // That call must be idle, so place anything that's
        // there on hold
        if (foregroundCall.getState() == GsmCall.State.ACTIVE) {
            // this will probably be done by the radio anyway
            // but the dial might fail before this happens
            // and we need to make sure the foreground call is clear
            // for the newly dialed connection
            switchWaitingOrHoldingAndActive();

            // Fake local state so that
            // a) foregroundCall is empty for the newly dialed connection
            // b) hasNonHangupStateChanged remains false in the
            // next poll, so that we don't clear a failed dialing call
            fakeHoldForegroundBeforeDial();
        }

        if (foregroundCall.getState() != GsmCall.State.IDLE) {
            //we should have failed in !canDial() above before we get here
            throw new CallStateException("cannot dial in current state");
        }

        pendingMO = new GsmConnection(phone.getContext(), dialString, this, foregroundCall);
        hangupPendingMO = false;

        if (pendingMO.address == null || pendingMO.address.length() == 0
            || pendingMO.address.indexOf(PhoneNumberUtils.WILD) >= 0
        ) {
            // Phone number is invalid
            pendingMO.cause = Connection.DisconnectCause.INVALID_NUMBER;

            // handlePollCalls() will notice this call not present
            // and will mark it as dropped.
            pollCallsWhenSafe();
        } else {
            // Always unmute when initiating a new call
            setMute(false);

            cm.dial(pendingMO.address, clirMode, uusInfo, obtainCompleteMessage());
        }

        updatePhoneState();
        phone.notifyPreciseCallStateChanged();

        return pendingMO;
    }

6、RIL.java ---- dial():

public void dial(String address, int clirMode, UUSInfo uusInfo, Message result) {
        RILRequest rr = RILRequest.obtain(RIL_REQUEST_DIAL, result);

        rr.mp.writeString(address);
        rr.mp.writeInt(clirMode);
        rr.mp.writeInt(0); // UUS information is absent

        if (uusInfo == null) {
            rr.mp.writeInt(0); // UUS information is absent
        } else {
            rr.mp.writeInt(1); // UUS information is present
            rr.mp.writeInt(uusInfo.getType());
            rr.mp.writeInt(uusInfo.getDcs());
            rr.mp.writeByteArray(uusInfo.getUserData());
        }

        if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));

        send(rr);
    }

 

      这些属于java层拨打代码,在往下就是C相关大概流程,有兴趣可继续深入…,如有什么错误可在此提出!

posted on 2013-09-05 14:26  羞涩的流氓  阅读(615)  评论(0编辑  收藏  举报