android9.0紧急号码拨号流程

目录

紧急电话的流程

针对紧急电话的几种特殊情况代码处理

拨打紧急电话过程中Call的状态变化

对比log分析


紧急电话的流程

针对紧急电话的几种特殊情况代码处理

ACTION_CALL和ACTION_CALL_EMERGENCY

在MO流程中call action有三种,在NewOutgoingCallIntentBroadcaster中对三种action进行了处理,我们先从源码的注释中先看一下他们分别用在什么时候

181    /**
182     * Processes the supplied intent and starts the outgoing call broadcast process relevant to the
183     * intent.
184     *
185     * This method will handle three kinds of actions:
186     *
187     * - CALL (intent launched by all third party dialers)
188     * - CALL_PRIVILEGED (intent launched by system apps e.g. system Dialer, voice Dialer)
189     * - CALL_EMERGENCY (intent launched by lock screen emergency dialer)
190     *
191     * @return {@link DisconnectCause#NOT_DISCONNECTED} if the call succeeded, and an appropriate
192     *         {@link DisconnectCause} if the call did not, describing why it failed.
193     */

ACTION_CALL:所有第三方应用拨号发出的action

ACTION_CALL_PRIVILEGED:系统app发出的action

ACTION_CALL_EMERGENCY:在锁屏界面点击紧急拨号出现的拨号盘发出的action

 

实际上一般系统拨号盘发出的action是ACTION_CALL,锁屏界面紧急拨号的action是ACTION_CALL_EMERGENCY。我们看下代码是如何针对两者处理的:

/packages/services/Telecomm/src/com/android/server/telecom/NewOutgoingCallIntentBroadcaster.java

195    public int processIntent() {
    ......
240        boolean callImmediately = false;
......
261            final boolean isPotentialEmergencyNumber = isPotentialEmergencyNumber(number);
....

267            if (Intent.ACTION_CALL.equals(action)) {
268                if (isPotentialEmergencyNumber) {
	//如果是第三方应用播出的紧急号码,就会跳转到系统拨号盘拨号
269                    if (!mIsDefaultOrSystemPhoneApp) {
270                        Log.w(this, "Cannot call potential emergency number %s with CALL Intent %s "
271                                + "unless caller is system or default dialer.", number, intent);
272                        launchSystemDialer(intent.getData());
273                        return DisconnectCause.OUTGOING_CANCELED;
274                    } else {
275                        callImmediately = true;
276                    }
277                }
278            } else if (Intent.ACTION_CALL_EMERGENCY.equals(action)) {
279                if (!isPotentialEmergencyNumber) {
280                    Log.w(this, "Cannot call non-potential-emergency number %s with EMERGENCY_CALL "
281                            + "Intent %s.", number, intent);
282                    return DisconnectCause.OUTGOING_CANCELED;
283                }
284                callImmediately = true;
285            } else {
286                Log.w(this, "Unhandled Intent %s. Ignoring and not placing call.", intent);
287                return DisconnectCause.INVALID_NUMBER;
288            }
......
	//可以看到,系统应用的拨号更快,直接调用placeOutgoingCallImmediately,而普通拨号还需要发送广播
300        if (
  • 7
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值