当用户在 LockTask 模式下点击后退按钮时如何返回到 InCallUI?

How to go back to InCallUI when user hit the back button in LockTask mode?

对于我的一位客户,我有一个 Android COSU app 处于 LockTask 模式。

在 incoming/outgoing 通话中,InCallUI 显示良好,因为设备的 phone 应用已列入白名单。

但是,在 LockTask 模式下,导航栏中的后退按钮仍然可用,他们的员工(好员工 :))经常点击它,所以他们无法挂断对话。

我的问题是:

是否存在恢复 InCallUI 以便用户可以与键盘交互或挂断电话的 Intent?

在这种情况下,我可以显示一个叠加层(屏幕顶部的栏或按钮,如 Facebook Messenger)以恢复 InCallUI。

提前致谢:)

[编辑] 退出 LockTask 模式不是一个选项 ;)

你试过打电话给 TelecomManager.showInCallScreen() 吗?它的 documentation 表示:

Requires that the method-caller be set as the system dialer app or have the READ_PHONE_STATE permission.

READ_PHONE_STATE is a dangerous permission, it might be granted to your COSU app. Then, per the second clause of the above quote, you should be able to expose a button bringing back the InCallService 到前台。

我自己还没有测试过,如果有效请告诉我。