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

Commit abfd66a9 authored by Wei-Luan Wang's avatar Wei-Luan Wang
Browse files

Migrate LeRandCallback to be base::OnceCallback

base::Bind and base::Callback are deprecated. Migrate the usages to
proper replacements.

The callback of LeRand is expected to be called for receiving the
resulting random number. It's called only once so it should be a
base::OnceCallback.

Bug: 272116782
Test: m .
Change-Id: I8dc78f54aae455f089bc29ee814c3e0c0635ba9e
parent be6d7ce6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4519,7 +4519,7 @@ void bta_dm_disconnect_all_acls(void) {
 ******************************************************************************/
void bta_dm_le_rand(LeRandCallback cb) {
  VLOG(1) << "bta_dm_le_rand in bta_dm_act";
  bluetooth::shim::BTM_LeRand(cb);
  bluetooth::shim::BTM_LeRand(std::move(cb));
}

/*******************************************************************************
+1 −1
Original line number Diff line number Diff line
@@ -710,7 +710,7 @@ void BTA_DmClearFilterAcceptList(void) {
 ******************************************************************************/
void BTA_DmLeRand(LeRandCallback cb) {
  APPL_TRACE_API("BTA_DmLeRand");
  do_in_main_thread(FROM_HERE, base::BindOnce(bta_dm_le_rand, cb));
  do_in_main_thread(FROM_HERE, base::BindOnce(bta_dm_le_rand, std::move(cb)));
}

/*******************************************************************************
+1 −1
Original line number Diff line number Diff line
@@ -1341,7 +1341,7 @@ void BTA_DmDisconnectAllAcls(void);
 ******************************************************************************/
void BTA_DmClearFilterAcceptList(void);

using LeRandCallback = base::Callback<void(uint64_t)>;
using LeRandCallback = base::OnceCallback<void(uint64_t)>;
/*******************************************************************************
 *
 * Function         BTA_DmLeRand
+2 −1
Original line number Diff line number Diff line
@@ -738,7 +738,8 @@ static int le_rand() {
  if (!interface_ready()) return BT_STATUS_NOT_READY;

  do_in_main_thread(
      FROM_HERE, base::BindOnce(btif_dm_le_rand, base::Bind(&le_rand_btif_cb)));
      FROM_HERE,
      base::BindOnce(btif_dm_le_rand, base::BindOnce(&le_rand_btif_cb)));
  return BT_STATUS_SUCCESS;
}

+1 −1
Original line number Diff line number Diff line
@@ -4060,7 +4060,7 @@ void btif_dm_disconnect_all_acls() {

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

void btif_dm_set_event_filter_connection_setup_all_devices() {
Loading