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

Commit ef1e0371 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Merge cherrypicks of [6716922, 6716923, 6716413, 6717023, 6717024, 6716716,...

Merge cherrypicks of [6716922, 6716923, 6716413, 6717023, 6717024, 6716716, 6715859, 6717160, 6717161, 6717162, 6717163, 6716295, 6717141, 6717181, 6717183, 6717184, 6717185, 6714937, 6717028, 6716717, 6716927, 6717200, 6717029, 6717030, 6717031, 6717032, 6717033, 6716928, 6717034, 6717035, 6716929, 6717201, 6716930, 6712377, 6712378, 6716643, 6717164, 6712379] into pi-qpr3-release

Change-Id: Ida0fb2e062df664494ba6be312ae6131018fe536
parents e3ad7183 726a7ec4
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -346,9 +346,10 @@ void AvrcpService::SendMediaUpdate(bool track_changed, bool play_state,

  // This function may be called on any thread, we need to make sure that the
  // device update happens on the main thread.
  for (auto device : instance_->connection_handler_->GetListOfDevices()) {
    do_in_bta_thread(FROM_HERE, base::Bind(&Device::SendMediaUpdate,
                                           base::Unretained(device.get()),
  for (const auto& device :
       instance_->connection_handler_->GetListOfDevices()) {
    do_in_bta_thread(FROM_HERE,
                     base::Bind(&Device::SendMediaUpdate, device.get()->Get(),
                                track_changed, play_state, queue));
  }
}
@@ -361,10 +362,10 @@ void AvrcpService::SendFolderUpdate(bool available_players,
            << " uids=" << uids;

  // Ensure that the update is posted to the correct thread
  for (auto device : instance_->connection_handler_->GetListOfDevices()) {
    do_in_bta_thread(
        FROM_HERE,
        base::Bind(&Device::SendFolderUpdate, base::Unretained(device.get()),
  for (const auto& device :
       instance_->connection_handler_->GetListOfDevices()) {
    do_in_bta_thread(FROM_HERE,
                     base::Bind(&Device::SendFolderUpdate, device.get()->Get(),
                                available_players, addressed_players, uids));
  }
}
+2 −0
Original line number Diff line number Diff line
@@ -52,6 +52,8 @@ void Device::RegisterInterfaces(MediaInterface* media_interface,
  volume_interface_ = volume_interface;
}

base::WeakPtr<Device> Device::Get() { return weak_ptr_factory_.GetWeakPtr(); }

bool Device::IsActive() const {
  return address_ == a2dp_interface_->active_peer();
}
+6 −0
Original line number Diff line number Diff line
@@ -55,6 +55,12 @@ class Device {
      uint16_t ctrl_mtu, uint16_t browse_mtu);
  virtual ~Device() = default;

  /**
   * Gets a weak pointer to this device that is invalidated when the device is
   * disconnected.
   */
  base::WeakPtr<Device> Get();

  const RawAddress& GetAddress() const { return address_; };

  /**