1,去电流程分析
1.1 app dialer
拨号盘界面有关拨号的部分由DialpadFragment.java实现,无论是单卡还是双卡,当点击拨号按键时,最后都会调用
handleDialButtonPressed方法进行处理,调用流程图如下,
在handleDialButtonPressed方法中,首先进行号码的有效性检查,然后调用DialerUtils的startActivityWithErrorToast的方法进行处理,
final Intent intent = CallUtil.getCallIntent(number);
if (!isDigitsShown && !PhoneNumberUtils.isEmergencyNumber(number)) {
// must be dial conference add extra
intent.putExtra(EXTRA_DIAL_CONFERENCE_URI, true);
}
intent.putExtra(ADD_PARTICIPANT_KEY, mAddParticipant && isPhoneInUse());
if (subcription != INVALID_SUBSCRIPTION) {
intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subcription);
}
DialerUtils.startActivityWithErrorToast(getActivity(), intent);
hideAndClearDialpad(false);//隐藏拨号盘
CallUtil的getCallIntent获取的intent,
final Intent intent = new Intent(Intent.ACTION_CALL, uri);
DialerUtils的startActivityWithErrorToast方法在此就是启动一个Activity,
context.startActivity(intent);
这样,在dialer进程中就处理完成了。
1.2 services telecom
telecom 中的AndroidManifest有关定义如下,
package="com.android.server.telecom"
coreApp="true"
android:sharedUserId="android.uid.system"
并且,在UserCallActivity下面,定义了intent-filter等信息,
<intent-filter>
<action android:name="android.intent.action.CALL" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="tel" />
</intent-filter>
因此, Intent.ACTION_CALL 会启动UserCallActivity,调用流程图如下,
UserCallActivity的onCreate方法如下,
new UserCallIntentProcessor(this, userHandle).processIntent(getIntent(),
getCallingPackage(), true /* hasCallAppOp*/);
创建并调用UserCallIntentProcessor对象的processIntent方法,主要是一些检查,
if (!canCallNonEmergency && !TelephonyUtil.shouldProcessAsEmergency(mContext, handle)) {
showErrorDialogForRestrictedOutgoingCa