OSDN Git Service

Streamline conditional stack/btm/btm_ble::btm_ble_connected
authorChris Manton <cmanton@google.com>
Tue, 22 Sep 2020 02:09:34 +0000 (19:09 -0700)
committerChris Manton <cmanton@google.com>
Wed, 7 Oct 2020 22:26:45 +0000 (22:26 +0000)
Towards readable code

Bug: 163134718
Tag: #refactor
Test: act.py -tc BleCocTest
Test: ble paired 2 phones
Test: classic paired Bose SoundLink

Change-Id: I908ff98f333e173762d25b1e6820db7a433af3af

stack/btm/btm_ble.cc

index 888077a..2f93333 100644 (file)
@@ -1747,9 +1747,9 @@ void btm_ble_connected(const RawAddress& bda, uint16_t handle, uint8_t enc_mode,
 
   if (!addr_matched) {
     p_dev_rec->ble.active_addr_type = tBTM_SEC_BLE::BTM_BLE_ADDR_PSEUDO;
-  }
-  if (!addr_matched && p_dev_rec->ble.ble_addr_type == BLE_ADDR_RANDOM) {
-    p_dev_rec->ble.cur_rand_addr = bda;
+    if (p_dev_rec->ble.ble_addr_type == BLE_ADDR_RANDOM) {
+      p_dev_rec->ble.cur_rand_addr = bda;
+    }
   }
   btm_cb.ble_ctr_cb.inq_var.directed_conn = BTM_BLE_ADV_IND_EVT;
 }