OSDN Git Service

Return bool=>void stack/btm/btm_ble::BTM_SecAddBleDevice
authorChris Manton <cmanton@google.com>
Tue, 3 Nov 2020 23:29:21 +0000 (15:29 -0800)
committerChris Manton <cmanton@google.com>
Fri, 6 Nov 2020 16:37:04 +0000 (16:37 +0000)
Unnecessary level of error checking

Toward readable code

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working

Change-Id: Ia6a8ddcc4f6cc2ee2d7094a61e4818ba94989954

bta/dm/bta_dm_act.cc
main/shim/btm_api.cc
main/shim/btm_api.h
stack/btm/btm_ble.cc
stack/include/btm_ble_api.h

index 17429c6..13d77da 100644 (file)
@@ -3409,9 +3409,7 @@ void bta_dm_add_blekey(const RawAddress& bd_addr, tBTA_LE_KEY_VALUE blekey,
  ******************************************************************************/
 void bta_dm_add_ble_device(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
                            tBT_DEVICE_TYPE dev_type) {
-  if (!BTM_SecAddBleDevice(bd_addr, dev_type, addr_type)) {
-    LOG(ERROR) << "BTA_DM: Error adding BLE Device for device " << bd_addr;
-  }
+  BTM_SecAddBleDevice(bd_addr, dev_type, addr_type);
 }
 
 /*******************************************************************************
index 34e1f94..4865956 100644 (file)
@@ -908,11 +908,10 @@ uint8_t bluetooth::shim::BTM_GetEirUuidList(uint8_t* p_eir, size_t eir_len,
   return 0;
 }
 
-bool bluetooth::shim::BTM_SecAddBleDevice(const RawAddress& bd_addr,
+void bluetooth::shim::BTM_SecAddBleDevice(const RawAddress& bd_addr,
                                           tBT_DEVICE_TYPE dev_type,
                                           tBLE_ADDR_TYPE addr_type) {
   LOG_INFO("UNIMPLEMENTED %s", __func__);
-  return false;
 }
 
 bool bluetooth::shim::BTM_SecAddBleKey(const RawAddress& bd_addr,
index 127869b..7243248 100644 (file)
@@ -397,10 +397,8 @@ uint8_t BTM_GetEirUuidList(uint8_t* p_eir, size_t eir_len, uint8_t uuid_size,
  *                  dev_type         - Remote device's device type.
  *                  addr_type        - LE device address type.
  *
- * Returns          true if added OK, else false
- *
  ******************************************************************************/
-bool BTM_SecAddBleDevice(const RawAddress& bd_addr, tBT_DEVICE_TYPE dev_type,
+void BTM_SecAddBleDevice(const RawAddress& bd_addr, tBT_DEVICE_TYPE dev_type,
                          tBLE_ADDR_TYPE addr_type);
 
 /*******************************************************************************
index eab6497..4910067 100644 (file)
@@ -53,7 +53,7 @@ extern void gatt_notify_phy_updated(tGATT_STATUS status, uint16_t handle,
 /******************************************************************************/
 /* External Function to be called by other modules                            */
 /******************************************************************************/
-bool BTM_SecAddBleDevice(const RawAddress& bd_addr, tBT_DEVICE_TYPE dev_type,
+void BTM_SecAddBleDevice(const RawAddress& bd_addr, tBT_DEVICE_TYPE dev_type,
                          tBLE_ADDR_TYPE addr_type) {
   if (bluetooth::shim::is_gd_shim_enabled()) {
     return bluetooth::shim::BTM_SecAddBleDevice(bd_addr, dev_type, addr_type);
@@ -94,8 +94,6 @@ bool BTM_SecAddBleDevice(const RawAddress& bd_addr, tBT_DEVICE_TYPE dev_type,
     BTM_TRACE_DEBUG("InqDb  device_type =0x%x  addr_type=0x%x",
                     p_info->results.device_type, p_info->results.ble_addr_type);
   }
-
-  return true;
 }
 
 /*******************************************************************************
index 919c399..63e4314 100644 (file)
  *                  dev_type         - Remote device's device type.
  *                  addr_type        - LE device address type.
  *
- * Returns          true if added OK, else false
- *
  ******************************************************************************/
-extern bool BTM_SecAddBleDevice(const RawAddress& bd_addr,
+extern void BTM_SecAddBleDevice(const RawAddress& bd_addr,
                                 tBT_DEVICE_TYPE dev_type,
                                 tBLE_ADDR_TYPE addr_type);