Loading system/btif/avrcp/avrcp_service.cc +10 −9 Original line number Diff line number Diff line Loading @@ -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)); } } Loading @@ -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)); } } Loading system/profile/avrcp/device.cc +2 −0 Original line number Diff line number Diff line Loading @@ -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(); } Loading system/profile/avrcp/device.h +6 −0 Original line number Diff line number Diff line Loading @@ -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_; }; /** Loading Loading
system/btif/avrcp/avrcp_service.cc +10 −9 Original line number Diff line number Diff line Loading @@ -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)); } } Loading @@ -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)); } } Loading
system/profile/avrcp/device.cc +2 −0 Original line number Diff line number Diff line Loading @@ -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(); } Loading
system/profile/avrcp/device.h +6 −0 Original line number Diff line number Diff line Loading @@ -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_; }; /** Loading