在分析android N拨打电话流程中分析了,从拨号盘到RIL.java的流程,没有分析拨号过程和UI的交互,这篇文章来说明,拉起InCallUI的过程.
在上篇文章中可以知道CallIntentProcessor中会通过processOutgoingCallIntent来调用CallManager的startOutgoingCall和NewOutgoingCallIntentBroadcaster的processIntent方法,分析就是从startOutgoingCall开始的.
1.CallManager的startOutgoingCall
Call startOutgoingCall(Uri handle, PhoneAccountHandle phoneAccountHandle, Bundle extras,
UserHandle initiatingUser) {
boolean isReusedCall = true;
Call call = reuseOutgoingCall(handle);
// Create a call with original handle. The handle may be changed when the call is attached
// to a connection service, but in most cases will remain the same.
if (call == null) {
call = new Call(getNextCallId(), mContext,
this,
mLock,
mConnectionServiceRepository,
mContactsAsyncHelper,
mCallerInfoAsyncQueryFactory,
mPhoneNumberUtilsAdapter,
handle,
null /* gatewayInfo */,
null /* connectionManagerPhoneAccount */,
null /* phoneAccountHandle */,
Call.CALL_DIRECTION_OUTGOING /* callDirection */,
false /* forceAttachToExistingConnection */,
false /* isConference */
);
if ((extras != null) &&
extras.getBoolean(TelephonyProperties.EXTRA_DIAL_CONFERENCE_URI, false)) {
//Reset PostDialDigits with empty string for ConfURI call.
call.setPostDialDigits("");
}
call.initAnalytics();
call.setInitiatingUser(initiatingUser);
isReusedCall = false;
}
// Set the video state on the call early so that when it is added to the InCall UI the UI
// knows to configure itself as a video call immediately.
if (extras != null) {
int videoState = extras.getInt(TelecomManager.EXTRA_START_CALL_WITH_VIDEO_STATE,
VideoProfile.STATE_AUDIO_ONLY);
// If this is an emergency video call, we need to check if the phone account supports
// emergency video calling.
// Also, ensure we don't try to place an outgoing call with video if video is not
// supported.
if (VideoProfile.isVideo(videoState)) {
PhoneAccount account =
mPhoneAccountRegistrar.getPhoneAccount(phoneAccountHandle, initiatingUser);
if (call.isEmergencyCall() && account != null &&
!account.hasCapabilities(PhoneAccount.CAPABILITY_EMERGENCY_VIDEO_CALLING)) {
// Phone account doesn't support emergency video calling, so fallback to
// audio-only now to prevent the InCall UI from setting up video surfaces
// needlessly.
Log.i(this, "startOutgoingCall - emergency video calls not supported; " +
"falling back to audio-only");
videoState = VideoProfile.STATE_AUDIO_ONLY;
} else if (account != null &&
!account.hasCapabilities(PhoneAccount.CAPABILITY_VIDEO_CALLING)) {
// Phone account doesn't support video calling, so fallback to audio-only.
Log.i(this, "startOutgoingCall - video calls not supported; fallback to " +
"audio-only.");
videoState = VideoProfile.STATE_AUDIO_ONLY;
}
}
call.setVideoState(videoState);
}
boolean isAddParticipant = ((extras != null) && (extras.getBoolean(
TelephonyProperties.ADD_PARTICIPANT_KEY, false)));
boolean isSkipSchemaOrConfUri = ((extras != null) && (extras.getBoolean(
TelephonyProperties.EXTRA_SKIP_SCHEMA_PARSING, fals
Android N 拨打流程分析:InCallUI 拉起过程

本文详细解析了在Android N系统中,从拨号到拉起InCallUI的整个过程。从CallManager的startOutgoingCall开始,经过addCall操作,通过观察者模式通知InCallController。接着分析了InCallController如何绑定InCallServiceImpl服务,此服务作为Telecom和Incall进程交互的桥梁。最终,InCallPresenter和CallList的回调导致IncallActivity被启动。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



