Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit daae184a authored by Jacky Cheung's avatar Jacky Cheung
Browse files

DO NOT MERGE ANYWHERE Mark AutoConnParamUpdateAddr on first auto connection param update

In the case that AutoConnParamUpdateAddr is missing, the first LE address
that performs the connection parameter update is inferred as the companion.
The address is recorded in AutoConnParamUpdateAddr.

BUG: 34693438

Change-Id: I2a6e0b10a4debe1e5f36052f67864854da0b3e47
parent 2ad75128
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -302,14 +302,19 @@ static void maybe_enable_auto_connection_param_update(const bt_bdaddr_t *bd_addr
    {
        bdstr_t bdstr;
        int bdstr_size = sizeof(bdstr);
        if (btif_config_get_str("Adapter", "AutoConnParamUpdateAddr", bdstr, &bdstr_size))
        {
            bt_bdaddr_t auto_update_addr;
            string_to_bdaddr(bdstr, &auto_update_addr);
            bdcpy(auto_conn_param_update_cb.device_address.address, auto_update_addr.address);
            LOG_INFO(LOG_TAG, "%s auto connection param update for address: %s", __FUNCTION__, bdstr);
        /*
         * If AutoConnParamUpdateAddr is not set from bonding, infer the first LE address performing
         * connection parameter update as the companion.
         */
        if (!btif_config_get_str("Adapter", "AutoConnParamUpdateAddr", bdstr, &bdstr_size)) {
            bdaddr_to_string(bd_addr, bdstr, bdstr_size);
            btif_config_set_str("Adapter", "AutoConnParamUpdateAddr", bdstr);
            LOG_INFO(LOG_TAG, "%s force set AutoConnParamUpdateAddr: %s", __FUNCTION__, bdstr);
        }

        bdcpy(auto_conn_param_update_cb.device_address.address, bd_addr->address);
        auto_conn_param_update_cb.is_auto_update_address_known = true;
        LOG_INFO(LOG_TAG, "%s auto connection param update for address: %s", __FUNCTION__, bdstr);
    }

    /* If the address matches the auto update address, store the connection parameter value */