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

Commit d447ad1e authored by Hansong Zhang's avatar Hansong Zhang Committed by android-build-merger
Browse files

AVRCP: Reject invalid PlayItem and SetAddressedPlayer command

am: 10313d37

Change-Id: I4909911afd83dd2d0b9ffac5a899098ff50405b2
parents e3d6c4db 10313d37
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -133,8 +133,8 @@ void Device::VendorPacketHandler(uint8_t label,
      // this currently since the current implementation only has one
      // this currently since the current implementation only has one
      // player and the player will never change, but we need it for a
      // player and the player will never change, but we need it for a
      // more complete implementation.
      // more complete implementation.
      auto response =
      auto response = RejectBuilder::MakeBuilder(
          SetAddressedPlayerResponseBuilder::MakeBuilder(Status::NO_ERROR);
          CommandPdu::SET_ADDRESSED_PLAYER, Status::INVALID_PLAYER_ID);
      send_message(label, false, std::move(response));
      send_message(label, false, std::move(response));
    } break;
    } break;


@@ -612,8 +612,8 @@ void Device::HandlePlayItem(uint8_t label,


  if (media_id == "") {
  if (media_id == "") {
    DEVICE_VLOG(2) << "Could not find item";
    DEVICE_VLOG(2) << "Could not find item";
    auto response =
    auto response = RejectBuilder::MakeBuilder(CommandPdu::PLAY_ITEM,
        PlayItemResponseBuilder::MakeBuilder(Status::DOES_NOT_EXIST);
                                               Status::DOES_NOT_EXIST);
    send_message(label, false, std::move(response));
    send_message(label, false, std::move(response));
    return;
    return;
  }
  }
+2 −2
Original line number Original line Diff line number Diff line
@@ -713,8 +713,8 @@ TEST_F(AvrcpDeviceTest, setAddressedPlayerTest) {


  test_device->RegisterInterfaces(&interface, &a2dp_interface, nullptr);
  test_device->RegisterInterfaces(&interface, &a2dp_interface, nullptr);


  auto set_addr_player_rsp =
  auto set_addr_player_rsp = RejectBuilder::MakeBuilder(
      SetAddressedPlayerResponseBuilder::MakeBuilder(Status::NO_ERROR);
      CommandPdu::SET_ADDRESSED_PLAYER, Status::INVALID_PLAYER_ID);


  EXPECT_CALL(response_cb,
  EXPECT_CALL(response_cb,
              Call(1, false, matchPacket(std::move(set_addr_player_rsp))))
              Call(1, false, matchPacket(std::move(set_addr_player_rsp))))