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

Commit 4e7d4377 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 7187929 from e2e785e3 to rvc-qpr3-release

Change-Id: Ib8d0cf5ba80426e5b5dba9aed736fca2811ce684
parents 2aec6d8b e2e785e3
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include <base/strings/stringprintf.h>
#include <string.h>
#include <map>
#include <mutex>

#include <hardware/bluetooth.h>
#include <hardware/bt_av.h>
@@ -532,6 +533,7 @@ class BtifAvSource {
  std::set<RawAddress> silenced_peers_;
  RawAddress active_peer_;
  std::map<uint8_t, tBTA_AV_HNDL> peer_id2bta_handle_;
  std::mutex mutex_;
};

class BtifAvSink {
@@ -649,6 +651,7 @@ class BtifAvSink {
  std::map<RawAddress, BtifAvPeer*> peers_;
  RawAddress active_peer_;
  std::map<uint8_t, tBTA_AV_HNDL> peer_id2bta_handle_;
  std::mutex mutex_;
};

/*****************************************************************************
@@ -1036,6 +1039,7 @@ BtifAvPeer* BtifAvSource::FindPeerByPeerId(uint8_t peer_id) {

BtifAvPeer* BtifAvSource::FindOrCreatePeer(const RawAddress& peer_address,
                                           tBTA_AV_HNDL bta_handle) {
  std::unique_lock<std::mutex> lock(mutex_);
  BTIF_TRACE_DEBUG("%s: peer_address=%s bta_handle=0x%x", __PRETTY_FUNCTION__,
                   peer_address.ToString().c_str(), bta_handle);

@@ -1141,6 +1145,7 @@ void BtifAvSource::RegisterAllBtaHandles() {
}

void BtifAvSource::DeregisterAllBtaHandles() {
  std::unique_lock<std::mutex> lock(mutex_);
  for (auto it : peer_id2bta_handle_) {
    tBTA_AV_HNDL bta_handle = it.second;
    BTA_AvDeregister(bta_handle);
@@ -1150,6 +1155,7 @@ void BtifAvSource::DeregisterAllBtaHandles() {

void BtifAvSource::BtaHandleRegistered(uint8_t peer_id,
                                       tBTA_AV_HNDL bta_handle) {
  std::unique_lock<std::mutex> lock(mutex_);
  peer_id2bta_handle_.insert(std::make_pair(peer_id, bta_handle));

  // Set the BTA Handle for the Peer (if exists)
@@ -1240,6 +1246,7 @@ BtifAvPeer* BtifAvSink::FindPeerByPeerId(uint8_t peer_id) {

BtifAvPeer* BtifAvSink::FindOrCreatePeer(const RawAddress& peer_address,
                                         tBTA_AV_HNDL bta_handle) {
  std::unique_lock<std::mutex> lock(mutex_);
  BTIF_TRACE_DEBUG("%s: peer_address=%s bta_handle=0x%x", __PRETTY_FUNCTION__,
                   peer_address.ToString().c_str(), bta_handle);

@@ -1348,6 +1355,7 @@ void BtifAvSink::RegisterAllBtaHandles() {
}

void BtifAvSink::DeregisterAllBtaHandles() {
  std::unique_lock<std::mutex> lock(mutex_);
  for (auto it : peer_id2bta_handle_) {
    tBTA_AV_HNDL bta_handle = it.second;
    BTA_AvDeregister(bta_handle);
@@ -1356,6 +1364,7 @@ void BtifAvSink::DeregisterAllBtaHandles() {
}

void BtifAvSink::BtaHandleRegistered(uint8_t peer_id, tBTA_AV_HNDL bta_handle) {
  std::unique_lock<std::mutex> lock(mutex_);
  peer_id2bta_handle_.insert(std::make_pair(peer_id, bta_handle));

  // Set the BTA Handle for the Peer (if exists)
+4 −3
Original line number Diff line number Diff line
@@ -634,9 +634,10 @@ static void avrc_msg_cback(uint8_t handle, uint8_t label, uint8_t cr,
  tAVRC_MSG_VENDOR* p_msg = &msg.vendor;

  if (cr == AVCT_CMD && (p_pkt->layer_specific & AVCT_DATA_CTRL &&
                         AVRC_PACKET_LEN < sizeof(p_pkt->len))) {
    /* Ignore the invalid AV/C command frame */
    p_drop_msg = "dropped - too long AV/C cmd frame size";
                         p_pkt->len > AVRC_PACKET_LEN)) {
    android_errorWriteLog(0x534e4554, "177611958");
    AVRC_TRACE_WARNING("%s: Command length %d too long: must be at most %d",
                       __func__, p_pkt->len, AVRC_PACKET_LEN);
    osi_free(p_pkt);
    return;
  }