Remove legacy BTM_ReadTxPower
Bug: 331817295
Test: m com.android.bt
Flag: EXEMPT, dead code removal
Change-Id: Ie4c6ad67f6f682ec0b14bba52ae84581431183d3
diff --git a/system/stack/acl/btm_acl.cc b/system/stack/acl/btm_acl.cc
index 00f8b10..0ac0b89 100644
--- a/system/stack/acl/btm_acl.cc
+++ b/system/stack/acl/btm_acl.cc
@@ -150,7 +150,6 @@
static void btm_process_remote_ext_features(tACL_CONN* p_acl_cb, uint8_t max_page_number);
static void btm_read_remote_ext_features(uint16_t handle, uint8_t page_number);
static void btm_read_rssi_timeout(void* data);
-static void btm_read_tx_power_timeout(void* data);
static void btm_set_link_policy(tACL_CONN* conn, tLINK_POLICY policy);
static void check_link_policy(tLINK_POLICY* settings);
@@ -1572,135 +1571,6 @@
/*******************************************************************************
*
- * Function BTM_ReadTxPower
- *
- * Description This function is called to read the current
- * TX power of the connection. The tx power level results
- * are returned in the callback.
- * (tBTM_RSSI_RESULT)
- *
- * Returns tBTM_STATUS::BTM_CMD_STARTED if successfully initiated or error code
- *
- ******************************************************************************/
-tBTM_STATUS BTM_ReadTxPower(const RawAddress& remote_bda, tBT_TRANSPORT transport,
- tBTM_CMPL_CB* p_cb) {
- tACL_CONN* p;
-#define BTM_READ_RSSI_TYPE_CUR 0x00
-#define BTM_READ_RSSI_TYPE_MAX 0X01
-
- log::verbose("RemBdAddr: {}", remote_bda);
-
- /* If someone already waiting on the version, do not allow another */
- if (btm_cb.devcb.p_tx_power_cmpl_cb) {
- return tBTM_STATUS::BTM_BUSY;
- }
-
- p = internal_.btm_bda_to_acl(remote_bda, transport);
- if (p != (tACL_CONN*)NULL) {
- btm_cb.devcb.p_tx_power_cmpl_cb = p_cb;
- alarm_set_on_mloop(btm_cb.devcb.read_tx_power_timer, BTM_DEV_REPLY_TIMEOUT_MS,
- btm_read_tx_power_timeout, NULL);
-
- if (p->link_spec.transport == BT_TRANSPORT_LE) {
- btm_cb.devcb.read_tx_pwr_addr = remote_bda;
- btsnd_hcic_ble_read_adv_chnl_tx_power();
- } else {
- btsnd_hcic_read_tx_power(p->hci_handle, BTM_READ_RSSI_TYPE_CUR);
- }
-
- return tBTM_STATUS::BTM_CMD_STARTED;
- }
-
- log::warn("Unable to find active acl");
-
- /* If here, no BD Addr found */
- return tBTM_STATUS::BTM_UNKNOWN_ADDR;
-}
-
-/*******************************************************************************
- *
- * Function btm_read_tx_power_timeout
- *
- * Description Callback when reading the tx power times out.
- *
- * Returns void
- *
- ******************************************************************************/
-void btm_read_tx_power_timeout(void* /* data */) {
- tBTM_CMPL_CB* p_cb = btm_cb.devcb.p_tx_power_cmpl_cb;
- btm_cb.devcb.p_tx_power_cmpl_cb = NULL;
- if (p_cb) {
- (*p_cb)((void*)NULL);
- }
-}
-
-/*******************************************************************************
- *
- * Function btm_read_tx_power_complete
- *
- * Description This function is called when the command complete message
- * is received from the HCI for the read tx power request.
- *
- * Returns void
- *
- ******************************************************************************/
-void btm_read_tx_power_complete(uint8_t* p, uint16_t evt_len, bool is_ble) {
- tBTM_CMPL_CB* p_cb = btm_cb.devcb.p_tx_power_cmpl_cb;
- tBTM_TX_POWER_RESULT result;
-
- alarm_cancel(btm_cb.devcb.read_tx_power_timer);
- btm_cb.devcb.p_tx_power_cmpl_cb = NULL;
-
- /* If there was a registered callback, call it */
- if (p_cb) {
- if (evt_len < 1) {
- goto err_out;
- }
-
- STREAM_TO_UINT8(result.hci_status, p);
-
- if (result.hci_status == HCI_SUCCESS) {
- result.status = tBTM_STATUS::BTM_SUCCESS;
-
- if (!is_ble) {
- uint16_t handle;
-
- if (evt_len < 4) {
- goto err_out;
- }
-
- STREAM_TO_UINT16(handle, p);
- STREAM_TO_UINT8(result.tx_power, p);
-
- tACL_CONN* p_acl_cb = internal_.acl_get_connection_from_handle(handle);
- if (p_acl_cb != nullptr) {
- result.rem_bda = p_acl_cb->link_spec.addrt.bda;
- }
- } else {
- if (evt_len < 2) {
- goto err_out;
- }
-
- STREAM_TO_UINT8(result.tx_power, p);
- result.rem_bda = btm_cb.devcb.read_tx_pwr_addr;
- }
- log::debug("Transmit power complete: tx_power:{} hci status:{}", result.tx_power,
- hci_error_code_text(static_cast<tHCI_STATUS>(result.hci_status)));
- } else {
- result.status = tBTM_STATUS::BTM_ERR_PROCESSING;
- }
-
- (*p_cb)(&result);
- }
-
- return;
-
-err_out:
- log::error("Bogus event packet, too short");
-}
-
-/*******************************************************************************
- *
* Function btm_read_rssi_timeout
*
* Description Callback when reading the RSSI times out.
diff --git a/system/stack/btm/btm_int_types.h b/system/stack/btm/btm_int_types.h
index 1c391b1..69576219 100644
--- a/system/stack/btm/btm_int_types.h
+++ b/system/stack/btm/btm_int_types.h
@@ -57,9 +57,6 @@
tBTM_CMPL_CB* p_automatic_flush_timeout_cmpl_cb; /* Callback function to be */
/* called when read Automatic Flush Timeout function completes */
- alarm_t* read_tx_power_timer; /* Read tx power timer */
- tBTM_CMPL_CB* p_tx_power_cmpl_cb; /* Callback function to be called */
-
DEV_CLASS dev_class; /* Local device class */
tBTM_CMPL_CB* p_le_test_cmd_cmpl_cb; /* Callback function to be called when
@@ -70,13 +67,11 @@
void Init() {
read_rssi_timer = alarm_new("btm.read_rssi_timer");
read_automatic_flush_timeout_timer = alarm_new("btm.read_automatic_flush_timeout_timer");
- read_tx_power_timer = alarm_new("btm.read_tx_power_timer");
}
void Free() {
alarm_free(read_rssi_timer);
alarm_free(read_automatic_flush_timeout_timer);
- alarm_free(read_tx_power_timer);
}
} tBTM_DEVCB;
diff --git a/system/stack/btu/btu_hcif.cc b/system/stack/btu/btu_hcif.cc
index fbcec2b..92c6aee 100644
--- a/system/stack/btu/btu_hcif.cc
+++ b/system/stack/btu/btu_hcif.cc
@@ -904,10 +904,6 @@
btm_read_automatic_flush_timeout_complete(p);
break;
- case HCI_READ_TRANSMIT_POWER_LEVEL:
- btm_read_tx_power_complete(p, evt_len, false);
- break;
-
case HCI_CREATE_CONNECTION_CANCEL:
btu_hcif_create_conn_cancel_complete(p, evt_len);
break;
@@ -923,10 +919,6 @@
case HCI_READ_INQ_TX_POWER_LEVEL:
break;
- case HCI_BLE_READ_ADV_CHNL_TX_POWER:
- btm_read_tx_power_complete(p, evt_len, true);
- break;
-
case HCI_BLE_WRITE_ADV_ENABLE:
btm_ble_write_adv_enable_complete(p, evt_len);
break;
diff --git a/system/stack/hcic/hciblecmds.cc b/system/stack/hcic/hciblecmds.cc
index 27be452..58da6c8 100644
--- a/system/stack/hcic/hciblecmds.cc
+++ b/system/stack/hcic/hciblecmds.cc
@@ -134,18 +134,6 @@
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
-void btsnd_hcic_ble_read_adv_chnl_tx_power(void) {
- BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
- uint8_t* pp = (uint8_t*)(p + 1);
-
- p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD;
- p->offset = 0;
-
- UINT16_TO_STREAM(pp, HCI_BLE_READ_ADV_CHNL_TX_POWER);
- UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_READ_CMD);
-
- btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
-}
void btsnd_hcic_ble_set_adv_data(uint8_t data_len, uint8_t* p_data) {
BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
diff --git a/system/stack/hcic/hcicmds.cc b/system/stack/hcic/hcicmds.cc
index 0ceeba7..1284cff 100644
--- a/system/stack/hcic/hcicmds.cc
+++ b/system/stack/hcic/hcicmds.cc
@@ -1102,22 +1102,6 @@
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
-void btsnd_hcic_read_tx_power(uint16_t handle, uint8_t type) {
- BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
- uint8_t* pp = (uint8_t*)(p + 1);
-
- p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_TX_POWER;
- p->offset = 0;
-
- UINT16_TO_STREAM(pp, HCI_READ_TRANSMIT_POWER_LEVEL);
- UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_READ_TX_POWER);
-
- UINT16_TO_STREAM(pp, handle);
- UINT8_TO_STREAM(pp, type);
-
- btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
-}
-
void btsnd_hcic_write_link_super_tout(uint16_t handle, uint16_t timeout) {
BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE);
uint8_t* pp = (uint8_t*)(p + 1);
diff --git a/system/stack/include/acl_api.h b/system/stack/include/acl_api.h
index f53c126..1c40287 100644
--- a/system/stack/include/acl_api.h
+++ b/system/stack/include/acl_api.h
@@ -131,25 +131,6 @@
/*******************************************************************************
*
- * Function BTM_ReadTxPower
- *
- * Description This function is called to read the current connection
- * TX power of the connection. The TX power level results
- * are returned in the callback.
- * (tBTM_RSSI_RESULT)
- *
- * Returns tBTM_STATUS::BTM_CMD_STARTED if command issued to controller.
- * tBTM_STATUS::BTM_NO_RESOURCES if memory couldn't be allocated to issue
- * the command
- * tBTM_STATUS::BTM_UNKNOWN_ADDR if no active link with bd addr specified
- * tBTM_STATUS::BTM_BUSY if command is already in progress
- *
- ******************************************************************************/
-tBTM_STATUS BTM_ReadTxPower(const RawAddress& remote_bda, tBT_TRANSPORT transport,
- tBTM_CMPL_CB* p_cb);
-
-/*******************************************************************************
- *
* Function BTM_GetNumAclLinks
*
* Description This function is called to count the number of
diff --git a/system/stack/include/acl_api_types.h b/system/stack/include/acl_api_types.h
index 1ff1c6a..0bf102a 100644
--- a/system/stack/include/acl_api_types.h
+++ b/system/stack/include/acl_api_types.h
@@ -54,16 +54,6 @@
uint16_t automatic_flush_timeout;
} tBTM_AUTOMATIC_FLUSH_TIMEOUT_RESULT;
-/* Structure returned with read current TX power event (in tBTM_CMPL_CB callback
- * function) in response to BTM_ReadTxPower call.
- */
-typedef struct {
- tBTM_STATUS status;
- uint8_t hci_status;
- RawAddress rem_bda;
- int8_t tx_power;
-} tBTM_TX_POWER_RESULT;
-
/* Structure returned with read link quality event (in tBTM_CMPL_CB callback
* function) in response to BTM_ReadLinkQuality call.
*/
diff --git a/system/stack/include/acl_hci_link_interface.h b/system/stack/include/acl_hci_link_interface.h
index 67019c6..7662edb 100644
--- a/system/stack/include/acl_hci_link_interface.h
+++ b/system/stack/include/acl_hci_link_interface.h
@@ -50,7 +50,6 @@
void btm_read_remote_version_complete(tHCI_STATUS status, uint16_t handle, uint8_t lmp_version,
uint16_t manufacturer, uint16_t lmp_subversion);
void btm_read_rssi_complete(uint8_t* p, uint16_t evt_len);
-void btm_read_tx_power_complete(uint8_t* p, uint16_t evt_len, bool is_ble);
void acl_rcv_acl_data(BT_HDR* p_msg);
void acl_packets_completed(uint16_t handle, uint16_t num_packets);
diff --git a/system/stack/include/hcimsgs.h b/system/stack/include/hcimsgs.h
index 8164273..e7bd86c 100644
--- a/system/stack/include/hcimsgs.h
+++ b/system/stack/include/hcimsgs.h
@@ -196,8 +196,6 @@
void btsnd_hcic_write_auto_flush_tout(uint16_t handle,
uint16_t timeout); /* Write Retransmit Timeout */
-void btsnd_hcic_read_tx_power(uint16_t handle, uint8_t type); /* Read Tx Power */
-
/* Write Link Supervision Timeout */
void btsnd_hcic_write_link_super_tout(uint16_t handle, uint16_t timeout);
/* Write Link Supervision Timeout */
@@ -258,8 +256,6 @@
const RawAddress& direct_bda, uint8_t channel_map,
uint8_t adv_filter_policy);
-void btsnd_hcic_ble_read_adv_chnl_tx_power(void);
-
void btsnd_hcic_ble_set_adv_data(uint8_t data_len, uint8_t* p_data);
void btsnd_hcic_ble_set_adv_enable(uint8_t adv_enable);
diff --git a/system/test/mock/mock_stack_acl.cc b/system/test/mock/mock_stack_acl.cc
index fdac3fc..3aa5326 100644
--- a/system/test/mock/mock_stack_acl.cc
+++ b/system/test/mock/mock_stack_acl.cc
@@ -65,7 +65,6 @@
struct acl_refresh_remote_address acl_refresh_remote_address;
struct acl_set_peer_le_features_from_handle acl_set_peer_le_features_from_handle;
struct btm_acl_for_bda btm_acl_for_bda;
-struct BTM_ReadTxPower BTM_ReadTxPower;
struct BTM_SetLinkSuperTout BTM_SetLinkSuperTout;
struct btm_remove_acl btm_remove_acl;
struct btm_get_acl_disc_reason_code btm_get_acl_disc_reason_code;
@@ -104,7 +103,6 @@
struct btm_read_remote_ext_features_failed btm_read_remote_ext_features_failed;
struct btm_read_remote_version_complete btm_read_remote_version_complete;
struct btm_read_rssi_complete btm_read_rssi_complete;
-struct btm_read_tx_power_complete btm_read_tx_power_complete;
struct btm_rejectlist_role_change_device btm_rejectlist_role_change_device;
struct btm_set_packet_types_from_address btm_set_packet_types_from_address;
struct on_acl_br_edr_connected on_acl_br_edr_connected;
@@ -201,11 +199,6 @@
inc_func_call_count(__func__);
return test::mock::stack_acl::btm_acl_for_bda(bd_addr, transport);
}
-tBTM_STATUS BTM_ReadTxPower(const RawAddress& remote_bda, tBT_TRANSPORT transport,
- tBTM_CMPL_CB* p_cb) {
- inc_func_call_count(__func__);
- return test::mock::stack_acl::BTM_ReadTxPower(remote_bda, transport, p_cb);
-}
tBTM_STATUS BTM_SetLinkSuperTout(const RawAddress& remote_bda, uint16_t timeout) {
inc_func_call_count(__func__);
return test::mock::stack_acl::BTM_SetLinkSuperTout(remote_bda, timeout);
@@ -364,10 +357,6 @@
inc_func_call_count(__func__);
test::mock::stack_acl::btm_read_rssi_complete(p, evt_len);
}
-void btm_read_tx_power_complete(uint8_t* p, uint16_t evt_len, bool is_ble) {
- inc_func_call_count(__func__);
- test::mock::stack_acl::btm_read_tx_power_complete(p, evt_len, is_ble);
-}
void btm_rejectlist_role_change_device(const RawAddress& bd_addr, uint8_t hci_status) {
inc_func_call_count(__func__);
test::mock::stack_acl::btm_rejectlist_role_change_device(bd_addr, hci_status);
diff --git a/system/test/mock/mock_stack_acl.h b/system/test/mock/mock_stack_acl.h
index 80b3456..c2d460e 100644
--- a/system/test/mock/mock_stack_acl.h
+++ b/system/test/mock/mock_stack_acl.h
@@ -232,20 +232,6 @@
}
};
extern struct btm_acl_for_bda btm_acl_for_bda;
-// Name: BTM_ReadTxPower
-// Params: const RawAddress& remote_bda, tBT_TRANSPORT transport,
-// tBTM_CMPL_CB* p_cb Returns: tBTM_STATUS
-struct BTM_ReadTxPower {
- std::function<tBTM_STATUS(const RawAddress& remote_bda, tBT_TRANSPORT transport,
- tBTM_CMPL_CB* p_cb)>
- body{[](const RawAddress& /* remote_bda */, tBT_TRANSPORT /* transport */,
- tBTM_CMPL_CB* /* p_cb */) { return tBTM_STATUS::BTM_SUCCESS; }};
- tBTM_STATUS operator()(const RawAddress& remote_bda, tBT_TRANSPORT transport,
- tBTM_CMPL_CB* p_cb) {
- return body(remote_bda, transport, p_cb);
- }
-};
-extern struct BTM_ReadTxPower BTM_ReadTxPower;
// Name: BTM_SetLinkSuperTout
// Params: const RawAddress& remote_bda, uint16_t timeout
// Returns: tBTM_STATUS
@@ -622,15 +608,6 @@
void operator()(uint8_t* p, uint16_t evt_len) { body(p, evt_len); }
};
extern struct btm_read_rssi_complete btm_read_rssi_complete;
-// Name: btm_read_tx_power_complete
-// Params: uint8_t* p, bool is_ble
-// Returns: void
-struct btm_read_tx_power_complete {
- std::function<void(uint8_t* p, uint16_t evt_len, bool is_ble)> body{
- [](uint8_t* /* p */, uint16_t /* evt_len */, bool /* is_ble */) { ; }};
- void operator()(uint8_t* p, uint16_t evt_len, bool is_ble) { body(p, evt_len, is_ble); }
-};
-extern struct btm_read_tx_power_complete btm_read_tx_power_complete;
// Name: btm_rejectlist_role_change_device
// Params: const RawAddress& bd_addr, uint8_t hci_status
// Returns: void
diff --git a/system/test/mock/mock_stack_hcic_hciblecmds.cc b/system/test/mock/mock_stack_hcic_hciblecmds.cc
index 0a130b2..3757f95 100644
--- a/system/test/mock/mock_stack_hcic_hciblecmds.cc
+++ b/system/test/mock/mock_stack_hcic_hciblecmds.cc
@@ -51,7 +51,6 @@
struct btsnd_hcic_ble_periodic_advertising_terminate_sync
btsnd_hcic_ble_periodic_advertising_terminate_sync;
struct btsnd_hcic_ble_rand btsnd_hcic_ble_rand;
-struct btsnd_hcic_ble_read_adv_chnl_tx_power btsnd_hcic_ble_read_adv_chnl_tx_power;
struct btsnd_hcic_ble_read_remote_feat btsnd_hcic_ble_read_remote_feat;
struct btsnd_hcic_ble_read_resolvable_addr_peer btsnd_hcic_ble_read_resolvable_addr_peer;
struct btsnd_hcic_ble_receiver_test btsnd_hcic_ble_receiver_test;
@@ -159,10 +158,6 @@
inc_func_call_count(__func__);
test::mock::stack_hcic_hciblecmds::btsnd_hcic_ble_rand(std::move(cb));
}
-void btsnd_hcic_ble_read_adv_chnl_tx_power(void) {
- inc_func_call_count(__func__);
- test::mock::stack_hcic_hciblecmds::btsnd_hcic_ble_read_adv_chnl_tx_power();
-}
void btsnd_hcic_ble_read_remote_feat(uint16_t handle) {
inc_func_call_count(__func__);
test::mock::stack_hcic_hciblecmds::btsnd_hcic_ble_read_remote_feat(handle);
diff --git a/system/test/mock/mock_stack_hcic_hciblecmds.h b/system/test/mock/mock_stack_hcic_hciblecmds.h
index cbecbc4..6063692 100644
--- a/system/test/mock/mock_stack_hcic_hciblecmds.h
+++ b/system/test/mock/mock_stack_hcic_hciblecmds.h
@@ -210,15 +210,6 @@
};
extern struct btsnd_hcic_ble_rand btsnd_hcic_ble_rand;
-// Name: btsnd_hcic_ble_read_adv_chnl_tx_power
-// Params: void
-// Return: void
-struct btsnd_hcic_ble_read_adv_chnl_tx_power {
- std::function<void(void)> body{[](void) {}};
- void operator()(void) { body(); }
-};
-extern struct btsnd_hcic_ble_read_adv_chnl_tx_power btsnd_hcic_ble_read_adv_chnl_tx_power;
-
// Name: btsnd_hcic_ble_read_remote_feat
// Params: uint16_t handle
// Return: void
diff --git a/system/test/mock/mock_stack_hcic_hcicmds.cc b/system/test/mock/mock_stack_hcic_hcicmds.cc
index 8a3bce3..da51647 100644
--- a/system/test/mock/mock_stack_hcic_hcicmds.cc
+++ b/system/test/mock/mock_stack_hcic_hcicmds.cc
@@ -60,7 +60,6 @@
struct btsnd_hcic_read_name btsnd_hcic_read_name;
struct btsnd_hcic_read_rmt_clk_offset btsnd_hcic_read_rmt_clk_offset;
struct btsnd_hcic_read_rssi btsnd_hcic_read_rssi;
-struct btsnd_hcic_read_tx_power btsnd_hcic_read_tx_power;
struct btsnd_hcic_reject_conn btsnd_hcic_reject_conn;
struct btsnd_hcic_reject_esco_conn btsnd_hcic_reject_esco_conn;
struct btsnd_hcic_rem_oob_neg_reply btsnd_hcic_rem_oob_neg_reply;
@@ -209,10 +208,6 @@
inc_func_call_count(__func__);
test::mock::stack_hcic_hcicmds::btsnd_hcic_read_rssi(handle);
}
-void btsnd_hcic_read_tx_power(uint16_t handle, uint8_t type) {
- inc_func_call_count(__func__);
- test::mock::stack_hcic_hcicmds::btsnd_hcic_read_tx_power(handle, type);
-}
void btsnd_hcic_reject_conn(const RawAddress& dest, uint8_t reason) {
inc_func_call_count(__func__);
test::mock::stack_hcic_hcicmds::btsnd_hcic_reject_conn(dest, reason);
diff --git a/system/test/mock/mock_stack_hcic_hcicmds.h b/system/test/mock/mock_stack_hcic_hcicmds.h
index d098e6a..fbd788f 100644
--- a/system/test/mock/mock_stack_hcic_hcicmds.h
+++ b/system/test/mock/mock_stack_hcic_hcicmds.h
@@ -300,16 +300,6 @@
};
extern struct btsnd_hcic_read_rssi btsnd_hcic_read_rssi;
-// Name: btsnd_hcic_read_tx_power
-// Params: uint16_t handle, uint8_t type
-// Return: void
-struct btsnd_hcic_read_tx_power {
- std::function<void(uint16_t handle, uint8_t type)> body{
- [](uint16_t /* handle */, uint8_t /* type */) {}};
- void operator()(uint16_t handle, uint8_t type) { body(handle, type); }
-};
-extern struct btsnd_hcic_read_tx_power btsnd_hcic_read_tx_power;
-
// Name: btsnd_hcic_reject_conn
// Params: const RawAddress& dest, uint8_t reason
// Return: void