对于android的拨号流程,网上有很多帖子分析,基本上都会有如下的描述:
“如果是MO,会调用ConnectionService端的onCreateOutgoingConnection(),这个方法会被TelephonyConnectionService重写,最终在TelephonyConnection里面执行,TelephonyConnectionService是最终要实例化的类”
问题是,我真没有发现TelephonyConnection是在哪里被实例化的,没有实例化的话,为什么ConnectionService里面的onCreateOutgoingConnection会在TelephonyConnection里面执行
TelephonyConnection具体实现分为GSM跟CDMA两个
packages/services/Telephony/src/com/android/services/telephony/GsmConnection.java
packages/services/Telephony/src/com/android/services/telephony/CdmaConnection.java
private TelephonyConnection createConnectionFor(
Phone phone,
com.android.internal.telephony.Connection originalConnection,
boolean isOutgoing) {
TelephonyConnection returnConnection = null;
int phoneType = phone.getPhoneType();
if (phoneType == TelephonyManager.PHONE_TYPE_GSM) {
returnConnection = new GsmConnection(originalConnection);
} else if (phoneType == TelephonyManager.PHONE_TYPE_CDMA) {
boolean allowMute = allowMute(phone);
returnConnection = new CdmaConnection(
originalConnection, mEmergencyTonePlayer, allowMute, isOutgoing);
}
if (returnConnection != null) {
// Listen to Telephony specific callbacks from the connection
returnConnection.addTelephonyConnectionListener(mTelephonyConnectionListener);
}
return returnConnection;
}