Bonding with autoBondFixes set to true deletes all Bluetooth devices from Sony phones



  • Hi,

    Hope you're doing well despite the strangeness of these times we're currently experiencing.

    Multiple users are reporting that their Sony phone is deleting all the bonding keys they have stored after connecting to our wearable device using our app.

    So they need to pair again with their Bluetooth speaker or other devices they might use, which is a big pain for them.

    1. Could you take a look at the configuration I'm using and provide some advice? Otherwise my course of action would be to set autoBondFixes to false.
    2. Does anyone in the community use the autoBondFixes without issues?

    BleDeviceConfig parameters

    • autoBondFixes = true
    • autoNegotiateMtuOnReconnect = false
    • tryBondingWhileDisconnected = false
    • bondingFailFailsConnection = true
    • alwaysBondOnConnect = true
    • forceBondDialog = true
    • useLeTransportForBonding = false

    Phone models:

    • Sony Xperia J8110 (Android 10)
    • Sony Xperia G8141 (Android 9)
    • Sony Xperia H8324 (Android 10)
    • Others, I'm gathering the data

    Thanks a lot
    Be safe, all the best!



  • Same happened to our Sony users, I have seen code related to this inside SweetBlue APIs but can't remember where but it does check for "Samsung" and "Sony" manufacturer Strings.

    I fixed it with this:
    cfg.autoBondFixes = false
    cfg.tryBondingWhileDisconnected = false

    It will still autoBond when connecting



  • So sorry for missing this post!

    We run with autoBondFixes in our app. It's possible we don't have many Sony, or Motorola users (those devices are typically the worst offenders). autoBondFixes shouldn't affect other devices. It should only unbond the device it tries to connect to.

    From experience with those phones in the past, we found that a lot of Sony and Motorola phones don't implement bonding correctly. Something to do with how they store their encryption keys, I believe. This makes repeat connections very unreliable. Hence, the "fix" to rebond on each connection.

    I assume your apps are not connecting to those devices the customers are complaining about having lost the pairings for?



  • Hi, thank you for the reply. Good to see the topic moving forward despite the crazy times.

    To answer your question: The app connects successfully to the BLE device (except for one customer who couldn't) but as a consequence all the other bonded devices are deleted. We've only seen this behavior on new Sony devices (not the ones listed in the SweetBlue compatibility page), not on Motorola devices at all.

    Seems like the nuke function is being called somehow? Could that or some other internal mechanism in SweetBlue cause such an issue?



  • The nuke method is essentially the same as calling reset(), only it calls one additional method via reflection (factory_reset). I suppose that method has the potential to wipe out bluetooth pairings (its unclear what it does exactly as it's not an exposed method in the normal API), but it will never be called accidentally. You have to call the nukeBle() method from your own code. Have you reproduced this issue yourself in house?



  • We don't call the nukeBle() function from any where in our code base. Is there anything else that could be triggering this or the factory_reset function?



  • No, nothing else triggers that method.

    Have you been able to reproduce the issue yourself in house?



  • Hi, I was able to get my hands on a Xperia XZ2.

    We've confirmed that a user has this particular issue with that phone. The preliminary results indicate that the device is not saving the bonding information for some reason:
    On every connection, it asks to pair with our BLE device. Does this mean anything to you?

    I'll keep testing and keep you posted.



  • That is expected, and the default behavior. You can experiment with the setting autoBondFixes (set it to false) to see how connection rates are. What is NOT expected behavior is to lose pairings to other devices that you are not connecting to in your app.



  • Thank you, I'll be able to confidently test without the autoBondFixes now.