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

Commit ae5897e8 authored by Xin Li's avatar Xin Li
Browse files

DO NOT MERGE - Merge RQ2A.210505.003.

Bug: 187544653
Merged-In: I592c0a9c0e77869999357611aa99f3d9bc53b8b6
Change-Id: I9b78552543c66bb607baee982d904e8939941cea
parents 44fbfde9 b42fb855
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -536,6 +536,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 {
@@ -654,6 +655,7 @@ class BtifAvSink {
  std::map<RawAddress, BtifAvPeer*> peers_;
  RawAddress active_peer_;
  std::map<uint8_t, tBTA_AV_HNDL> peer_id2bta_handle_;
  std::mutex mutex_;
};

/*****************************************************************************
@@ -1041,6 +1043,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);

@@ -1145,6 +1148,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);
@@ -1154,6 +1158,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)
@@ -1246,6 +1251,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);

@@ -1353,6 +1359,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);
@@ -1361,6 +1368,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)
+1 −0
Original line number Diff line number Diff line
@@ -624,6 +624,7 @@ static void on_l2cap_data_ind(tBTA_JV* evt, uint32_t id) {
                 sock->id);
        BTA_JvL2capClose(sock->handle);
        btsock_l2cap_free_l(sock);
        return;
      }
    }
  }
+4 −3
Original line number Diff line number Diff line
@@ -633,9 +633,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
@@ -695,6 +695,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;