Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth headset button does not answer or end Signal voice calls #7679

Open
4 tasks done
cegg1 opened this issue Apr 14, 2018 · 19 comments
Open
4 tasks done

Bluetooth headset button does not answer or end Signal voice calls #7679

cegg1 opened this issue Apr 14, 2018 · 19 comments

Comments

@cegg1
Copy link

cegg1 commented Apr 14, 2018


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 cegg1 changed the title Button on Bluetooth headset does not answer or end Signal voice calls Bluetooth headset button does not answer or end Signal voice calls Apr 14, 2018
@johanw666
Copy link
Contributor

johanw666 commented Apr 14, 2018

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.

@cegg1
Copy link
Author

cegg1 commented Apr 14, 2018

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.

@johanw666
Copy link
Contributor

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.

@tohojo
Copy link

tohojo commented May 8, 2018

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 :)

@destivar89
Copy link

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

@johanw666
Copy link
Contributor

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.

@vedaker
Copy link

vedaker commented Mar 18, 2019

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.

@stale
Copy link

stale bot commented Jan 28, 2022

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 stale bot added the wontfix label Jan 28, 2022
@sellth
Copy link

sellth commented Feb 1, 2022

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

@stale stale bot removed the wontfix label Feb 1, 2022
@cody-signal
Copy link
Contributor

cody-signal commented Mar 8, 2022

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.

@stale
Copy link

stale bot commented May 8, 2022

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 stale bot added the wontfix label May 8, 2022
@sellth
Copy link

sellth commented May 8, 2022

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

@stale stale bot removed the wontfix label May 8, 2022
@stale
Copy link

stale bot commented Jul 8, 2022

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 stale bot added the wontfix label Jul 8, 2022
@seung-pluto
Copy link

seung-pluto commented Aug 10, 2022

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).

@rajeevn1
Copy link

rajeevn1 commented Dec 8, 2023

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.

@cody-signal
Copy link
Contributor

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.

@rajeevn1
Copy link

rajeevn1 commented Dec 8, 2023

Thanks for the update. Hoping for resolution with:

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

@Werkov
Copy link

Werkov commented Feb 27, 2024

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.)

@comminutus
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests