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

Commit 02c3ba7a authored by Jacky Cheung's avatar Jacky Cheung Committed by Android (Google) Code Review
Browse files

Merge "DO NOT MERGE ANYWHERE Add Wear-specific feature to override LE IO capability" into cw-f-dev

parents 504e1992 1d1fee9a
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -24,6 +24,9 @@
#include "bta_dm_ci.h"
#include "bt_utils.h"
#include "btif_dm.h"
#if (defined WEAR_LE_IO_CAP_OVERRIDE && WEAR_LE_IO_CAP_OVERRIDE == TRUE)
#include "btif_storage.h"
#endif
#if (defined BLE_INCLUDED && BLE_INCLUDED == TRUE)
#include "bte_appl.h"

@@ -402,7 +405,24 @@ void bta_dm_co_ble_io_req(BD_ADDR bd_addr, tBTA_IO_CAP *p_io_cap,
                          tBTA_LE_KEY_TYPE  *p_resp_key )
{
    UNUSED(bd_addr);
    /* Retrieve the properties from file system if possible */


#if (defined WEAR_LE_IO_CAP_OVERRIDE && WEAR_LE_IO_CAP_OVERRIDE == TRUE)
    /*
     * Note: This is a Wear-specific feature for iOS pairing.
     *
     * Set WearLeIoCap config to force local IO capability to be BTM_IO_CAP_NONE
     * (No input, no output) for the first bond creation, that indirectly
     * triggers Just Works pairing.
     */
    if (btif_storage_get_num_bonded_devices() == 0)
        bte_appl_cfg.ble_io_cap = BTM_IO_CAP_NONE;
#endif

    /* For certification testing purpose, LE IO capability can also be specified with
     * "PTS_SmpOptions" in the BT stack configuration file (i.e. bt_stack.conf).
     * Note that if "PTS_SmpOptions" is set, it could override IO capability set above.
     */
    tBTE_APPL_CFG nv_config;
    if(btif_dm_get_smp_config(&nv_config))
        bte_appl_cfg = nv_config;
+10 −0
Original line number Diff line number Diff line
@@ -274,6 +274,16 @@ bt_status_t btif_storage_remove_hid_info(bt_bdaddr_t *remote_bd_addr);
*******************************************************************************/
BOOLEAN btif_storage_is_restricted_device(const bt_bdaddr_t *remote_bd_addr);

/*******************************************************************************
**
** Function         btif_storage_get_num_bonded_devices
**
** Description      BTIF storage API - Gets the number of bonded devices
**
** Returns          the number of bonded devices
**
*******************************************************************************/
int btif_storage_get_num_bonded_devices(void);
#if (BLE_INCLUDED == TRUE)
bt_status_t btif_storage_add_ble_bonding_key( bt_bdaddr_t *remote_bd_addr,
                                              char *key,
+15 −0
Original line number Diff line number Diff line
@@ -1420,6 +1420,21 @@ bt_status_t btif_storage_remove_hid_info(bt_bdaddr_t *remote_bd_addr)
    return BT_STATUS_SUCCESS;
}

/*******************************************************************************
**
** Function         btif_storage_get_num_bonded_devices
**
** Description      BTIF storage API - Gets the number of bonded devices
**
** Returns          the number of bonded devices
**
*******************************************************************************/
int btif_storage_get_num_bonded_devices(void) {
    btif_bonded_devices_t bonded_devices;
    btif_in_fetch_bonded_devices(&bonded_devices, 0);
    return bonded_devices.num_devices;
}

/*******************************************************************************
**
** Function         btif_storage_read_hl_apps_cb
+11 −0
Original line number Diff line number Diff line
@@ -1555,4 +1555,15 @@ The maximum number of payload octets that the local device can receive in a sing

#include "bt_trace.h"

/******************************************************************************
**
** Wear
**
******************************************************************************/

/* Enable/disable LE IO capability overriding to no-input-no-output on first bond */
#ifndef WEAR_LE_IO_CAP_OVERRIDE
#define WEAR_LE_IO_CAP_OVERRIDE FALSE
#endif

#endif /* BT_TARGET_H */