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

Commit c1830883 authored by Archie Pusaka's avatar Archie Pusaka Committed by Gerrit Code Review
Browse files

Merge "avrcp: fix responding to rejected volume notification registration" into main

parents bf5389ff a7d3e6d9
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -44,8 +44,11 @@ bool RegisterNotificationResponse::IsValid() const {
  if (size() < kMinSize()) {
    return false;
  }
  if (GetCType() != CType::INTERIM && GetCType() != CType::CHANGED &&
      GetCType() != CType::REJECTED) {
  // Rejected type packets is not followed by event, but by error code instead.
  if (GetCType() == CType::REJECTED) {
    return true;
  }
  if (GetCType() != CType::INTERIM && GetCType() != CType::CHANGED) {
    return false;
  }

+6 −3
Original line number Diff line number Diff line
@@ -135,12 +135,15 @@ void Device::VendorPacketHandler(uint8_t label, std::shared_ptr<VendorPacket> pk
          return;
        }

        if (register_notification->GetEvent() != Event::VOLUME_CHANGED) {
        // The rejected packet doesn't have an event field, so we just have to assume it is indeed
        // for the volume changed event since that's the only one we possibly register.
        if (pkt->GetCType() == CType::REJECTED ||
            register_notification->GetEvent() == Event::VOLUME_CHANGED) {
          HandleVolumeChanged(label, register_notification);
        } else {
          log::warn("{}: Unhandled register notification received: {}", address_,
                    register_notification->GetEvent());
          return;
        }
        HandleVolumeChanged(label, register_notification);
        break;
      }
      case CommandPdu::SET_ABSOLUTE_VOLUME: