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

Commit 86ba32c0 authored by Hemant Gupta's avatar Hemant Gupta Committed by Andre Eisenbach
Browse files

HID: Allow reconnection from Host on paired HID Devices.

Host can send connection request when paired HID device
is in disconnected state. We are not checking the
NORMALLY_CONNECTABLE flags from sdp record, and by default
sending this request from host, for subsequent user initiated
connection to paired remote HID Devices.
If the remote HID is in page scan mode, it will get connected
and if not, connection will fail after retrying until
HID_HOST_MAX_CONN_RETRY times.

Without this patch, if remote hid device sdp record shows that
device's NORMALLY_CONNECTABLE flag is false, host will not be
able to create outgoing connection to remote device even if the
device is in pairing mode until device is unpaired giving bad
user experience.

Bug: 22028876
Change-Id: I2b3c5c25dc7b08ab6ed0c3667897e5ea0f05f914
parent 67a15bf9
Loading
Loading
Loading
Loading
+6 −16
Original line number Diff line number Diff line
@@ -652,22 +652,12 @@ bt_status_t btif_hh_connect(bt_bdaddr_t *bd_addr)
        }
    }

    if (added_dev == NULL ||
        (added_dev->attr_mask & HID_NORMALLY_CONNECTABLE) != 0 ||
        (added_dev->attr_mask & HID_RECONN_INIT) == 0)
    {
    /* Not checking the NORMALLY_Connectible flags from sdp record, and anyways sending this
     request from host, for subsequent user initiated connection. If the remote is not in
     pagescan mode, we will do 2 retries to connect before giving up */
    tBTA_SEC sec_mask = BTUI_HH_SECURITY;
    btif_hh_cb.status = BTIF_HH_DEV_CONNECTING;
        BD_ADDR *bda = (BD_ADDR*)bd_addr;
    BTA_HhOpen(*bda, BTA_HH_PROTO_RPT_MODE, sec_mask);
    }
    else
    {
        // This device shall be connected from the host side.
        BTIF_TRACE_ERROR("%s: Error, device %s can only be reconnected from device side",
             __FUNCTION__, bda_str);
        return BT_STATUS_FAIL;
    }

    HAL_CBACK(bt_hh_callbacks, connection_state_cb, bd_addr, BTHH_CONN_STATE_CONNECTING);
    return BT_STATUS_SUCCESS;