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

Commit 13d845bb authored by Ajay Panicker's avatar Ajay Panicker
Browse files

Add AVRCP native logging to dumpsys

Example output
AVRCP Target Native Service: 2 devices
  d4:90:9c:0a:48:d0
    Current Volume: 42
    Current Browsed Player ID: -1
    Registered Notifications:
      Play Status
    Last Play State: 2
    Last Song Sent ID: ""
    Current Folder: ""
    MTU Sizes: CTRL=1020 BROWSE=332

Bug: 79167906
Test: adb shell dumpsys bluetooth_manager
Change-Id: I749dc3c568ac7793ac924ab1e46c3fc7ae42a260
parent 58460da8
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -405,19 +405,19 @@ bool AvrcpService::ServiceInterfaceImpl::Cleanup() {

void AvrcpService::DebugDump(int fd) {
  if (instance_ == nullptr) {
    dprintf(fd, "AVRCP Target Service not started");
    dprintf(fd, "\nAVRCP Target Service not started\n");
    return;
  }

  dprintf(fd, "Avrcp Service:\n");

  auto device_list = instance_->connection_handler_->GetListOfDevices();
  dprintf(fd, "Number of connected deviced: %zu\n", device_list.size());
  dprintf(fd, "\nAVRCP Target Native Service: %zu devices\n",
          device_list.size());

  std::stringstream stream;
  for (auto device : device_list) {
    stream << device;
    stream << *device << std::endl;
  }
  dprintf(fd, "%s\n", stream.str().c_str());
  dprintf(fd, "%s", stream.str().c_str());
}

}  // namespace avrcp
+1 −0
Original line number Diff line number Diff line
@@ -315,6 +315,7 @@ static void dump(int fd, const char** arguments) {
  btif_debug_av_dump(fd);
  bta_debug_av_dump(fd);
  stack_debug_avdtp_api_dump(fd);
  bluetooth::avrcp::AvrcpService::DebugDump(fd);
  btif_debug_config_dump(fd);
  BTA_HfClientDumpStatistics(fd);
  wakelock_debug_dump(fd);
+33 −20
Original line number Diff line number Diff line
@@ -1081,29 +1081,42 @@ static std::string volumeToStr(int8_t volume) {
}

std::ostream& operator<<(std::ostream& out, const Device& d) {
  out << "Avrcp Device: Address=" << d.address_.ToString() << std::endl;
  out << "  └ isActive: " << (d.IsActive() ? "YES" : "NO") << std::endl;
  out << "  └ Current Browsed Player: " << d.curr_browsed_player_id_
  out << "  " << d.address_.ToString();
  if (d.IsActive()) out << " <Active>";
  out << std::endl;
  out << "    Current Volume: " << volumeToStr(d.volume_) << std::endl;
  out << "    Current Browsed Player ID: " << d.curr_browsed_player_id_
      << std::endl;
  out << "  └ Registered Notifications: " << std::endl;
  out << "    └ Track: " << d.track_changed_.first << std::endl;
  out << "    └ Play Status: " << d.play_status_changed_.first << std::endl;
  out << "    └ Play Position: " << d.play_pos_changed_.first << std::endl;
  out << "    └ Now Playing: " << d.now_playing_changed_.first << std::endl;
  out << "    └ Addressed Player: " << d.addr_player_changed_.first
  out << "    Registered Notifications: " << std::endl;
  if (d.track_changed_.first) {
    out << "      Track Changed" << std::endl;
  }
  if (d.play_status_changed_.first) {
    out << "      Play Status" << std::endl;
  }
  if (d.play_pos_changed_.first) {
    out << "      Play Position" << std::endl;
  }
  if (d.now_playing_changed_.first) {
    out << "      Now Playing" << std::endl;
  }
  if (d.addr_player_changed_.first) {
    out << "      Addressed Player" << std::endl;
  }
  if (d.avail_players_changed_.first) {
    out << "      Available Players" << std::endl;
  }
  if (d.uids_changed_.first) {
    out << "      UIDs Changed" << std::endl;
  }

  out << "    Last Play State: " << d.last_play_status_.state << std::endl;
  out << "    Last Song Sent ID: \"" << d.last_song_info_.media_id << "\""
      << std::endl;
  out << "    └ Available Players: " << d.avail_players_changed_.first
  out << "    Current Folder: \"" << d.CurrentFolder() << "\"" << std::endl;
  out << "    MTU Sizes: CTRL=" << d.ctrl_mtu_ << " BROWSE=" << d.browse_mtu_
      << std::endl;
  out << "    └ UIDs Changed: " << d.uids_changed_.first << std::endl;
  out << "  └ Last Song Sent ID: " << d.last_song_info_.media_id << std::endl;
  out << "  └ Last Play State: " << d.last_play_status_.state << std::endl;
  out << "  └ Current Volume: " << volumeToStr(d.volume_) << std::endl;
  out << "  └ Current Folder: " << d.CurrentFolder();
  out << "  └ Control MTU Size: " << d.ctrl_mtu_ << std::endl;
  out << "  └ Browse MTU Size: " << d.browse_mtu_ << std::endl;
  out << "  └ Features Supported: TO BE IMPLEMENTED" << std::endl;
  out << "  └ Last X Media Key Events: TO BE IMPLEMENTED" << std::endl;
  out << std::endl;
  // TODO (apanicke): Add supported features as well as media keys
  return out;
}