From fe5d973670cc6f95d7431f5a0699a326032e8b06 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Wed, 30 May 2018 14:16:23 -0700 Subject: [PATCH] AVRCP: Reject invalid PlayItem and SetAddressedPlayer command * Use CType REJECT to reject invalid PlayItem command * Reject SetAddressPlayer command as it is not implemented Bug: 80481276 Bug: 80483247 Test: PTS AVRCP/TG/MCN/NP/BI-01-C Change-Id: I837f6d2661e94e09afaa72a9c0c77d5c1ffe9e98 --- profile/avrcp/device.cc | 8 ++++---- profile/avrcp/tests/avrcp_device_test.cc | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/profile/avrcp/device.cc b/profile/avrcp/device.cc index 7baf77048..d2a985f98 100644 --- a/profile/avrcp/device.cc +++ b/profile/avrcp/device.cc @@ -126,8 +126,8 @@ void Device::VendorPacketHandler(uint8_t label, // this currently since the current implementation only has one // player and the player will never change, but we need it for a // more complete implementation. - auto response = - SetAddressedPlayerResponseBuilder::MakeBuilder(Status::NO_ERROR); + auto response = RejectBuilder::MakeBuilder( + CommandPdu::SET_ADDRESSED_PLAYER, Status::INVALID_PLAYER_ID); send_message(label, false, std::move(response)); } break; @@ -605,8 +605,8 @@ void Device::HandlePlayItem(uint8_t label, if (media_id == "") { DEVICE_VLOG(2) << "Could not find item"; - auto response = - PlayItemResponseBuilder::MakeBuilder(Status::DOES_NOT_EXIST); + auto response = RejectBuilder::MakeBuilder(CommandPdu::PLAY_ITEM, + Status::DOES_NOT_EXIST); send_message(label, false, std::move(response)); return; } diff --git a/profile/avrcp/tests/avrcp_device_test.cc b/profile/avrcp/tests/avrcp_device_test.cc index ead46435e..d50644c2a 100644 --- a/profile/avrcp/tests/avrcp_device_test.cc +++ b/profile/avrcp/tests/avrcp_device_test.cc @@ -713,8 +713,8 @@ TEST_F(AvrcpDeviceTest, setAddressedPlayerTest) { test_device->RegisterInterfaces(&interface, &a2dp_interface, nullptr); - auto set_addr_player_rsp = - SetAddressedPlayerResponseBuilder::MakeBuilder(Status::NO_ERROR); + auto set_addr_player_rsp = RejectBuilder::MakeBuilder( + CommandPdu::SET_ADDRESSED_PLAYER, Status::INVALID_PLAYER_ID); EXPECT_CALL(response_cb, Call(1, false, matchPacket(std::move(set_addr_player_rsp)))) -- 2.11.0