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

Commit fdcd0200 authored by Jakub Rotkiewicz's avatar Jakub Rotkiewicz
Browse files

[avrc] Fix SendPlayerSettingsChanged logging

Instead of such logs:
10-18 12:42:48.389767  2203  2203 I bt_stack: [INFO:avrcp_service.cc(570)] attribute=PlayerAttribute::REPEAT : value=PlayerRepeatValue::OFF
10-18 12:42:48.389767  2203  2203 I bt_stack: attribute=PlayerAttribute::SHUFFLE : value=PlayerShuffleValue::OFF
10-18 12:42:48.389767  2203  2203 I bt_stack:

print:
03-15 11:38:19.864  4673  4673 I bluetooth: packages/modules/Bluetooth/system/btif/avrcp/avrcp_service.cc:569 SendPlayerSettingsChanged: {attribute=PlayerAttribute::REPEAT : value=PlayerRepeatValue::OFF}, {attribute=PlayerAttribute::SHUFFLE : value=PlayerShuffleValue::OFF}

Also handle the case when attributes size does not match values size.

Test: None - log only
Tag: #feature
Bug: 329809288
Change-Id: I2c5a0c36d6728c93f52ac5a4b8e835952f47d4f6
parent af3f35a9
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -548,10 +548,14 @@ void AvrcpService::SendActiveDeviceChanged(const RawAddress& address) {

void AvrcpService::SendPlayerSettingsChanged(
    std::vector<PlayerAttribute> attributes, std::vector<uint8_t> values) {
  log::info("");
  if (attributes.size() != values.size()) {
    log::error("Attributes size {} doesn't match values size {}",
               attributes.size(), values.size());
    return;
  }
  std::stringstream ss;
  for (size_t i = 0; i < attributes.size(); i++) {
    ss << "attribute=" << attributes.at(i) << " : ";
    ss << "{attribute=" << attributes.at(i) << " : ";
    if (attributes.at(i) == PlayerAttribute::REPEAT) {
      ss << "value=" << (PlayerRepeatValue)values.at(i);
    } else if (attributes.at(i) == PlayerAttribute::SHUFFLE) {
@@ -559,7 +563,7 @@ void AvrcpService::SendPlayerSettingsChanged(
    } else {
      ss << "value=" << std::to_string(values.at(i));
    }
    ss << std::endl;
    ss << ((i + 1 < attributes.size()) ? "}, " : "}");
  }

  log::info("{}", ss.str());