ConnectionBugHack



  • We use 3.2.5 to develop our applications.
    After about 60 seconds after bonding, the following log is output and disconnected, but the connection is still active on the OS.

    What can I do to stay connected?

    What conditions does ConnectionBugHack detect and what does it do?

    W/ConnectionBugHack: UPDATE(16872) update() - Connection bug fix timed out for device with mac address of DA:94:BB:0A:58:D7
    I/P_TaskManager: UPDATE(16872) addTask() - Adding task to queue: Disconnect(CREATED <no_name>_58D7 21781184 )



  • I take it you enabled the connection bug fix via a custom BondFilter?

    So this is the logic path:

    • Device is in a disconnected state, and is requested to bond.
    • If the bond succeeds, we check the native state of the device (it should be disconnected). If it is connected, then we deem the hack fix necessary.
    • SB checks the bondfilter response to see if it should perform the fix, then the following if true
    • Device calls unbond
    • Device calls bond
    • Device calls connect
    • Device calls disconnect

    So basically, it unbonds, rebonds, connects, then disconnects. From then on, it was found that the state would act as expected. It's really a convoluted solution, which is why it's off by default.

    So in your case it seems something went wrong during the bug fix process. Do you have earlier logs from the timeout?



  • @ryanbis said in ConnectionBugHack:

    So in your case it seems something went wrong during the bug fix process. Do you have earlier logs from the timeout?

    The customBondFilter is not set.
    I have set autoBondFixes to false.
    Since the target device uses passkey authentication, I don't want it to unbond every time it is disconnected.

    I am using the following code to bond, connect and it happens every time on Google Pixel3 and other smartphones.

    public void newBondV2(BleDevice device) {
        device.bond(bondEvent -> {
            if (bondEvent.wasSuccess()) {
                newConnectV2(device);
            } else {
                registerFailed(device);
            }
        });
    }
    
    private void newConnectV2(BleDevice device) {
        device.connect(connectEvent -> {
            if (connectEvent.wasSuccess()) {
                newRegisterV2(device);
            } else {
                registerFailed(device);
            }
        });
    }
    


  • If you're not setting a custom BondFilter, then something else is going on. The connection bug fix should only happen if you set a custom BondFilter, the DefaultBondFilter doesn't run the connection bug fix.

    @teruyama said in ConnectionBugHack:

    The customBondFilter is not set.
    I have set autoBondFixes to false.
    Since the target device uses passkey authentication, I don't want it to unbond every time it is disconnected.

    I am using the following code to bond, connect and it happens every time on Google Pixel3 and other smartphones.

    I assume you are referring to the bondFilter field in BleDeviceConfig/BleManageConfig as there is no customBondFilter field.
    Are you seeing device get unbonded when you disconnect? This shouldn't happen in normal circumstances.
    As far as not re-bonding, I wish you well. There are some devices (many Sony, and Motorola devices) that don't handle bond credentials very well. I'm hoping for you sake that they handle it better when a pin code is required.

    Have you changed any settings in BleDeviceConfig/BleManagerConfig? If so, please post what they are.