Signal-Android icon indicating copy to clipboard operation
Signal-Android copied to clipboard

Bluetooth headset button does not answer or end Signal voice calls

Open cegg1 opened this issue 6 years ago • 19 comments

  • [x] I have searched open and closed issues for duplicates
  • [x] I am submitting a bug report for existing functionality that does not work as intended
  • [x] I have read https://github.com/signalapp/Signal-Android/wiki/Submitting-useful-bug-reports
  • [x] This isn't a feature request or a discussion topic

Bug description

Signal supports using Bluetooth headsets for voice calls. However, when an incoming Signal call rings and a bluetooth headset is paired and connected, pressing the multifunction button on the headset does not answer the Signal call. The call has to be answered manually from the phone screen, only then does the bluetooth set engage.

Even more surprisingly, pressing the multifunction button while a Signal call is in progress (and the BT set in use) has the effect of handing the call over to the regular earpiece - rather than the expected result of ending the call.

The same issue has been observed on Pixel 2 (stock 8.1) and on Nexus 5 (LineageOS 14.1).

Steps to reproduce

  • receive a Signal call, having a bluetooth headset paired and connected
  • try to answer the call from the bluetooth headset

Actual result: The call keeps ringing. Expected result: The call is answered, similarly to regular phone call.

  • while on a Signal call and speaking through a bluetooth headset
  • try to hang up by pressing the button on the headset

Actual result: The call gets handed over to the earpiece. Expected result: The call is ended.

Screenshots

Not relevant

Device info

Bluetooth headset: Aukey EP-B40 Bluetooth 4.1 Device: Google Pixel 2 Android version: Stock Android 8.1.0 - OPM2.171019.029 Signal version: 4.18.3

Link to debug log

Trying to pick up a Signal call by pressing the bluetooth button (nothing happens) https://debuglogs.org/e98e666571435c9a13e6cac176ecdd4eda57ddd60a7127381c0c73625df697e0

Trying to end a Signal call by pressing the bluetooth button (call gets handed over to earpiece) https://debuglogs.org/789eec7e8c8e1138cf86a1fe61ea803bcc1df35bbb80b4f21edc057eeb581b0a

cegg1 avatar Apr 14 '18 14:04 cegg1

For headsets with only one button it is doable. For the generic case with carkits with 2 buttons this is extremely complicated because Android reserves that functionality only for the official phone app.

You can do that in a number of ways: the easiest way requires the MODIFY_PHONE_STATE permission, which is unfortunately only available for system apps. It would have the added advantage that an incomming "normal" call while you're on a Signal call gets busy.

I asked this question already on Stackoverflow once when it came up for my job but got no answers: https://stackoverflow.com/questions/47354818/how-to-make-a-voip-app-use-a-carkit-like-the-native-call-app

The only alternative that does not require root would be to implement the bluetooth communication on a low level yourself with BT sockets, but that is a lot of work, might not work correctly with all hardwareand require a lot of maintenance.

johanw666 avatar Apr 14 '18 16:04 johanw666

Thanks for the insight about answering calls with the Bluetooth button.

But what about ending a call in progress? There's still something I don´t understand: Signal must be already detecting that the button is being pressed - in fact, it hands the call over to the earpiece when you press it. This is just a single tap on the multifunction button (not that the headset is suddenly being turned off or becoming unavailable mid-call or anything). So Signal might as well react by ending the call rather than handing it back to the earpiece.

I understand that it might be technically challenging to pick up calls, but that doesn't fully explain why pressing the button during a call does not end the call.

cegg1 avatar Apr 14 '18 16:04 cegg1

Hangup is easy: you can detect the button being pressed, and when your call state is calling (the app knows when it is calling) it can hangup.

johanw666 avatar Apr 14 '18 18:04 johanw666

I have also recently been bitten by this. A full integration would be awesome, of course, but just having hangup work would fix a lot of the annoyance; finding out that your call is still active minutes after you thought you hung up is a bit annoying :)

tohojo avatar May 08 '18 08:05 tohojo

Hi @johanw666, you said the easiest way requires MODIFY_PHONE_STATE, I'm developing an app in which I have system permissions. So, what would be this easiest way?

Thanks in advance

destivar89 avatar Aug 20 '18 10:08 destivar89

I didn't work it out completely because the app I was working on didn't have this permission but the first set of results when I Google on android accept calls MODIFY_PHONE_STATE look promissing. And I believe that you didn't need system in very old Android versions so some old code could be usefull to check out too.

johanw666 avatar Aug 20 '18 16:08 johanw666

I agree, I'm not sure there is an easy solution for this issue by using the existing Java APIs. The reason is that the "Call" button event is most likely received by the low level Bluetooth driver but Android for some reason which I don;t understand is masking this event (security?). So far I have not found a way to get the CALL events from the Java APIs. You could however get a Bluetooth state change notification when you press on the "Call" button but this is not a good method to interpret the button press because the state might change by other events/actions in the system.

If you really must get the "Call" or "Disconnect" button events the solution might be to write a low level C code to parse the Bluetooth data stream, but this is most likely not an easy task to do.

vedaker avatar Mar 18 '19 21:03 vedaker

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Jan 28 '22 12:01 stale[bot]

This is only one of the issues related to Signal not using Android's proper call API, but handling calls as a media player instead. Related feature request: https://community.signalusers.org/t/implement-android-telecom-api-for-calls/41280

sellth avatar Feb 01 '22 09:02 sellth

Try on 5.33 where we've integrated with the Android telecom system, and made some changes to how we ring. Please post an updated debuglog if you try with that version and still encounter problems.

cody-signal avatar Mar 08 '22 20:03 cody-signal

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 08 '22 06:05 stale[bot]

Sorry for the delay in getting back to you. Here are two new debug logs. Device: Google Pixel 4a Signal: 5.36.3

  1. https://debuglogs.org/android/5.36.3/1bd8c900e5e44932cc9c613edab731c276ce19b4d7fbcc369699d51ff17fcc14
  2. https://debuglogs.org/android/5.36.3/d50f3cc9d5e32ac0684f9ac77c8904899b641c6327a9307e401ea6bd9a4d1dbd

First log:

  • trying to answer call with Bluetooth earbuds button
  • sth. happens to the rington audio, but call is not answered
  • answering call via the popover
  • call audio actually playing out of the earphone speaker instead of Bluetooth, despite Signal claiming Bluetooth speaker being used
  • switching back and forth between phone speaker and Bluetooth resolved this issue

Second log:

  • trying to answer call with earbuds button
  • ringtone audio switches from earbuds to phone speaker
  • answering call via the popover
  • call audio actually playing out of the earphone speaker instead of Bluetooth, despite Signal claiming Bluetooth speaker is used
  • switching back and forth between phone speaker and Bluetooth resolved this issue

After few more tries, this seems to be the behaviour:

  • Bluetooth button disconnects ringtone audio sometimes, but always causes the subsequent call audio to not use the Bluetooth speaker (despite Signal claiming it does)
  • when call is answered without pressing the Bluetooth button first, call audio uses the Bluetooth speaker just fine
  • trying to hang up via the Bluetooth button does nothing
  • there's also no "call bubble" created like for normal phone calls

Edit: However, the Telecom changes are possibly not enabled yet. https://whispersystems.discoursehosting.net/t/beta-feedback-for-the-upcoming-android-5-37-release/44124/20

sellth avatar May 08 '22 13:05 sellth

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 08 '22 15:07 stale[bot]

Phone: Google Pixel 6 Bluetooth Devices Tested: Jowave BH830, Google Pixel Buds Pro, Beats Studio Buds, Plantronics Voyager 5200 Android Version: 12 (July 2022 Patch Level) Signal Versions: 5.43, 5.44 Android Auto Device: Kenwood Excelon DMX957XR

Wanted to write in to note that up until 5.44, I was having the exact same issue. The Telecom integration patched into 5.44 appears to have resolved this issue, at least for me. I can confirm that now, the multifunction button on all devices tested will properly pick up on an incoming call and hang up when on a call.

This may not related to this particular issue, but I have also noticed that when you have different Bluetooth devices active (say a smartwatch and your Bluetooth headset), Signal will switch (even in the middle of a call) to the last Bluetooth device the phone communicated with. There is no way for you to specify which Bluetooth device you want, so you're stuck with whatever Signal decides is the correct Bluetooth device. As a workaround, you can remove the ability to do calls and media from all devices that are not Bluetooth headsets, but that is obviously undesireable for multiple reasons.

As a final note, as a user I wanted to thank you for this fix. There's no way to accept calls or make Signal calls using Android Auto (no notification will display, even though the ringtone plays, and Android Auto brings up the Android phone dialer history UI), so having the ability to tap the MFB on my Bluetooth headset and have that answer calls has been wonderful from a car safety standpoint. Prior to this, if I wanted to answer a Signal call while in my car, I would have to dig the phone out and answer from there (which I did not do as that is dangerous).

seung-pluto avatar Aug 10 '22 01:08 seung-pluto

We still can't answer/end incoming calls on bluetooth headset, including car dashboards. This seems to be a safety issue. Looking at the code, it seems the allow list for telecom integration is empty.

Can you provide an update please.

rajeevn1 avatar Dec 08 '23 13:12 rajeevn1

We tried almost a half dozen times to get telecom integration working, but it's improperly implemented across multiple vendors and devices. It results in all kinds of really bad problems. At this time, there is no plan to return to it until we hear from Google that something has improved, which potentially could be their new telecom integration library but so far that has not been the case.

cody-signal avatar Dec 08 '23 15:12 cody-signal

Thanks for the update. Hoping for resolution with:

https://android-developers.googleblog.com/2023/11/alpha-release-of-telecom-library.html

rajeevn1 avatar Dec 08 '23 16:12 rajeevn1

Would the mentioned telecom library update apply to older Androids too? Regardless of that, IIUC, the current implementation is not via telecom but "media player". Would it be simpler to implement the call ending functionality via this? (As that is what is troubling me much more than call answering.)

Werkov avatar Feb 27 '24 23:02 Werkov

Can this please be addressed? This is a pretty big limitation since often a headset is all I have and my phone has to be secured away. In this scenario I can't receive any signal calls.

comminutus avatar Apr 23 '24 08:04 comminutus