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

Commit 7c84603f authored by Hansong Zhang's avatar Hansong Zhang
Browse files

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
parent 0fa11449
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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;
  }
+2 −2
Original line number Diff line number Diff line
@@ -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))))