OutgoingCallBroadcaster启动InCallScreen流程
2012-10-21 21:52 Kevin-wang 阅读(514) 评论(0) 编辑 收藏 举报OutgoingCallBroadcaster:接收ACTION_CALL的信息,别且对紧急电话和普通电话进行分析,启到一个过滤的作用;
InCallScreen:打电话和接电话的界面;
无论是普通电话还是紧急电话都会启动InCallScreen界面;
流程:
1、OutgoingCallBroadcaster.class
startSipCallOptionHandler(....){
..........
Intent selectPhoneIntent = new Intent(ACTION_SIP_SELECT_PHONE, uri);
selectPhoneIntent.setClass(context, SipCallOptionHandler.class);
selectPhoneIntent.putExtra(EXTRA_NEW_CALL_INTENT, newIntent);
selectPhoneIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(selectPhoneIntent); //启动了SipCallOptionHandler.class
}
2、SipCallOptionHandler.class
setResultAndFinish() {
........
PhoneApp.getInstance().callController.placeCall(mIntent);
.........
}
3、CallController.class
placeCall(Intent intent) {
........
mApp.displayCallScreen(); //mApp = PhoneApp app;
}
4、PhoneApp.class
displayCallScreen() {
.......
startActivity(createInCallIntent());
}
static Intent createInCallIntent() {
Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
| Intent.FLAG_ACTIVITY_NO_USER_ACTION);
intent.setClassName("com.android.phone", getCallScreenClassName());
return intent;
}
static String getCallScreenClassName() {
return InCallScreen.class.getName();
}