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

Commit 9305a1f0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Do resolving list operations via handler" into tm-dev

parents a5e977d3 1642ede3
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>