OSDN Git Service

AVRCP: Verify SetBrowsedPlayer player ID
authorHansong Zhang <hsz@google.com>
Mon, 14 May 2018 23:48:58 +0000 (16:48 -0700)
committerHansong Zhang <hsz@google.com>
Tue, 15 May 2018 20:15:35 +0000 (13:15 -0700)
IUT should reject the invalid SetBrowsedPlayer command sent from PTS.

Bug: 79377126
Test: PTS AVRCP/TG/MPS/BI-02-C
Change-Id: I2afde442e3b3563f4a1a37e2914c9b16fe07e8fc
(cherry picked from commit f54a72cd8dcfae62ccab5d0b03b50539dde5c520)

profile/avrcp/device.cc

index 6e07f05..c8cf085 100644 (file)
@@ -1027,8 +1027,13 @@ void Device::SetBrowsedPlayerResponse(
   DEVICE_VLOG(2) << __func__ << ": success=" << success << " root_id=\""
                  << root_id << "\" num_items=" << num_items;
 
-  // TODO (apanicke): Check success. Right now this is ok since it will
-  // always succeed since we only have one player in the media layer.
+  if (!success) {
+    auto response = SetBrowsedPlayerResponseBuilder::MakeBuilder(
+        Status::INVALID_PLAYER_ID, 0x0000, num_items, 0, "");
+    send_message(label, true, std::move(response));
+    return;
+  }
+
   curr_browsed_player_id_ = pkt->GetPlayerId();
 
   // Clear the path and push the new root.