Repository navigation
feat(bluetooth): optionally drop the iPhone's Bluetooth links on disableBluetooth - #49
Open
code-new-bie wants to merge 1 commit into
Open
code-new-bie wants to merge 1 commit into
code-new-bie wants to merge 1 commit into
Conversation
…bleBluetooth During wireless CarPlay the iPhone sends disableBluetooth to ask the accessory to drop its classic Bluetooth links to it, so calls and media go through CarPlay instead of the head unit's hands-free and Bluetooth audio. The controller only used it to time the wireless handoff; the head unit kept its HFP and A2DP links, so calls could ring on the head unit's own phone screen and music could keep playing over Bluetooth. Two new settings under Bluetooth, both off by default, turn off the iPhone's hands-free (HFP client) and Bluetooth audio (A2DP sink) links when disableBluetooth arrives: - Each link's connection priority is saved and set to off, so the head unit does not reconnect it, and the link is disconnected. A reconnect during the session is disconnected again, at most three times a minute. - The links are restored 15 s after the session ends unless CarPlay reconnects first, at once when the app exits, and on the next start if the process was killed before that (restored after 60 s unless CarPlay connects first). - Changing a setting applies at once, also during a session. The profiles are hidden API and are called reflectively. On Android 10 and earlier they need only BLUETOOTH_ADMIN; on later versions the head unit may refuse, which is logged and leaves the links connected. Verified in a BYD Song PLUS (Android 10): calls ring only in CarPlay and music stays on CarPlay during the session, and both links come back after it. BluetoothHandoffRestoreTest (Robolectric, so shared gains that test dependency) covers holding, restoring, settings changes and the restore after a killed process; BluetoothHandoffTest covers the reconnect limit and address checks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
During wireless CarPlay the iPhone sends disableBluetooth to ask the
accessory to drop its classic Bluetooth links to it, so calls and media go
through CarPlay instead of the head unit's hands-free and Bluetooth audio.
The controller only used it to time the wireless handoff; the head unit kept
its HFP and A2DP links, so calls could ring on the head unit's own phone
screen and music could keep playing over Bluetooth.
Two new settings under Bluetooth, both off by default, turn off the iPhone's
hands-free (HFP client) and Bluetooth audio (A2DP sink) links when
disableBluetooth arrives:
does not reconnect it, and the link is disconnected. A reconnect during the
session is disconnected again, at most three times a minute.
reconnects first, at once when the app exits, and on the next start if the
process was killed before that (restored after 60 s unless CarPlay
connects first).
The profiles are hidden API and are called reflectively. On Android 10 and
earlier they need only BLUETOOTH_ADMIN; on later versions the head unit may
refuse, which is logged and leaves the links connected.
Verified in a BYD Song PLUS (Android 10): calls ring only in CarPlay and
music stays on CarPlay during the session, and both links come back after
it. BluetoothHandoffRestoreTest (Robolectric, so shared gains that test
dependency) covers holding, restoring, settings changes and the restore
after a killed process; BluetoothHandoffTest covers the reconnect limit and
address checks.