Disconnection issues while bonded on Huawei & Honor devices



    • Given one is using a Huawei or Honor device (tested on P9 with Android 7.0, P7 with Android 5.1.1, P8 with Android 6.0 and Honor Play with EMUI 9.1).
    • When one connects and bonds to a Nordic-based peripheral through an app (tested on my app which uses SweetBlue v3.2.2, the latest SweetBlue Toolbox v3 and the nRF Connect app).
    • And then one explicitly disconnects the device OR one closes the app.
    • Then –as reported by the Nordic peripheral's BLE stack– the connection is not killed and the services are not disconnected.
    • Finally, if one opens the SweetBlue-based app again, the device can't be connected anymore to the app since it's already connected to the OS.

    I've found that a workaround for the disconnection issue is to delete the bonding information on the phone (works from the OS' settings, the SweetBlue Toolbox and the nRF Connect apps), which successfully terminates the connection AND does not trigger a 'bonding' prompt/notification on further connections to that peripheral (it also does not trigger a reconnection which is great).

    Q1: Is this a known issue?
    Q2: Can you reproduce this with other bonded devices on your end? It does not happen with our other custom peripheral that does not require bonding to the Android device.
    Q3: Is the aforementioned workaround a valid one? It should be alright for when one is terminating the connection, but it does not solve anything when killing the app.
    Q4: If you can reproduce this, would you consider adding it as standard Huawei/Honor behavior to the library so that after an explicit disconnection, the local bonding keys are deleted?
    Q5: Related question about using a device that is already connected to the OS



  • @AlejandroHCruz , are you sure it's just Huawei and Honor devices? This sounds suspiciously like the android bond bug, where it leaves a connection open after the first bond. See https://sweetblue.io/docs/Android-BLE-Issues under connection issues (last bullet point).

    There is a workaround in the library, but it is very clunky, and heavy-handed. The "fix" is to bond, then unbond, then connect, and disconnect. From then on, bonding works properly. I know how crazy this sounds.

    If you'd like to try it, you will have to update the BondFilter like so:

    public class MyBondFilter extends DefaultBondFilter {
        @Override
        public ConnectionBugEvent.Please onEvent(ConnectionBugEvent e) {
            return ConnectionBugEvent.Please.tryFix();
        }
    }
    
    BleManagerConfig config = new BleManagerConfig();
    config.bondFilter = new MyBondFilter();
    BleManager mgr = BleManager.get(activity, config);
    

    I'm curious if using this fixes your problem (it should also make it so if the app closes, the connection gets killed).