OSDN Git Service

AVRCP: Keep the device in the map on disconnect
authorJoonghong Park <joonghong.park@samsung.com>
Sun, 21 Apr 2019 23:26:58 +0000 (08:26 +0900)
committerTed Wang <tedwang@google.com>
Wed, 4 Sep 2019 13:41:41 +0000 (21:41 +0800)
commitd0ab5525f68d8fe62c35d73b6e70cc28f63b2eb6
tree4fb459d875aa474b9fb5fd476f55bb70eaef7b85
parent7d8ab19529f86baa884b8763fffca7fdd8538619
AVRCP: Keep the device in the map on disconnect

Fixes a stack crash when disconnecting AVRCP

If an AVRCP connection, established by AVRC_OPEN_IND_EVT, is disconnected
by calling DisconnectDevice() in Connection Handler, there is a corner
case that does not clear Connection Control Block (CCB) entirely of a
opened handle.
So when there is re-connection trials, partially cleared CCBs causes
a critical stack crash.

When calling DisconnectDevice() in Connection Handler, there are issues.
-Keeping removed CCB info partially, such as member variable "allocated",
even though receiving AVRC_CLOSE_IND_EVT followed by clearing
Link Control Block (LCB).
-Keeping remote device address in feature_map_

This commit fixes the issue of above scenario, by keeping handle in
device_map_ and removing to send disconnected notification
when calling DisconnectDevice().
So when receiving AVRC_CLOSE_IND_EVT, normal procedure is conducted.

Note that AVRC_CLOSE_IND_EVT is occurred by both
AVCT_DISCONNECT_IND_EVT and AVCT_DISCONNECT_CFM_EVT.
And when calling avrc_->Close() in DisconnectDevice(), it just requests
to unbind LCB instead of dealloc CCB.
And when receiving AVRC_CLOSE_IND_EVT avrc_->Close() dealloc CCB.

Bug:139642151
Test: Test on phone with some products which has A/V Remote Control
such as Britz(BE-ME350) and airpod
Change-Id: Ic8bc3459afd4518447d6d52b1f8afb7b3e09a8b5
Signed-off-by: Joonghong Park <joonghong.park@samsung.com>
profile/avrcp/connection_handler.cc