From d539958c6f8854ce4c8dc953bcdcd6696747c2ac Mon Sep 17 00:00:00 2001 From: Joseph Pirozzo Date: Thu, 2 May 2019 16:45:03 -0700 Subject: [PATCH] Handling of incoming AVRCP Controller connections Resolve edge cases on incoming AVRCP Controllers Remote Controller cases, both caused the remote control component to either generate an out of bounds error or fail to update peer features. Test: receive incoming AVRCP connection Bug: 130750865 Change-Id: I15abd2fd4bc963889d6cdfe9364a651e2b4c3c10 Merged-In: I15abd2fd4bc963889d6cdfe9364a651e2b4c3c10 --- bta/av/bta_av_act.cc | 4 ++-- btif/src/btif_av.cc | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bta/av/bta_av_act.cc b/bta/av/bta_av_act.cc index ead7e29e0..a7278420a 100644 --- a/bta/av/bta_av_act.cc +++ b/bta/av/bta_av_act.cc @@ -1873,9 +1873,9 @@ void bta_av_rc_disc_done(UNUSED_ATTR tBTA_AV_DATA* p_data) { /* * In case scb is not created by the time we are done with SDP * we still need to send RC feature event. So we need to get BD - * from Message + * from Message. Note that lidx is 1 based not 0 based */ - rc_feat.peer_addr = p_cb->lcb[p_cb->rcb[rc_handle].lidx].addr; + rc_feat.peer_addr = p_cb->lcb[p_cb->rcb[rc_handle].lidx - 1].addr; } else { rc_feat.peer_addr = p_scb->PeerAddress(); } diff --git a/btif/src/btif_av.cc b/btif/src/btif_av.cc index 3659534ee..24e32ec10 100644 --- a/btif/src/btif_av.cc +++ b/btif/src/btif_av.cc @@ -1244,6 +1244,9 @@ BtifAvPeer* BtifAvSink::FindOrCreatePeer(const RawAddress& peer_address, peer = new BtifAvPeer(peer_address, AVDT_TSEP_SRC, bta_handle, peer_id); peers_.insert(std::make_pair(peer_address, peer)); peer->Init(); + if (active_peer_.IsEmpty()) { + active_peer_ = peer_address; + } return peer; } -- 2.11.0