Loading system/stack/btm/btm_ble_addr.cc +9 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ void btm_gen_resolve_paddr_low(const RawAddress& address) { p_cb->own_addr_type = BLE_ADDR_RANDOM; /* start a periodical timer to refresh random addr */ uint64_t interval_ms = BTM_BLE_PRIVATE_ADDR_INT_MS; uint64_t interval_ms = btm_get_next_private_addrress_interval_ms(); #if (BTM_BLE_CONFORMANCE_TESTING == TRUE) interval_ms = btm_cb.ble_ctr_cb.rpa_tout * 1000; #endif Loading @@ -93,6 +93,14 @@ void btm_gen_resolvable_private_addr( std::move(cb))); } uint64_t btm_get_next_private_addrress_interval_ms() { /* 7 minutes minimum, 15 minutes maximum for random address refreshing */ const uint64_t interval_min_ms = (7 * 60 * 1000); const uint64_t interval_random_part_max_ms = (8 * 60 * 1000); return interval_min_ms + std::rand() % interval_random_part_max_ms; } /******************************************************************************* * * Function btm_gen_non_resolve_paddr_cmpl Loading system/stack/btm/btm_ble_int.h +1 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,7 @@ extern void btm_gen_non_resolvable_private_addr(tBTM_BLE_ADDR_CBACK* p_cback, extern tBTM_SEC_DEV_REC* btm_ble_resolve_random_addr( const RawAddress& random_bda); extern void btm_gen_resolve_paddr_low(const RawAddress& address); extern uint64_t btm_get_next_private_addrress_interval_ms(); /* privacy function */ #if (BLE_PRIVACY_SPT == TRUE) Loading system/stack/btm/btm_ble_int_types.h +0 −3 Original line number Diff line number Diff line Loading @@ -119,9 +119,6 @@ typedef struct { #define BTM_BLE_ISVALID_PARAM(x, min, max) \ (((x) >= (min) && (x) <= (max)) || ((x) == BTM_BLE_CONN_PARAM_UNDEF)) /* 15 minutes minimum for random address refreshing */ #define BTM_BLE_PRIVATE_ADDR_INT_MS (15 * 60 * 1000) typedef struct { uint16_t discoverable_mode; uint16_t connectable_mode; Loading system/stack/btm/btm_ble_multi_adv.cc +2 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include "ble_advertiser.h" #include "ble_advertiser_hci_interface.h" #include "btm_int_types.h" #include "stack/btm/btm_ble_int.h" #include <string.h> #include <queue> Loading Loading @@ -257,7 +258,7 @@ class BleAdvertisingManagerImpl p_inst->own_address = bda; alarm_set_on_mloop(p_inst->adv_raddr_timer, BTM_BLE_PRIVATE_ADDR_INT_MS, btm_get_next_private_addrress_interval_ms(), btm_ble_adv_raddr_timer_timeout, p_inst); cb.Run(p_inst->inst_id, BTM_BLE_MULTI_ADV_SUCCESS); }, Loading system/stack/btm/btm_devctl.cc +5 −2 Original line number Diff line number Diff line Loading @@ -199,14 +199,17 @@ static void reset_complete(void* result) { l2c_link_processs_num_bufs(controller->get_acl_buffer_count_classic()); // setup the random number generator std::srand(std::time(nullptr)); #if (BLE_PRIVACY_SPT == TRUE) /* Set up the BLE privacy settings */ if (controller->supports_ble() && controller->supports_ble_privacy() && controller->get_ble_resolving_list_max_size() > 0) { btm_ble_resolving_list_init(controller->get_ble_resolving_list_max_size()); /* set the default random private address timeout */ btsnd_hcic_ble_set_rand_priv_addr_timeout(BTM_BLE_PRIVATE_ADDR_INT_MS / 1000); btsnd_hcic_ble_set_rand_priv_addr_timeout( btm_get_next_private_addrress_interval_ms() / 1000); } #endif Loading Loading
system/stack/btm/btm_ble_addr.cc +9 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ void btm_gen_resolve_paddr_low(const RawAddress& address) { p_cb->own_addr_type = BLE_ADDR_RANDOM; /* start a periodical timer to refresh random addr */ uint64_t interval_ms = BTM_BLE_PRIVATE_ADDR_INT_MS; uint64_t interval_ms = btm_get_next_private_addrress_interval_ms(); #if (BTM_BLE_CONFORMANCE_TESTING == TRUE) interval_ms = btm_cb.ble_ctr_cb.rpa_tout * 1000; #endif Loading @@ -93,6 +93,14 @@ void btm_gen_resolvable_private_addr( std::move(cb))); } uint64_t btm_get_next_private_addrress_interval_ms() { /* 7 minutes minimum, 15 minutes maximum for random address refreshing */ const uint64_t interval_min_ms = (7 * 60 * 1000); const uint64_t interval_random_part_max_ms = (8 * 60 * 1000); return interval_min_ms + std::rand() % interval_random_part_max_ms; } /******************************************************************************* * * Function btm_gen_non_resolve_paddr_cmpl Loading
system/stack/btm/btm_ble_int.h +1 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,7 @@ extern void btm_gen_non_resolvable_private_addr(tBTM_BLE_ADDR_CBACK* p_cback, extern tBTM_SEC_DEV_REC* btm_ble_resolve_random_addr( const RawAddress& random_bda); extern void btm_gen_resolve_paddr_low(const RawAddress& address); extern uint64_t btm_get_next_private_addrress_interval_ms(); /* privacy function */ #if (BLE_PRIVACY_SPT == TRUE) Loading
system/stack/btm/btm_ble_int_types.h +0 −3 Original line number Diff line number Diff line Loading @@ -119,9 +119,6 @@ typedef struct { #define BTM_BLE_ISVALID_PARAM(x, min, max) \ (((x) >= (min) && (x) <= (max)) || ((x) == BTM_BLE_CONN_PARAM_UNDEF)) /* 15 minutes minimum for random address refreshing */ #define BTM_BLE_PRIVATE_ADDR_INT_MS (15 * 60 * 1000) typedef struct { uint16_t discoverable_mode; uint16_t connectable_mode; Loading
system/stack/btm/btm_ble_multi_adv.cc +2 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include "ble_advertiser.h" #include "ble_advertiser_hci_interface.h" #include "btm_int_types.h" #include "stack/btm/btm_ble_int.h" #include <string.h> #include <queue> Loading Loading @@ -257,7 +258,7 @@ class BleAdvertisingManagerImpl p_inst->own_address = bda; alarm_set_on_mloop(p_inst->adv_raddr_timer, BTM_BLE_PRIVATE_ADDR_INT_MS, btm_get_next_private_addrress_interval_ms(), btm_ble_adv_raddr_timer_timeout, p_inst); cb.Run(p_inst->inst_id, BTM_BLE_MULTI_ADV_SUCCESS); }, Loading
system/stack/btm/btm_devctl.cc +5 −2 Original line number Diff line number Diff line Loading @@ -199,14 +199,17 @@ static void reset_complete(void* result) { l2c_link_processs_num_bufs(controller->get_acl_buffer_count_classic()); // setup the random number generator std::srand(std::time(nullptr)); #if (BLE_PRIVACY_SPT == TRUE) /* Set up the BLE privacy settings */ if (controller->supports_ble() && controller->supports_ble_privacy() && controller->get_ble_resolving_list_max_size() > 0) { btm_ble_resolving_list_init(controller->get_ble_resolving_list_max_size()); /* set the default random private address timeout */ btsnd_hcic_ble_set_rand_priv_addr_timeout(BTM_BLE_PRIVATE_ADDR_INT_MS / 1000); btsnd_hcic_ble_set_rand_priv_addr_timeout( btm_get_next_private_addrress_interval_ms() / 1000); } #endif Loading