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

Commit d2a2927e authored by Martin Brabham's avatar Martin Brabham
Browse files

Fix suspend/resume synchronization

Bug: 189495534
Test: system/gd/cert/run --clean --topshim SuspendTest
Tag: #floss
Change-Id: I159a721786863fb5bebe8d7165808efeb287136b
parent 37e126dd
Loading
Loading
Loading
Loading
+42 −0
Original line number Original line Diff line number Diff line
@@ -676,6 +676,34 @@ void BTA_DmClearEventFilter(void) {
  do_in_main_thread(FROM_HERE, base::Bind(bta_dm_clear_event_filter));
  do_in_main_thread(FROM_HERE, base::Bind(bta_dm_clear_event_filter));
}
}


/*******************************************************************************
 *
 * Function         BTA_DmClearEventMask
 *
 * Description      This function clears the event mask
 *
 * Returns          void
 *
 ******************************************************************************/
void BTA_DmClearEventMask(void) {
  APPL_TRACE_API("BTA_DmClearEventMask");
  do_in_main_thread(FROM_HERE, base::Bind(bta_dm_clear_event_mask));
}

/*******************************************************************************
 *
 * Function         BTA_DmClearEventMask
 *
 * Description      This function clears the filter accept list
 *
 * Returns          void
 *
 ******************************************************************************/
void BTA_DmClearFilterAcceptList(void) {
  APPL_TRACE_API("BTA_DmClearFilterAcceptList");
  do_in_main_thread(FROM_HERE, base::Bind(bta_dm_clear_filter_accept_list));
}

/*******************************************************************************
/*******************************************************************************
 *
 *
 * Function         BTA_DmLeRand
 * Function         BTA_DmLeRand
@@ -690,6 +718,20 @@ void BTA_DmLeRand(LeRandCallback cb) {
  do_in_main_thread(FROM_HERE, base::Bind(bta_dm_le_rand, cb));
  do_in_main_thread(FROM_HERE, base::Bind(bta_dm_le_rand, cb));
}
}


/*******************************************************************************
 *
 * Function         BTA_DmDisconnectAllAcls
 *
 * Description      This function will disconnect all LE and Classic ACLs.
 *
 * Returns          void
 *
 ******************************************************************************/
void BTA_DmDisconnectAllAcls() {
  APPL_TRACE_API("BTA_DmLeRand");
  do_in_main_thread(FROM_HERE, base::Bind(bta_dm_disconnect_all_acls));
}

void BTA_DmSetEventFilterConnectionSetupAllDevices() {
void BTA_DmSetEventFilterConnectionSetupAllDevices() {
  APPL_TRACE_API("BTA_DmSetEventFilterConnectionSetupAllDevices");
  APPL_TRACE_API("BTA_DmSetEventFilterConnectionSetupAllDevices");
  do_in_main_thread(
  do_in_main_thread(
+33 −0
Original line number Original line Diff line number Diff line
@@ -1222,6 +1222,39 @@ extern void BTA_VendorInit(void);
 ******************************************************************************/
 ******************************************************************************/
extern void BTA_DmClearEventFilter(void);
extern void BTA_DmClearEventFilter(void);


/*******************************************************************************
 *
 * Function         BTA_DmClearEventMask
 *
 * Description      This function clears the event mask
 *
 * Returns          void
 *
 ******************************************************************************/
extern void BTA_DmClearEventMask(void);

/*******************************************************************************
 *
 * Function         BTA_DmDisconnectAllAcls
 *
 * Description      This function will disconnect all LE and Classic ACLs.
 *
 * Returns          void
 *
 ******************************************************************************/
extern void BTA_DmDisconnectAllAcls(void);

/*******************************************************************************
 *
 * Function         BTA_DmClearFilterAcceptList
 *
 * Description      This function clears the filter accept list
 *
 * Returns          void
 *
 ******************************************************************************/
extern void BTA_DmClearFilterAcceptList(void);

using LeRandCallback = base::Callback<void(uint64_t)>;
using LeRandCallback = base::Callback<void(uint64_t)>;
/*******************************************************************************
/*******************************************************************************
 *
 *
+5 −5
Original line number Original line Diff line number Diff line
@@ -3521,27 +3521,27 @@ bool btif_get_address_type(const RawAddress& bda, tBLE_ADDR_TYPE* p_addr_type) {


void btif_dm_clear_event_filter() {
void btif_dm_clear_event_filter() {
  LOG_VERBOSE("%s: called", __func__);
  LOG_VERBOSE("%s: called", __func__);
  bta_dm_clear_event_filter();
  BTA_DmClearEventFilter();
}
}


void btif_dm_clear_event_mask() {
void btif_dm_clear_event_mask() {
  LOG_VERBOSE("%s: called", __func__);
  LOG_VERBOSE("%s: called", __func__);
  bta_dm_clear_event_mask();
  BTA_DmClearEventMask();
}
}


void btif_dm_clear_filter_accept_list() {
void btif_dm_clear_filter_accept_list() {
  LOG_VERBOSE("%s: called", __func__);
  LOG_VERBOSE("%s: called", __func__);
  bta_dm_clear_filter_accept_list();
  BTA_DmClearFilterAcceptList();
}
}


void btif_dm_disconnect_all_acls() {
void btif_dm_disconnect_all_acls() {
  LOG_VERBOSE("%s: called", __func__);
  LOG_VERBOSE("%s: called", __func__);
  bta_dm_disconnect_all_acls();
  BTA_DmDisconnectAllAcls();
}
}


void btif_dm_le_rand(LeRandCallback callback) {
void btif_dm_le_rand(LeRandCallback callback) {
  LOG_VERBOSE("%s: called", __func__);
  LOG_VERBOSE("%s: called", __func__);
  bta_dm_le_rand(callback);
  BTA_DmLeRand(callback);
}
}


void btif_dm_set_event_filter_connection_setup_all_devices() {
void btif_dm_set_event_filter_connection_setup_all_devices() {
+1 −1
Original line number Original line Diff line number Diff line
@@ -797,7 +797,7 @@ impl SuspendCallback {
impl ISuspendCallback for SuspendCallback {
impl ISuspendCallback for SuspendCallback {
    // TODO(b/224606285): Implement suspend utils in btclient.
    // TODO(b/224606285): Implement suspend utils in btclient.
    fn on_callback_registered(&self, _callback_id: u32) {}
    fn on_callback_registered(&self, _callback_id: u32) {}
    fn on_suspend_ready(&self, _suspend_id: u32) {}
    fn on_suspend_ready(&self, _suspend_id: i32) {}
    fn on_resumed(&self, _suspend_id: i32) {}
    fn on_resumed(&self, _suspend_id: i32) {}
}
}


+3 −3
Original line number Original line Diff line number Diff line
@@ -1453,12 +1453,12 @@ impl ISuspend for SuspendDBus {
    }
    }


    #[dbus_method("Suspend")]
    #[dbus_method("Suspend")]
    fn suspend(&mut self, _suspend_type: SuspendType) {
    fn suspend(&mut self, _suspend_type: SuspendType, suspend_id: i32) {
        dbus_generated!()
        dbus_generated!()
    }
    }


    #[dbus_method("Resume")]
    #[dbus_method("Resume")]
    fn resume(&self) -> bool {
    fn resume(&mut self) -> bool {
        dbus_generated!()
        dbus_generated!()
    }
    }
}
}
@@ -1475,7 +1475,7 @@ impl ISuspendCallback for ISuspendCallbackDBus {
    #[dbus_method("OnCallbackRegistered")]
    #[dbus_method("OnCallbackRegistered")]
    fn on_callback_registered(&self, callback_id: u32) {}
    fn on_callback_registered(&self, callback_id: u32) {}
    #[dbus_method("OnSuspendReady")]
    #[dbus_method("OnSuspendReady")]
    fn on_suspend_ready(&self, suspend_id: u32) {}
    fn on_suspend_ready(&self, suspend_id: i32) {}
    #[dbus_method("OnResumed")]
    #[dbus_method("OnResumed")]
    fn on_resumed(&self, suspend_id: i32) {}
    fn on_resumed(&self, suspend_id: i32) {}
}
}
Loading