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

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

Merge cherrypicks of [13924074, 13924075, 13924587, 13923962, 13924417,...

Merge cherrypicks of [13924074, 13924075, 13924587, 13923962, 13924417, 13924418, 13924419, 13923941, 13924588, 13923901, 13923902, 13924076, 13924077, 13924420, 13924421, 13924422, 13924423, 13924424, 13924645, 13924589, 13922107, 13924332, 13924333, 13924334, 13924335, 13924336, 13924665, 13923963, 13924646, 13924590, 13924666, 13923971, 13923942] into rvc-qpr2-release

Change-Id: I9cf56e73313a4bdae47c9f22b18070af9cfaa3c2
parents 7a46e868 49b99283
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)
+2 −0
Original line number Diff line number Diff line
@@ -726,6 +726,7 @@ static void on_l2cap_data_ind(tBTA_JV* evt, uint32_t id) {
               << ": unable to push data to socket - closing  fixed channel";
      BTA_JvL2capCloseLE(sock->handle);
      btsock_l2cap_free_l(sock);
      return;
    }

  } else {
@@ -744,6 +745,7 @@ static void on_l2cap_data_ind(tBTA_JV* evt, uint32_t id) {
                   << ": unable to push data to socket - closing channel";
          BTA_JvL2capClose(sock->handle);
          btsock_l2cap_free_l(sock);
          return;
        }
      }
    }
+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;
  }
+10 −0
Original line number Diff line number Diff line
@@ -689,6 +689,16 @@ void smp_process_pairing_public_key(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
  memcpy(pt.x, p_cb->peer_publ_key.x, BT_OCTET32_LEN);
  memcpy(pt.y, p_cb->peer_publ_key.y, BT_OCTET32_LEN);

  if (!memcmp(p_cb->peer_publ_key.x, p_cb->loc_publ_key.x, BT_OCTET32_LEN) &&
      !memcmp(p_cb->peer_publ_key.y, p_cb->loc_publ_key.y, BT_OCTET32_LEN)) {
    android_errorWriteLog(0x534e4554, "174886838");
    SMP_TRACE_WARNING("Remote and local public keys can't match");
    tSMP_INT_DATA smp;
    smp.status = SMP_PAIR_AUTH_FAIL;
    smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &smp);
    return;
  }

  if (!ECC_ValidatePoint(pt)) {
    android_errorWriteLog(0x534e4554, "72377774");
    tSMP_INT_DATA smp;