拨号流程分析(第四篇)

本文基于Android 8.0文章目录继续分析CallsManager.placeOutgoingCall继续分析CallsManager.placeOutgoingCall我们再次回到Telecom应用的拨号流程中, CallsManager分别调用startOutgoingCall和placeOutgoingCall。startOutgoingCalI方法将通过绑定服务和调用其服务接...
摘要由CSDN通过智能技术生成

本文基于Android 8.0

继续分析CallsManager.placeOutgoingCall

我们再次回到Telecom应用的拨号流程中, CallsManager分别调用startOutgoingCall和placeOutgoingCall。startOutgoingCalI方法将通过绑定服务和调用其服务接口,启动和更新Dialer应用中的InCallActivity,展示出通话界面;但拨号请求并未发送到BP Modem处理。 我们继续分析placeOutgoingCall的处理逻辑,其关键的调用过程是: sendNewOutgoingCallIntent ->
NewOutgoingCalllntentBroadcaster.processlntent -> mCallsManager.placeOutgoingCall -> call.startCreateConnection ->
CreateConnectionProcessor.process -> attemptNextPhoneAccount等一系列调用,这个流程相对简单,请读者自己去跟踪和分析。 我们重点关注一下 CreateConnectionProcessor类的attemptNext­PhoneAccount方法,其关键逻辑详情如下:

// 又出现一个Service
mService = mRepository.getService(phoneAccount.getComponentName(),
phoneAccount.getUserHandle());
if (mService == null) {
   
    attemptNextPhoneAccount();// 如Service未准备好,将递归调用,直到超过次数限制
} else {
   
    mConnectionAttempt++;// 计数
    mCall.setConnectionManagerPhoneAccount(attempt.connectionManagerPhoneAccount);
    mCall.setTargetPhoneAccount(attempt.targetPhoneAccount);
    mCall.setConnectionService(mService);// 更新Call对象相关信息
    setTimeoutIfNeeded(mService, attempt);
    mService.createConnection(mCall, this);// 创建Connection,我们推测一下会是什么样的连接呢?
}

在CreateConnectionProcessor类的attemptNextPhoneAccount方法中, mRepository.getService获取 mService ,此处又出现一个 Service ,而且通过它创建Connection ,它究竟是个什么服务呢?又将创建什么类型的Connection呢?

在CreateConnectionProcessor类中的定义是private ConnectionServiceWrapper mService,继续跟踪ConnectionServiceWrapper的CreateConnection方法,其核心逻辑简化后,如下所示:

public void createConnection(final Call call, final CreateConnectionResponse response) {
   
	BindCallback callback = new BindCallback() {
   
		@Override
        public void onSuccess() {
   
        	...// 绑定服务成功后的处理逻辑
        }
        @Override
        public void onFailure() {
   
        	...// 绑定服务失败后的处理逻辑
    
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值