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

Commit dddf1151 authored by Chienyuan's avatar Chienyuan Committed by Android Build Coastguard Worker
Browse files

Do resolving list operations via handler

Bug: 226711441
Test: gd/cert/run
Tag: #refactor
Change-Id: I74a97424e93461372762cdf4a4b2bc8b9f83684e
Merged-In: I74a97424e93461372762cdf4a4b2bc8b9f83684e
(cherry picked from commit 7332df88)
(cherry picked from commit 1642ede3)
Merged-In: I74a97424e93461372762cdf4a4b2bc8b9f83684e
parent c97cda94
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -230,6 +230,11 @@ void LeAddressManager::ack_pause(LeAddressManagerCallback* callback) {
  for (auto client : registered_clients_) {
    if (client.second != ClientState::PAUSED) {
      // make sure all client paused
      if (client.second != ClientState::WAITING_FOR_PAUSE) {
        LOG_DEBUG("Trigger OnPause for client that not paused and not waiting for pause");
        client.second = ClientState::WAITING_FOR_PAUSE;
        client.first->OnPause();
      }
      return;
    }
  }
@@ -421,9 +426,9 @@ void LeAddressManager::AddDeviceToResolvingList(
  cached_commands_.push(std::move(enable));

  if (registered_clients_.empty()) {
    handle_next_command();
    handler_->BindOnceOn(this, &LeAddressManager::handle_next_command).Invoke();
  } else {
    pause_registered_clients();
    handler_->BindOnceOn(this, &LeAddressManager::pause_registered_clients).Invoke();
  }
}

@@ -452,9 +457,9 @@ void LeAddressManager::RemoveDeviceFromResolvingList(
  cached_commands_.push(std::move(enable));

  if (registered_clients_.empty()) {
    handle_next_command();
    handler_->BindOnceOn(this, &LeAddressManager::handle_next_command).Invoke();
  } else {
    pause_registered_clients();
    handler_->BindOnceOn(this, &LeAddressManager::pause_registered_clients).Invoke();
  }
}

@@ -479,7 +484,7 @@ void LeAddressManager::ClearResolvingList() {
  Command enable = {CommandType::SET_ADDRESS_RESOLUTION_ENABLE, std::move(enable_builder)};
  cached_commands_.push(std::move(enable));

  pause_registered_clients();
  handler_->BindOnceOn(this, &LeAddressManager::pause_registered_clients).Invoke();
}

template <class View>