Skip to content

ViPER4Android gets stuck on disconnected car stereo #92

Open

Description

@vjburic1

I have a car, Golf 7. Whenever I connect with bluetooth, it will recognize it. However, there is a chance that, after disconnecting, V4A-RE gets "stuck", still thinking it's still connected to the car.

It will switch to headphones when connected, but revert to car when disconnected instead of switching to speaker. Killing the app doesn't solve it, only restart or connecting and disconnecting to the car stereo again.

Now it doesn't do this every time, and connect-disconnect doesn't work every time. It just gets stuck when it feels like it, and connect-disconnect also solves it when it feels like it.

Not a big deal, since I listen by SD card instead of phone in my car, but it means I either use both just speaker optimization for both car and phone speaker, or turn it off when it's stuck.

Activity

  1. vjburic1 commented on Mar 29, 2024

    @vjburic1
    Author

    Here's the video of it being stuck despite no bluetooth connection.

    Screen_Recording_20240329_183535_One.UI.Home_1_1.mp4
  2. iscle commented on Mar 30, 2024

    @iscle
    Contributor

    Hi!

    Yes, this is a known issue, the same happens to me as well.

    I'm investigating the issue, as it can get really annoying depending on your preset.

    I'll let you know when a fix is available.

    Regards!

  3. vjburic1 commented on Apr 3, 2024

    @vjburic1
    Author

    Another issue.

    Sometimes, while it's "stuck", on my S21 Ultra stock One UI 6.0 (Android 14) latest at the moment of writing, while Shanling UA3 is connected (headphones), it will sometimes switch back to car, then switch back to Shanling moments later. Sometimes it will stay as car and won't switch back. Doesn't happen too often. Solution is to disconnect and reconnect headphones.

    Didn't happen in LineageOS 21 experimental (Android 14) or official LineageOS 20 (Android 13) on my previous S10+.

  4. griha41 commented on Apr 3, 2024

    @griha41

    Another issue.

    Sometimes, while it's "stuck", on my S21 Ultra stock One UI 6.0 (Android 14) latest at the moment of writing, while Shanling UA3 is connected (headphones), it will sometimes switch back to car, then switch back to Shanling moments later. Sometimes it will stay as car and won't switch back. Doesn't happen too often. Solution is to disconnect and reconnect headphones.

    Didn't happen in LineageOS 21 experimental (Android 14) or official LineageOS 20 (Android 13) on my previous S10+.

    Hm, may it happens because of battery?

    I'm sure that you know that while Bluetooth broadcasting it migh have the issue with overheating or more often because of amounts of data transfer. Same as ViperFX is a driver but later androids versions is very careful to the battery usage. Try to set the unlimited battery usage for the ViperFX and the audio player that you're preferred for your android device. Maybe that could solve some troubles. Idk I never had the issues within direct connection (through the cable) to the car (Citroen C4, with AUX input)...

  5. vjburic1 commented on Apr 4, 2024

    @vjburic1
    Author

    Another issue.
    Sometimes, while it's "stuck", on my S21 Ultra stock One UI 6.0 (Android 14) latest at the moment of writing, while Shanling UA3 is connected (headphones), it will sometimes switch back to car, then switch back to Shanling moments later. Sometimes it will stay as car and won't switch back. Doesn't happen too often. Solution is to disconnect and reconnect headphones.
    Didn't happen in LineageOS 21 experimental (Android 14) or official LineageOS 20 (Android 13) on my previous S10+.

    Hm, may it happens because of battery?

    I'm sure that you know that while Bluetooth broadcasting it migh have the issue with overheating or more often because of amounts of data transfer. Same as ViperFX is a driver but later androids versions is very careful to the battery usage. Try to set the unlimited battery usage for the ViperFX and the audio player that you're preferred for your android device. Maybe that could solve some troubles. Idk I never had the issues within direct connection (through the cable) to the car (Citroen C4, with AUX input)...

    Mmm, makes sense. I've been keeping it on optimized because it worked without issues on S10+. I'll put it into unrestricted when it asks.

    Samsung has sleep (run periodically in background) and deep sleep (never run in background) options, which supersede the standard restricted battery mode. With that on (47 apps in deep sleep, 12 in sleep), plus Naptime in NFS Injector, plus disable sensor during Doze with NUKED, plus deep doze and doze optimisations in NUKED, plus Lift to Wake disabled, I've been able to have good screen off battery (from 100 to 92 in 10 or so hours screen off) and I've not permitted V4A-RE to run unrestricted because it worked without problems in optimized. I've not put it in either of those two options.

    I'll run it in unrestricted now. This all happened while screen is on every time (the switching to car while headphones were connected) so no Doze issues. Thanks for the suggestion that battery management might be the culprit.

    And no, there were no bluetooth connections when this happened. Not even handsfree. Hmmm, maybe the HFP (handsfree) mode in conjunction with A2DP causes V4A-RE to be "stuck"? I can test it with laptop which has only A2DP (there's a bluetooth app which connects to A2DP capable devices in W10/11 on Microsoft store). But don't remember it being "stuck" with laptop.

    I'll reboot and try connecting and disconnecting to laptop multiple times later in the day to see if it gets "stuck" since there's no handsfree, only A2DP.

  6. vjburic1 commented on Apr 4, 2024

    @vjburic1
    Author

    I have tried to connect and disconnect A2DP on my PC many times and it reverts. You can see JamesDSP switching to bluetooth, and V4A showing DESKTOP. Only thing left to try is disable HFP in my car and see if that's the issue.

    screen-recording-20240404-155405-firefox_v0xU1gMf.mp4
  7. vjburic1 commented on Apr 4, 2024

    @vjburic1
    Author

    Okay! HFP definitely interferes. As you can see in the video, if you first disconnect A2DP, without first disconnecting HFP, it gets "stuck". If you disconnect HFP first, then A2DP, it reverts. Not even connecting and disconnecting just HFP solves it, you must connect A2DP again and disconnect it, without connecting HFP. See the screen recording below.

    So the solution is to either disconnect calls manually first then turn off the car, or if you made the mistake and didn't and it gets stuck, just connect A2DP to the car and disconnect it again. Have to see if any bluetooth or must be the exact same bluetooth device.

    HFP causes the issue if it disconnects before A2DP disconnects it seems.

    Edit: any A2DP will suffice if it's "stuck". Connect and disconnect any A2DP device and it will revert.

    screen-recording-20240404-161242-settings_ySfdeaTT.mp4
  8. iscle commented on Apr 4, 2024

    @iscle
    Contributor

    I originally thought that this change would fix it, but aweing the last video, I'm not that sure 🤔

    iscle/ViPER4Android-RE@7472989

  9. vjburic1 commented on Apr 4, 2024

    @vjburic1
    Author

    I originally thought that this change would fix it, but aweing the last video, I'm not that sure 🤔

    iscle/ViPER4Android-RE@7472989

    Is it possible for V4A-RE to detect HFP, and act accordingly? Or ignore it completely, removing any traces of HFP? Maybe it tries to process HFP somehow. It is, after all, reverse-engineered.

    If it detects HFP on the same device, then next step is to "force" it to revert to speaker upon disconnect.

  10. iscle commented on Apr 4, 2024

    @iscle
    Contributor

    This works using the MediaRouter API. I will investigate the code and see if there is some workaround or something.

  11. vjburic1 commented on Apr 5, 2024

    @vjburic1
    Author

    I'm not a programmer so I don't know about this, but is it possible to integrate BluetoothHeadset API to detect HFP that way, and when detected, next step is to force revertion to speaker upon bluetooth disconnect while ignoring headset (in case headset is connected at the same time as bluetooth)?

    https://developer.android.com/reference/android/bluetooth/BluetoothHeadset

  12. vaterfa commented on Aug 7, 2024

    @vaterfa

    hello, i have the same issue. after connect the car when i dissconnect it from, i stuck at car bluetooth. only restarting phone or connect any bt headphone fix it problem.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions