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

Commit 9d8e896a authored by Josh Wu's avatar Josh Wu Committed by William Escande
Browse files

gatts load bonded for service change

Prepare list of bonded devices that will need service change updates
after BT restarted.

Cherry-picked from wear os

Bug: 263323082
Bug: 162948473
Bug: 251157966
Test: atest net_test_stack
Change-Id: I7f3541a21e2c4a629498fd91d3a6438135a760e0
(cherry picked from commit 5f3719499b6ca547086d5a2ad8f6d3fca748deb3)
(cherry picked from commit 3d83a0ff)
Merged-In: I7f3541a21e2c4a629498fd91d3a6438135a760e0
parent ec97ceec
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -120,6 +120,8 @@ void bta_gatts_enable(tBTA_GATTS_CB* p_cb) {

    p_cb->enabled = true;

    gatt_load_bonded();

    if (!GATTS_NVRegister(&bta_gatts_nv_cback)) {
      LOG(ERROR) << "BTA GATTS NV register failed.";
    }
+8 −0
Original line number Diff line number Diff line
@@ -374,3 +374,11 @@ void BTA_GATTS_Close(uint16_t conn_id) {

  bta_sys_sendmsg(p_buf);
}

void BTA_GATTS_InitBonded(void) {
  LOG(INFO) << __func__;

  BT_HDR_RIGID* p_buf = (BT_HDR_RIGID*)osi_malloc(sizeof(BT_HDR_RIGID));
  p_buf->event = BTA_GATTS_API_INIT_BONDED_EVT;
  bta_sys_sendmsg(p_buf);
}
+3 −1
Original line number Diff line number Diff line
@@ -51,7 +51,9 @@ enum {
  BTA_GATTS_API_OPEN_EVT,
  BTA_GATTS_API_CANCEL_OPEN_EVT,
  BTA_GATTS_API_CLOSE_EVT,
  BTA_GATTS_API_DISABLE_EVT
  BTA_GATTS_API_DISABLE_EVT,

  BTA_GATTS_API_INIT_BONDED_EVT,
};
typedef uint16_t tBTA_GATTS_INT_EVT;

+4 −0
Original line number Diff line number Diff line
@@ -105,6 +105,10 @@ bool bta_gatts_hdl_event(BT_HDR_RIGID* p_msg) {
      break;
    }

    case BTA_GATTS_API_INIT_BONDED_EVT:
      gatt_load_bonded();
      break;

    default:
      break;
  }
+3 −0
Original line number Diff line number Diff line
@@ -999,4 +999,7 @@ extern void BTA_GATTS_CancelOpen(tGATT_IF server_if,
 ******************************************************************************/
extern void BTA_GATTS_Close(uint16_t conn_id);

// Adds bonded device for GATT server tracking service changes
extern void BTA_GATTS_InitBonded(void);

#endif /* BTA_GATT_API_H */
Loading