Loading system/profile/avrcp/Android.bp +5 −0 Original line number Diff line number Diff line Loading @@ -116,8 +116,13 @@ cc_fuzz { "packages/modules/Bluetooth/system/packet/tests", "packages/modules/Bluetooth/system/stack/include", ], shared_libs: [ "libaconfig_storage_read_api_cc", "server_configurable_flags", ], static_libs: [ "avrcp-target-service", "bluetooth_flags_c_lib", "lib-bt-packets", "lib-bt-packets-avrcp", "lib-bt-packets-base", Loading system/profile/avrcp/device.cc +26 −4 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include "device.h" #include <bluetooth/log.h> #include <com_android_bluetooth_flags.h> #include "abstract_message_loop.h" #include "avrcp_common.h" Loading Loading @@ -776,9 +777,30 @@ void Device::GetElementAttributesResponse(uint8_t label, } } } else { // zero attributes requested which means all attributes requested if (!com::android::bluetooth::flags::get_all_element_attributes_empty()) { for (const auto& attribute : info.attributes) { response->AddAttributeEntry(attribute); } } else { std::vector<Attribute> all_attributes = {Attribute::TITLE, Attribute::ARTIST_NAME, Attribute::ALBUM_NAME, Attribute::TRACK_NUMBER, Attribute::TOTAL_NUMBER_OF_TRACKS, Attribute::GENRE, Attribute::PLAYING_TIME, Attribute::DEFAULT_COVER_ART}; for (const auto& attribute : all_attributes) { if (info.attributes.find(attribute) != info.attributes.end()) { response->AddAttributeEntry(*info.attributes.find(attribute)); } else { // If all attributes were requested, we send a response even for attributes that we don't // have a value for. response->AddAttributeEntry(attribute, std::string()); } } } } send_message(label, false, std::move(response)); Loading Loading @@ -1402,7 +1424,7 @@ void Device::GetVFSListResponse(uint8_t label, std::shared_ptr<GetFolderItemsReq auto title = song.attributes.find(Attribute::TITLE) != song.attributes.end() ? song.attributes.find(Attribute::TITLE)->value() : "No Song Info"; : std::string(); MediaElementItem song_item(vfs_ids_.get_uid(song.media_id), title, std::set<AttributeEntry>()); Loading Loading @@ -1445,7 +1467,7 @@ void Device::GetNowPlayingListResponse(uint8_t label, std::shared_ptr<GetFolderI auto title = song.attributes.find(Attribute::TITLE) != song.attributes.end() ? song.attributes.find(Attribute::TITLE)->value() : "No Song Info"; : std::string(); MediaElementItem item(i + 1, title, std::set<AttributeEntry>()); if (pkt->GetNumAttributes() == 0x00) { Loading Loading
system/profile/avrcp/Android.bp +5 −0 Original line number Diff line number Diff line Loading @@ -116,8 +116,13 @@ cc_fuzz { "packages/modules/Bluetooth/system/packet/tests", "packages/modules/Bluetooth/system/stack/include", ], shared_libs: [ "libaconfig_storage_read_api_cc", "server_configurable_flags", ], static_libs: [ "avrcp-target-service", "bluetooth_flags_c_lib", "lib-bt-packets", "lib-bt-packets-avrcp", "lib-bt-packets-base", Loading
system/profile/avrcp/device.cc +26 −4 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include "device.h" #include <bluetooth/log.h> #include <com_android_bluetooth_flags.h> #include "abstract_message_loop.h" #include "avrcp_common.h" Loading Loading @@ -776,9 +777,30 @@ void Device::GetElementAttributesResponse(uint8_t label, } } } else { // zero attributes requested which means all attributes requested if (!com::android::bluetooth::flags::get_all_element_attributes_empty()) { for (const auto& attribute : info.attributes) { response->AddAttributeEntry(attribute); } } else { std::vector<Attribute> all_attributes = {Attribute::TITLE, Attribute::ARTIST_NAME, Attribute::ALBUM_NAME, Attribute::TRACK_NUMBER, Attribute::TOTAL_NUMBER_OF_TRACKS, Attribute::GENRE, Attribute::PLAYING_TIME, Attribute::DEFAULT_COVER_ART}; for (const auto& attribute : all_attributes) { if (info.attributes.find(attribute) != info.attributes.end()) { response->AddAttributeEntry(*info.attributes.find(attribute)); } else { // If all attributes were requested, we send a response even for attributes that we don't // have a value for. response->AddAttributeEntry(attribute, std::string()); } } } } send_message(label, false, std::move(response)); Loading Loading @@ -1402,7 +1424,7 @@ void Device::GetVFSListResponse(uint8_t label, std::shared_ptr<GetFolderItemsReq auto title = song.attributes.find(Attribute::TITLE) != song.attributes.end() ? song.attributes.find(Attribute::TITLE)->value() : "No Song Info"; : std::string(); MediaElementItem song_item(vfs_ids_.get_uid(song.media_id), title, std::set<AttributeEntry>()); Loading Loading @@ -1445,7 +1467,7 @@ void Device::GetNowPlayingListResponse(uint8_t label, std::shared_ptr<GetFolderI auto title = song.attributes.find(Attribute::TITLE) != song.attributes.end() ? song.attributes.find(Attribute::TITLE)->value() : "No Song Info"; : std::string(); MediaElementItem item(i + 1, title, std::set<AttributeEntry>()); if (pkt->GetNumAttributes() == 0x00) { Loading